%% \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 \~} %\iffalse % % (c) copyright 2003 A Syropoulos & RWD Nickalls % This program can be redistributed and/or modified under the terms % of the LaTeX Project Public License Distributed from CTAN % archives in directory macros/latex/base/lppl.txt; either % version 1 of the License, or any later version. % % However, the above copyright notice does not apply in the case of % ``Crete University Press'' as this publisher is not allowed to % use or alter this file in any way. % % Please report errors or suggestions for improvement to % % Apostolos Syropoulos and/or Dick Nickalls % apostolo@obelix.ee.duth.gr dicknickalls@compuserve.com % %\fi % \CheckSum{21} % \iffalse This is a Metacomment % %\ProvidesFile{decimal.sty} % % [2003/07/12 v1.0 Package `decimal.sty'] % % \begin{macrocode} %<*driver> \documentclass{ltxdoc} \usepackage{decimal} \newcommand{\hidot}{\ensuremath{\raise.95ex\hbox{.}}} \GetFileInfo{decimal.drv} \begin{document} \DocInput{decimal.dtx} \end{document} % % \end{macrocode} % \fi %\StopEventually{} %\MakeShortVerb{\|} %\title{The `decimal' package} %\author{A.Syropoulos and R.W.D.Nickalls} % \date{2003/07/12} %\maketitle % \begin{abstract} % In traditional English typography the decimal point in printed as % slightly raised dot. This little package provides this functionallity % by making the period (``.'') active in math mode. In addition, we % redefine the commad |\.| so that it produces a dot in math mode, while % it retains its ordinary functionality in text mode. %\end{abstract} % % \section{Introduction} % The decimal point is variously used as a comma (European), a % full point (North American), or as a raised full point (English). % While the comma and full point have always been supported, % the English decimal point has been somewhat overlooked---until now. % % The \textsl{decimal} package places the height of the decimal % point level with the center of the `equals' sign, as shown by % $x=0.3456$, by re-implementing a math mode full point as the % |\cdot| character. However, in old texts the practice was to place % the full point rather higher, as in $25{\hidot}345$. While this is a bit % too high for visual comfort nowadays, the reason for the original high % position lies in the name used by metal type-setters for the decimal point, % namely a ``turned' full point, as mentioned in the following extract from % an $80$~year-old \textsl{Authors' \& Printers' Dictionary}.% % \footnote{Collins H (1921). Authors' \& Printers' Dictionary: a guide for % authors, editors, printers, correctors of the press, compositors, and % typists. With a full list of abbreviations. An attempt to codify the best % typographical practices of the present day. (pub: Humphrey Milford, % London).} % %\begin{center} %\begin{minipage}{0.7\textwidth} %\begin{itemize} % \item [\ ]\textbf{\hspace{-5mm}decimal fractions}, no decimal can be plural, % or take verb in pl., however many figures it contains; (typ.) % print in figures. The decimal % point in all cases to be a full point turned. %\end{itemize} %\end{minipage} %\end{center} % % But what is meant by a full point `turned'? The clue comes from an entry % in the dictionary on `turned commas', as follows. %\begin{center} %\begin{minipage}{0.7\textwidth} %\begin{itemize} % \item [\ ]\textbf{\hspace{-5mm}turned commas} (typ.), % those used at the commencement of a quotation, as these~``, two % apostrophes being at the end. %\end{itemize} %\end{minipage} %\end{center} % If we use a turned comma to show the location a full point would occupy % if `turned' in the same way, we can see that the position is somewhat % high, as in the decimal fraction $2$`$6$. Swapping the turned % comma for a similarly turned full point we obtain~$2{\hidot}6$, which % shows the decimal point in essentially the position we observe in older % texts. All is now clear---the typesetter simply turned the metal block of % the full point through $180\deg$ and, \textsl{eh presto}, he had a practical % decimal point, albeit slightly on the high side. % % \section{Usage} % % First use the \textsl{decimal} package using the |\usepackage{}| command % in the preamble. %\begin{center} % |\usepackage{decimal}| %\end{center} % The \textsl{decimal} package will now operate globally to % implement the English decimal point where one types a fullpoint in % math mode. For example the value $123.456$ is obtained by typing % |$123.456$|. The correct positioning of the decimal is preserved even % when the smaller mathmode fonts are used, as shown in the following two % examples. % $$ % 23.562^{1.23^{\,2.6}}\hspace{2cm} % j = \sqrt{ \underbrace{{ax^2 + bx +c }}_{-3.78} \ +\cos(3\pi/4 +\theta)} % $$ % % On those occasions when a true full point is % required in math mode (e.g.~at the end of a series of equations) % then this is implemented by typing |\.|. For example % $$ % y = ax^2 + bx +c\. % $$ % is obtained by typing |$y = ax^2 + bx +c\.$|. % % It is important to appreciate that there are math mode commands which % include a full point as an integral part of the command, and in these cases % one must, of course, \textsl{not} use the |\.| command. A common situation % where this arises is in the typesetting of unbalanced vertical braces, in % which case a full point is used by one of the commands to represent the % absent brace. For example, the structure % $$ % \left\{ % \begin{array}{l} % \displaystyle x = -b/6 \\ % \displaystyle y = (4ac - b^2)/7 % \end{array} % \right. % $$ % is typeset by the following code %\begin{verbatim} % $$ % \left\{ % \begin{array}{l} % \displaystyle x = -b/6 \\ % \displaystyle y = (4ac - b^2)/7 % \end{array} % \right. % $$ %\end{verbatim} % which uses the command \verb!\right.! to balance the left brace % command \verb!\left\{! before the array. Since the full point % is part of the command then there is no need to use the |\.| command. % If we now add some punctuation to the above structure, say, a % comma terminating the first line and a full point to terminate % the second line as follows, % $$ % \left\{ % \begin{array}{l} % \displaystyle x = -b/6, \\ % \displaystyle y = (4ac - b^2)/3\. % \end{array} % \right. % $$ % then we add the full point using % the command |\.| as shown in the following code. %\begin{verbatim} % $$ % \left\{ % \begin{array}{l} % \displaystyle x = -b/6, \\ % \displaystyle y = (4ac - b^2)/7\. % \end{array} % \right. % %\end{verbatim} % Outside math mode the command \verb!\.! performs its usual % function of placing a dot above a character, for example % the command \verb!\.{a}! generates the \.{a} character. % % \section{The Implementation} % % The code of the package is quite simple. Initially, we introduce a new % command which has the functionality of the |\.| command. Then we redefine % the |\.| command so that it produces a dot in math mode, while it % retains its original functionality in text mode. % \begin{macrocode} %<*decimal> \let\peri@d\. \def\.{\ifmmode\mbox{.}\else\expandafter\peri@d\fi} % \end{macrocode} % One thing we need to do is to define a new math command which will yield a % |\cdot| without any leading or trailing white space. % \begin{macrocode} \DeclareMathSymbol{\cd@t}{\mathord}{symbols}{"01} % \end{macrocode} % Now, we are ready to change the mathcode of the period so that it produces % the desired result in math mode. Note that this ``trick'' is documented % in the \TeX{}book and in the book ``Digital Typography Using \LaTeX,'' % Springer-Verlag New York, ISBN 0-387-95217-9, 2003. % \begin{macrocode} \mathcode`\.="8000 {\catcode`\.=\active% \gdef.{\cd@t} } % % \end{macrocode} % % \Finale