summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/accents/accents.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-06-27 21:36:19 +0000
committerKarl Berry <karl@freefriends.org>2019-06-27 21:36:19 +0000
commitdd0a25b1c3c22f05e8cfdcd3b8514ac59fdc9dcb (patch)
tree96bcf91800a8013e4495fed248917d6f368d0d9b /Master/texmf-dist/tex/latex/accents/accents.sty
parent602d0a484dc53b95cd65f11a7ab4db83d6fc5f11 (diff)
accents (26jun19)
git-svn-id: svn://tug.org/texlive/trunk@51497 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/accents/accents.sty')
-rw-r--r--Master/texmf-dist/tex/latex/accents/accents.sty287
1 files changed, 287 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/accents/accents.sty b/Master/texmf-dist/tex/latex/accents/accents.sty
new file mode 100644
index 00000000000..2fb9db8ea39
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/accents/accents.sty
@@ -0,0 +1,287 @@
+%
+% Copyright (C) 1998-2019 Javier Bezos http://www.texnia.com
+%
+% This file may be distributed and/or modified under the conditions of
+% the MIT License. A version can be found at the end of this file.
+%
+% Changes
+% ~~~~~~~
+%
+% 2006-05-12. TeX converts to ord any symbol with a math accent.
+% Accents now emulates this behaviour with braces around the
+% nucleous; otherwise, the original category is preserved and
+% the accents could look misaligned. (Reported by Viet-TrungLuu.)
+%
+% Release
+% ~~~~~~~
+
+\ProvidesPackage{accents}[2006/05/12 v1.4 Math Accent Tools]
+
+\let\cc@palette\mathpalette
+
+\DeclareOption{nonscript}
+ {\renewcommand\cc@palette[2]{#1\textstyle{#2}}}
+
+\DeclareOption{single}
+ {\renewcommand\cc@accent[1]{\mathaccent#1}}
+
+\newdimen\cc@skew
+\newdimen\cc@wd
+
+\newcount\cc@code
+\newcount\cc@group
+\newcount\cc@skewchar
+
+\newif\ifcc@more
+
+% Code for real accents
+% ~~~~~~~~~~~~~~~~~~~~~
+
+\def\cc@accent#1#2{%
+ \begingroup
+ \cc@code=#1\relax
+ \let\math@bgroup\@empty
+ \def\math@egroup##1{\cc@setchar##1}%
+ \cc@palette\cc@@accent{#2}%
+ {\cc@nuc}%
+ \endgroup}
+
+\def\cc@iaccent#1#2{%
+ \cc@fetch{#2}%
+ \mathaccent#1{%
+ \ifcc@more#2\else
+ \cc@phant{#2}%
+ \gdef\cc@nuc{#2}%
+ \fi
+ \kern\cc@skew}%
+ \kern-\cc@skew}%
+
+\def\cc@@accent#1#2{%
+ \let\cc@style=#1%
+ \cc@fetch{#2}%
+ \mathaccent\cc@code{%
+ \ifcc@more#2\else
+ \cc@phant{#2}%
+ \gdef\cc@nuc{#2}%
+ \fi
+ \kern\cc@skew}%
+ \kern-\cc@skew
+ \kern\cc@wd}%
+
+% The accents are redefined:
+
+\begingroup
+
+\def\mathaccentV#1{\string"\noexpand\accentclass@}%
+\let\protect\@empty
+\let\mathaccent\@empty
+
+\def\cc@set#1{%
+ \xdef#1{\noexpand\protect\noexpand\cc@accent{#1}}}
+
+\cc@set\grave %{\protect\cc@accent{"7012\relax}}
+\cc@set\acute %{\protect\cc@accent{"7013\relax}}
+\cc@set\check %{\protect\cc@accent{"7014\relax}}
+\cc@set\breve %{\protect\cc@accent{"7015\relax}}
+\cc@set\bar %{\protect\cc@accent{"7016\relax}}
+\cc@set\hat %{\protect\cc@accent{"705E\relax}}
+\cc@set\dot %{\protect\cc@accent{"705F\relax}}
+\cc@set\tilde %{\protect\cc@accent{"707E\relax}}
+\cc@set\ddot %{\protect\cc@accent{"707F\relax}}
+\cc@set\vec %{\protect\cc@accent{"017E\relax}}
+\gdef\ring{\protect\cc@accent{"7017\relax}}
+
+\@ifundefined{mathring}{}{\cc@set\mathring}
+
+\endgroup
+
+% Faked accents
+% ~~~~~~~~~~~~~
+
+\newcommand\accentset[2]{%
+ \begingroup
+ \def\cc@a{#1}%
+ \let\math@bgroup\@empty
+ \def\math@egroup##1{\cc@setchar##1}%
+ \cc@palette\cc@accentset{#2}%
+ {\cc@nuc}%
+ \endgroup}
+
+\def\cc@accentset#1#2{%
+ \let\cc@style#1%
+ \cc@fetch{#2}%
+ \sbox\z@{$\m@th\cc@style\mathgroup\cc@group
+ \ifcc@more#2\else\cc@phant{#2}%
+ \gdef\cc@nuc{#2}\fi$}%
+ \cc@align{%
+ \hidewidth\kern\cc@skew
+ $\m@th\scriptscriptstyle\mathgroup\cc@group\cc@a$%
+ \hidewidth\cr{\box\z@}}%
+ \kern\cc@wd}%
+
+\def\cc@iaccentset#1#2{%
+ \cc@fetch{#2}%
+ \sbox\z@{$\m@th\cc@style\ifcc@more#2\else\cc@phant{#2}%
+ \gdef\cc@nuc{#2}\fi$}%
+ \cc@align{%
+ \hidewidth\kern\cc@skew
+ $\m@th\scriptscriptstyle#1$\hidewidth\cr
+ {\box\z@}}}%
+
+\def\cc@align#1{%
+ \vbox{%
+ \baselineskip\z@skip
+ \lineskip.25ex
+ \ialign{##\crcr#1\crcr}}}
+
+% Shared by real and faked accents
+% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+\def\cc@phant#1{%
+ \v@true\h@true
+ \finph@nt}% with \box0 from \cc@fetch
+
+\def\cc@setchar{%
+ \cc@skewchar\ifnum\mathgroup=\m@ne
+ \skewchar\textfont\@ne
+ \else\ifnum\skewchar\textfont\mathgroup=\m@ne
+ \skewchar\textfont\@ne
+ \else\skewchar\textfont\mathgroup\fi\fi
+ \advance\cc@skewchar"7100 }
+
+\def\cc@fetch#1{%
+ \cc@group=\the\mathgroup
+ \let\cc@accent\@gobble
+ \let\accentset\@gobble
+ \sbox\z@{$\m@th\mathgroup\cc@group\cc@setchar
+ \cc@style#1{}\mathchar\cc@skewchar$}%
+ \sbox\@ne{$\m@th\mathgroup\cc@group\cc@setchar
+ \cc@style#1\mathchar\cc@skewchar$}%
+ \cc@morefalse
+ \def\cc@accent##1{\global\cc@moretrue}%
+ \def\accentset##1{\global\cc@moretrue}%
+ \global\cc@skew2\wd\@ne
+ \global\advance\cc@skew-2\wd\z@
+ \sbox\z@{$\m@th\mathgroup\cc@group\cc@style#1$}%
+ \global\cc@wd-\wd\z@
+ \let\cc@accent\cc@iaccent
+ \let\accentset\cc@iaccentset}
+
+% Two useful faked accents
+% ~~~~~~~~~~~~~~~~~~~~~~~~
+
+\def\dddot{\accentset{{\cc@style.\mkern-1.7mu\textstyle.\mkern-1.7mu.}}}
+\def\ddddot{\accentset{{\cc@style.\mkern-2.1mu.\mkern-2.1mu.\mkern-2.1mu.}}}
+
+% Underaccents
+% ~~~~~~~~~~~~
+
+\newcommand\underaccent[2]{%
+ \begingroup
+ \def\cc@a{#2}% Stores the nucleous...
+ \cc@palette\cc@underaccent{#1}% ...and the accent is passed
+ #2%
+ \endgroup}%
+
+\def\cc@underaccent#1#2{%
+ \let\cc@style#1%
+ \expandafter\in@\expandafter\cc@accent\expandafter{#2}%
+ \ifin@
+ \expandafter\cc@uaccent#2\@@%
+ \else
+ \cc@uaccentset{#2}%
+ \fi}
+
+\def\cc@uaccent#1#2#3\@@{% #1 and #2 gobbles \protect\cc@accent
+ \cc@under{%
+ \vbox to.2ex{%
+ \hbox{%
+ $\m@th
+ \cc@style
+ \mathgroup\cc@group
+ \cc@shift
+ \mathchar#3$}%
+ \vss}}}
+
+\def\cc@uaccentset#1{%
+ \cc@under{%
+ \hbox{%
+ $\m@th
+ \cc@style
+ \mathgroup\cc@group
+ \cc@shift
+ \scriptscriptstyle#1$}}}
+
+\def\cc@under#1{%
+ \cc@group\the\mathgroup
+ \sbox\z@{$\m@th\cc@style\mathgroup\cc@group\cc@a$}%
+ \sbox\tw@{$\scriptspace\z@\m@th\cc@style\mathgroup\cc@group\cc@a_{}$}%
+ \rlap{%
+ \oalign{%
+ \vrule \@depth\dp\z@ \@width\z@
+ \kern\wd\tw@
+ \crcr
+ \hidewidth#1\hidewidth}}}
+
+\def\cc@shift{%
+ \dimen@=-.000008ex
+ \multiply\dimen@\ifnum\mathgroup=\m@ne
+ \fontdimen\@ne\textfont\@ne
+ \else
+ \fontdimen\@ne\textfont\cc@group\fi
+ \kern\dimen@}
+
+% And \undertilde
+% ~~~~~~~~~~~~~~~
+
+\newcommand\undertilde{\cc@palette\cc@undertilde}
+
+\def\cc@undertilde#1#2{%
+ \cc@group\the\mathgroup
+ \sbox\z@{$\m@th\mathgroup\cc@group#1#2$}%
+ \oalign{%
+ $\m@th\mathgroup\cc@group#1#2$%
+ \crcr
+ \hidewidth
+ \vbox to.5ex{%
+ \hbox{%
+ $\hss
+ #1%
+ \mathgroup\cc@group
+ \widetilde{\hbox to\wd\z@{\hss}}%
+ \hss$}%
+ \vss}%
+ \hidewidth}}
+
+% The following command is used by \DeclareMathAccent
+% and it's the only part requiring modification
+
+\def\set@mathaccent#1#2#3#4{%
+ \xdef#2{\noexpand\protect\noexpand\cc@accent
+ {"\mathchar@type#3\hexnumber@#1#4\relax}}}
+
+\ProcessOptions
+
+\endinput
+
+MIT License
+-----------
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file