Debian Codegraph @

texmf-dist/source/latex/was/icomma.dtx

raw
1 %\CheckSum{28}
2 %
3 % \iffalse
4 %
5 % File `icomma.dtx'.
6 % Copyright (c) 2001, 2002 Walter Schmidt
7 %
8 % This program may be distributed and/or modified under the
9 % conditions of the LaTeX Project Public License, either version 1.2
10 % of this license or (at your option) any later version.
11 % The latest version of this license is in
12 % http://www.latex-project.org/lppl.txt
13 % and version 1.2 or later is part of all distributions of LaTeX
14 % version 1999/12/01 or later.
15 %
16 % This program consists of the files icomma.dtx and icomma.ins
17 %
18 % \fi
19 %
20 % \iffalse
21 %
22 %<*driver>
23 \ProvidesFile{icomma.drv}
24 %</driver>
25 %<package>\ProvidesPackage{icomma}
26 [2002/03/10 v2.0 (WaS)]
27 %<*driver>
28 \documentclass{ltxdoc}
29 \usepackage{url}
30 \CodelineNumbered
31 \begin{document}
32 \DocInput{icomma.dtx}
33 \end{document}
34 %</driver>
35 % \fi
36 %
37 % \GetFileInfo{icomma.drv}
38 % \DeleteShortVerb{\|}
39 % \MakeShortVerb{\+}
40 %
41 % \title{The \textsf{icomma} package for \LaTeXe}
42 % \author{Walter Schmidt\thanks{{\ttfamily [email protected]}}}
43 % \date{(\fileversion{} -- \filedate)}
44 % \maketitle\thispagestyle{empty}
45 %
46 % \noindent
47 % With ordinary \LaTeX{}, the comma cannot be used as a decimal separator
48 % in math mode, because it is treated as a punctuation character and
49 % \LaTeX\ adds some extra space after it. This can be overcome by defining
50 % an `intelligent' comma, which `recognizes', whether it is used as
51 % a decimal separator or as a punctuation character.
52 %
53 % An appropriate definition was given in \cite{icomma} and \cite{icomma-err}.
54 % However, it relied on the particular encoding of the CM fonts, so
55 % it would not always work with alternative math fonts such as Euler.
56 % The package \textsf{icomma} provides an enhanced variant of this
57 % `intelligent' comma. It can be used with the default CM math fonts
58 % as well as with alterative math font sets.
59 %
60 % After loading of the package, the comma will be typeset as a
61 % punctuation character, if the next \emph{input} character
62 % is a space; otherwise the comma is treated as a decimal separator.
63 % Thus, a decimal number is to be entered as, for instance,
64 % \begin{verse}
65 % +1,234+
66 % \end{verse}
67 % whereas the mathematical expression $(x, y)$ is to be written
68 % with a space after the comma:
69 % \begin{verse}
70 % \verb*|(x, y)|
71 % \end{verse}
72 %
73 % \section*{Bugs and problems}
74 % In case the `intelligent comma' is used together with the
75 % \textsf{dcolumn} package, a comma to be \emph{printed} as the
76 % decimal separator in a column of type +D+ is to be specified
77 % as +{\mathord\mathcomma}+, rather than +{,}+, since the latter
78 % leads to an error. For instance:
79 % \begin{verse}
80 % +\begin{tabular}{... D{,}{\mathord\mathcomma}{2} ...}+
81 % \end{verse}
82 % Note that specifying the comma as the related \emph{input} character
83 % works as usual.
84 %
85 % Generally, since the \textsf{icomma} package makes the comma `active',
86 % further problems are not unlikely.
87 %
88 % \StopEventually{
89 % \section*{Credits}
90 % Special thanks to Bernd Raichle for fixing the deficiencies of version~1.
91 %
92 % \begin{thebibliography}{1}
93 % \bibitem{icomma}
94 % \textsc{Richard Hirsch}.
95 % Dezimalkomma beim \TeX{}satz in deutsch.
96 % \textit{Die \TeX{}nische Kom\"odie 1/1994}
97 % (July 1994), 42--45.
98 % \bibitem{icomma-err}
99 % \textsc{Peter Schmitt}.
100 % Dezimalkomma beim \TeX{}satz in deutsch.
101 % \textit{Die \TeX{}nische Kom\"odie 4/1997}
102 % (Feb.\ 1998), 50.
103 % \end{thebibliography}
104 % }
105 %
106 % \section*{The package code}
107 % At +\begin{document}+, we memorize the +\mathcode+ of the `punctuation' comma,
108 % in the +\mathcomma+ macro,
109 % and we make the comma in math mode active:
110 % \begin{macrocode}
111 %<*package>
112 \AtBeginDocument{%
113 \mathchardef\mathcomma\mathcode`\,%
114 \mathcode`\,="8000 %
115 }
116 % \end{macrocode}
117 % The active comma checks the next input character.
118 % If this is a space , the active comma simply returns
119 % the saved +\mathcomma+; otherwise, +\mathord\mathcomma+ is returned,
120 % so that no space will be added:
121 % \begin{macrocode}
122 {\catcode`,=\active
123 \gdef,{\futurelet\@let@token\sm@rtcomma}
124 }
125 \def\sm@rtcomma{%
126 \ifx\@let@token\@sptoken \else
127 \ifx\@let@token\space \else
128 \mathord\fi\fi \mathcomma}
129 %</package>
130 % \end{macrocode}
131 %
132 % The next line of code prevents DocStrip from adding the
133 % character table to the generated package:
134 % \begin{macrocode}
135 \endinput
136 % \end{macrocode}
137 % \Finale
138 %% \CharacterTable
139 %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
140 %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
141 %% Digits \0\1\2\3\4\5\6\7\8\9
142 %% Exclamation \! Double quote \" Hash (number) \#
143 %% Dollar \$ Percent \% Ampersand \&
144 %% Acute accent \' Left paren \( Right paren \)
145 %% Asterisk \* Plus \+ Comma \,
146 %% Minus \- Point \. Solidus \/
147 %% Colon \: Semicolon \; Less than \<
148 %% Equals \= Greater than \> Question mark \?
149 %% Commercial at \@ Left bracket \[ Backslash \\
150 %% Right bracket \] Circumflex \^ Underscore \_
151 %% Grave accent \` Left brace \{ Vertical bar \|
152 %% Right brace \} Tilde \~}
153 %%