summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/was/icomma.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/was/icomma.dtx')
-rw-r--r--macros/latex/contrib/was/icomma.dtx153
1 files changed, 153 insertions, 0 deletions
diff --git a/macros/latex/contrib/was/icomma.dtx b/macros/latex/contrib/was/icomma.dtx
new file mode 100644
index 0000000000..712d1d9f8c
--- /dev/null
+++ b/macros/latex/contrib/was/icomma.dtx
@@ -0,0 +1,153 @@
+%\CheckSum{28}
+%
+% \iffalse
+%
+% File `icomma.dtx'.
+% Copyright (c) 2001, 2002 Walter Schmidt
+%
+% This program may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.2
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.2 or later is part of all distributions of LaTeX
+% version 1999/12/01 or later.
+%
+% This program consists of the files icomma.dtx and icomma.ins
+%
+% \fi
+%
+% \iffalse
+%
+%<*driver>
+\ProvidesFile{icomma.drv}
+%</driver>
+%<package>\ProvidesPackage{icomma}
+ [2002/03/10 v2.0 (WaS)]
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage{url}
+\CodelineNumbered
+\begin{document}
+ \DocInput{icomma.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \GetFileInfo{icomma.drv}
+% \DeleteShortVerb{\|}
+% \MakeShortVerb{\+}
+%
+% \title{The \textsf{icomma} package for \LaTeXe}
+% \author{Walter Schmidt\thanks{{\ttfamily w.a.schmidt@gmx.net}}}
+% \date{(\fileversion{} -- \filedate)}
+% \maketitle\thispagestyle{empty}
+%
+% \noindent
+% With ordinary \LaTeX{}, the comma cannot be used as a decimal separator
+% in math mode, because it is treated as a punctuation character and
+% \LaTeX\ adds some extra space after it. This can be overcome by defining
+% an `intelligent' comma, which `recognizes', whether it is used as
+% a decimal separator or as a punctuation character.
+%
+% An appropriate definition was given in \cite{icomma} and \cite{icomma-err}.
+% However, it relied on the particular encoding of the CM fonts, so
+% it would not always work with alternative math fonts such as Euler.
+% The package \textsf{icomma} provides an enhanced variant of this
+% `intelligent' comma. It can be used with the default CM math fonts
+% as well as with alterative math font sets.
+%
+% After loading of the package, the comma will be typeset as a
+% punctuation character, if the next \emph{input} character
+% is a space; otherwise the comma is treated as a decimal separator.
+% Thus, a decimal number is to be entered as, for instance,
+% \begin{verse}
+% +1,234+
+% \end{verse}
+% whereas the mathematical expression $(x, y)$ is to be written
+% with a space after the comma:
+% \begin{verse}
+% \verb*|(x, y)|
+% \end{verse}
+%
+% \section*{Bugs and problems}
+% In case the `intelligent comma' is used together with the
+% \textsf{dcolumn} package, a comma to be \emph{printed} as the
+% decimal separator in a column of type +D+ is to be specified
+% as +{\mathord\mathcomma}+, rather than +{,}+, since the latter
+% leads to an error. For instance:
+% \begin{verse}
+% +\begin{tabular}{... D{,}{\mathord\mathcomma}{2} ...}+
+% \end{verse}
+% Note that specifying the comma as the related \emph{input} character
+% works as usual.
+%
+% Generally, since the \textsf{icomma} package makes the comma `active',
+% further problems are not unlikely.
+%
+% \StopEventually{
+% \section*{Credits}
+% Special thanks to Bernd Raichle for fixing the deficiencies of version~1.
+%
+% \begin{thebibliography}{1}
+% \bibitem{icomma}
+% \textsc{Richard Hirsch}.
+% Dezimalkomma beim \TeX{}satz in deutsch.
+% \textit{Die \TeX{}nische Kom\"odie 1/1994}
+% (July 1994), 42--45.
+% \bibitem{icomma-err}
+% \textsc{Peter Schmitt}.
+% Dezimalkomma beim \TeX{}satz in deutsch.
+% \textit{Die \TeX{}nische Kom\"odie 4/1997}
+% (Feb.\ 1998), 50.
+% \end{thebibliography}
+% }
+%
+% \section*{The package code}
+% At +\begin{document}+, we memorize the +\mathcode+ of the `punctuation' comma,
+% in the +\mathcomma+ macro,
+% and we make the comma in math mode active:
+% \begin{macrocode}
+%<*package>
+\AtBeginDocument{%
+ \mathchardef\mathcomma\mathcode`\,%
+ \mathcode`\,="8000 %
+}
+% \end{macrocode}
+% The active comma checks the next input character.
+% If this is a space , the active comma simply returns
+% the saved +\mathcomma+; otherwise, +\mathord\mathcomma+ is returned,
+% so that no space will be added:
+% \begin{macrocode}
+{\catcode`,=\active
+ \gdef,{\futurelet\@let@token\sm@rtcomma}
+}
+\def\sm@rtcomma{%
+ \ifx\@let@token\@sptoken \else
+ \ifx\@let@token\space \else
+ \mathord\fi\fi \mathcomma}
+%</package>
+% \end{macrocode}
+%
+% The next line of code prevents DocStrip from adding the
+% character table to the generated package:
+% \begin{macrocode}
+\endinput
+% \end{macrocode}
+% \Finale
+%% \CharacterTable
+%% {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
+%% 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
+%% Digits \0\1\2\3\4\5\6\7\8\9
+%% Exclamation \! Double quote \" Hash (number) \#
+%% Dollar \$ Percent \% Ampersand \&
+%% Acute accent \' Left paren \( Right paren \)
+%% Asterisk \* Plus \+ Comma \,
+%% Minus \- Point \. Solidus \/
+%% Colon \: Semicolon \; Less than \<
+%% Equals \= Greater than \> Question mark \?
+%% Commercial at \@ Left bracket \[ Backslash \\
+%% Right bracket \] Circumflex \^ Underscore \_
+%% Grave accent \` Left brace \{ Vertical bar \|
+%% Right brace \} Tilde \~}
+%%