| 1 |
%% \CharacterTable |
| 2 |
%% {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 |
| 3 |
%% 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 |
| 4 |
%% Digits \0\1\2\3\4\5\6\7\8\9 |
| 5 |
%% Exclamation \! Double quote \" Hash (number) \# |
| 6 |
%% Dollar \$ Percent \% Ampersand \& |
| 7 |
%% Acute accent \' Left paren \( Right paren \) |
| 8 |
%% Asterisk \* Plus \+ Comma \, |
| 9 |
%% Minus \- Point \. Solidus \/ |
| 10 |
%% Colon \: Semicolon \; Less than \< |
| 11 |
%% Equals \= Greater than \> Question mark \? |
| 12 |
%% Commercial at \@ Left bracket \[ Backslash \\ |
| 13 |
%% Right bracket \] Circumflex \^ Underscore \_ |
| 14 |
%% Grave accent \` Left brace \{ Vertical bar \| |
| 15 |
%% Right brace \} Tilde \~} |
| 16 |
%\iffalse |
| 17 |
% |
| 18 |
% (c) copyright 2003-2011 A Syropoulos & RWD Nickalls |
| 19 |
% This program can be redistributed and/or modified under the terms |
| 20 |
% of the LaTeX Project Public License Distributed from CTAN |
| 21 |
% archives in directory macros/latex/base/lppl.txt; either |
| 22 |
% version 1 of the License, or any later version. |
| 23 |
% |
| 24 |
% However, the above copyright notice does not apply in the case of |
| 25 |
% ``Crete University Press'' as this publisher is not allowed to |
| 26 |
% use or alter this file in any way. |
| 27 |
% |
| 28 |
% Please report errors or suggestions for improvement to |
| 29 |
% |
| 30 |
% Apostolos Syropoulos and/or Dick Nickalls |
| 31 |
% [email protected] [email protected] |
| 32 |
% |
| 33 |
%\fi |
| 34 |
% \CheckSum{21} |
| 35 |
% \iffalse This is a Metacomment |
| 36 |
% |
| 37 |
%<decimal, >\ProvidesFile{decimal.sty} |
| 38 |
% |
| 39 |
%<decimal, > [2011/06/03 v1.1 Package `decimal.sty'] |
| 40 |
% |
| 41 |
% \begin{macrocode} |
| 42 |
%<*driver> |
| 43 |
\documentclass{ltxdoc} |
| 44 |
\usepackage{ifpdf} |
| 45 |
\newcommand{\journal}[1]{\textit{#1}} |
| 46 |
\newcommand{\book}[1]{\textit{#1}} |
| 47 |
\newcommand{\vol}[1]{\underline{#1}} |
| 48 |
\newcommand{\etal}{\textit{et al.}} |
| 49 |
\newcommand{\syntax}[1]{\noindent\texttt{#1}} |
| 50 |
\newcommand{\command}[1]{$\langle$\texttt{#1}$\rangle$} |
| 51 |
\pagestyle{myheadings} |
| 52 |
\markright{A Syropoulos \& RWD Nickalls\hspace{2cm}\journal{The decimal package}} |
| 53 |
\ifpdf |
| 54 |
\usepackage[verbose]{microtype} |
| 55 |
\usepackage[a4,pdftex]{crop} |
| 56 |
\pdfinfo{/Title (The `decimal' package: (version 1.1)) |
| 57 |
/Subject (typesetting tex macro package) |
| 58 |
/Author (A Syropoulos and RWD Nickalls, 2011) |
| 59 |
/Keywords (typesetting, tex, latex, mathematics, macros, mathematics) |
| 60 |
} |
| 61 |
\usepackage[unicode]{hyperref} |
| 62 |
\hypersetup{debug=true,pdftoolbar=true, pdfmenubar=true, plainpages=false, |
| 63 |
breaklinks=true, linktocpage=true, bookmarksopen=true, bookmarksopenlevel=2, |
| 64 |
bookmarksnumbered=true, bookmarkstype=toc, pdfwindowui=true, |
| 65 |
hyperindex, hyperfigures=true, hyperfootnotes, |
| 66 |
colorlinks, urlcolor=blue, linkcolor=blue, |
| 67 |
pdfstartview=FitH, pdfview=FitH, pdfcenterwindow=true, |
| 68 |
pdfnewwindow=true, pdfpagelayout=SinglePage, |
| 69 |
pdfpagelabels=true, pdftitle={The `decimal' package: (version 1.1)}, |
| 70 |
pdfauthor={A Syropoulos and RWD Nickalls 2011}, |
| 71 |
pdfsubject={typesetting tex macro package}, |
| 72 |
pdfkeywords={typesetting, tex}, |
| 73 |
} |
| 74 |
\else |
| 75 |
\fi |
| 76 |
\usepackage{decimal} |
| 77 |
\newcommand{\hidot}{\ensuremath{\raise.95ex\hbox{.}}} |
| 78 |
\newcommand{\dntop}{\ifpdf\pdfbookmark[1]{Title}{Title}\fi \vspace*{1mm}} |
| 79 |
\GetFileInfo{decimal.drv} |
| 80 |
\begin{document} |
| 81 |
\DocInput{decimal.dtx} |
| 82 |
\end{document} |
| 83 |
%</driver> |
| 84 |
% \end{macrocode} |
| 85 |
% \fi |
| 86 |
%\StopEventually{} |
| 87 |
%\MakeShortVerb{\|} |
| 88 |
%\title{\dntop The `decimal' package\\(\textit{version}~$1.1$)} |
| 89 |
%\author{A.\ Syropoulos\,\footnote{Greek \TeX\ Friends, Xanthi, Greece. email:\,\textsf{[email protected]}} |
| 90 |
% \ and R.\ W.\ D.\ Nickalls\,\footnote{(retired), c/o Department of Anaesthesia, Nottingham University Hospitals, City Hospital Campus, Nottingham, UK. \ |
| 91 |
%email:\,\textsf{[email protected]} \ \ |
| 92 |
%web:\,\texttt{www.nickalls.org} }} |
| 93 |
%\date{June 1, 2011} |
| 94 |
%\maketitle |
| 95 |
%\begin{abstract} |
| 96 |
% \noindent In traditional English typography the decimal point is printed as a raised dot. |
| 97 |
% The \textit{decimal} package provides this functionality by making the full point, or period (\,.\,) |
| 98 |
% active in maths mode, and implementing the \verb!\cdot! character instead. In addition, the command |
| 99 |
% |\.| is redefined in such a way that that it produces a full point in math mode, but |
| 100 |
% retains its usual functionality in text mode. |
| 101 |
%\end{abstract} |
| 102 |
% |
| 103 |
%\section{Introduction} |
| 104 |
% |
| 105 |
% The decimal point (decimal separator) is variously implemented as a comma (European), a |
| 106 |
% full point (North American), or as a raised full point (English). |
| 107 |
% While the comma and full point have always been supported in electronic typesetting, |
| 108 |
% the English raised decimal point has been somewhat overlooked---until now. |
| 109 |
% For a nice history of the decimal fraction see the chapter on \book{The invention of decimal |
| 110 |
% fractions and of logarithms} in Scott\footnote{Scott JF (1960). \book{A history of mathematics} |
| 111 |
% (Taylor \& Francis, London), pp 266.} (1960). |
| 112 |
% |
| 113 |
%\section{Typography} |
| 114 |
% |
| 115 |
% In Great Britain until about 1970 or so the decimal separator was typically implemented as a |
| 116 |
% raised dot (middle dot). For example, when currency decimalisation was introduced in the UK |
| 117 |
% in 1971, the recommended way of writing currency was with a raised dot, as in $\pounds\,21.34$. |
| 118 |
% However, since then there has been a gradual decline in the use of the raised point most probably |
| 119 |
% owing to the fact that this glyph was not generally available on electronic typewriters or computer |
| 120 |
% wordprocessors. While the raised dot does make occasional appearances in British newspapers, it is, |
| 121 |
% unfortunately, seldom seen nowadays even in British scientific journals. |
| 122 |
% |
| 123 |
% This decline was highlighted relatively recently when the UK journal Nature reprinted some |
| 124 |
% 1953 articles as part of the $50^{th}$ anniversary of the discovery of the double helix. |
| 125 |
% For example, one of the reprinted articles (\textit{Nature} 2003; \underline{421}, 400--401) |
| 126 |
% states that Franklin and Gosling\footnote{RWD Nickalls says that he was drawn to this particular |
| 127 |
% series of articles since he spent a year as a student of Ray Gosling in the then Physics Department |
| 128 |
% at Guy's Hospital Medical School, London, in the 1960s.} mentioned the ``\ldots very strong |
| 129 |
% reflexion at $3.4$\,A \ldots''. Ironically, if this sentence were published in a journal in |
| 130 |
% Britain today the {\AA}ngstr\"{o}m symbol would probably be typeset correctly but |
| 131 |
% the decimal point would most likely appear in the American `full point' style as {3.4\,\AA}. |
| 132 |
% |
| 133 |
% The most pleasing position of the raised decimal point is level with |
| 134 |
% the center of the `equals' sign, as shown by the expression $x=0.3456$, |
| 135 |
% and this is what the \textit{decimal} package implements. |
| 136 |
% However, in old texts the practice was to place |
| 137 |
% the full point rather higher, as in $25{\hidot}345$. |
| 138 |
% While this is a bit too high for visual comfort nowadays, |
| 139 |
% the reason for the original high position lies in the name used by |
| 140 |
% metal type-setters for the decimal point, namely |
| 141 |
% a `turned' full point, as mentioned in the following extract from an $80$~year-old |
| 142 |
% \textsl{Authors' \& Printers' Dictionary}.\footnote{Collins H (1921). Authors' \& |
| 143 |
% Printers' Dictionary: a guide for authors, editors, printers, correctors of the press, |
| 144 |
% compositors, and typists. With a full list of abbreviations. An attempt to codify the best |
| 145 |
%typographical practices of the present day. (pub: Humphrey Milford, London).} |
| 146 |
% |
| 147 |
%\begin{center} |
| 148 |
%\begin{minipage}{0.7\textwidth} |
| 149 |
%\begin{itemize} |
| 150 |
%\item [\ ]\textbf{\hspace{-5mm}decimal fractions}, no decimal can be plural, |
| 151 |
%or take verb in pl., however many figures it contains; (typ.) print in figures. The decimal |
| 152 |
%point in all cases to be a full point turned. |
| 153 |
%\end{itemize} |
| 154 |
%\end{minipage} |
| 155 |
%\end{center} |
| 156 |
% |
| 157 |
%But what is meant by a full point `turned'? The clue comes from the `turned commas' entry |
| 158 |
% in the same dictionary, as follows. |
| 159 |
%\begin{center} |
| 160 |
%\begin{minipage}{0.7\textwidth} |
| 161 |
%\begin{itemize} |
| 162 |
%\item [\ ]\textbf{\hspace{-5mm}turned commas} (typ.), |
| 163 |
%those used at the commencement of a quotation, as these~``, two |
| 164 |
%apostrophes being at the end. |
| 165 |
%\end{itemize} |
| 166 |
%\end{minipage} |
| 167 |
%\end{center} |
| 168 |
% |
| 169 |
%\noindent If we use a turned comma to show the location a full |
| 170 |
% point would occupy if `turned' in the same way, we can see |
| 171 |
% that the position is somewhat high, as in the decimal fraction $2$`$6$. Swapping the turned |
| 172 |
% comma for a similarly turned full point we |
| 173 |
% obtain~$2{\hidot}6$, which shows the decimal point in essentially the position we observe in older texts. |
| 174 |
% All is now clear---by simply turning the metal block of the full point through $180\deg$ the typesetter |
| 175 |
% had access to a practical decimal point, albeit slightly on the high side. |
| 176 |
% |
| 177 |
%\section{Usage} |
| 178 |
% |
| 179 |
% First load the \textsl{decimal} package ({\em after} the \texttt{mathpazo} and \texttt{hyperref} |
| 180 |
% packages---see Bugs section) using the preamble command |
| 181 |
% \begin{verbatim} |
| 182 |
% \usepackage{decimal} |
| 183 |
% \end{verbatim} |
| 184 |
% The \textsl{decimal} package will now operate globally to |
| 185 |
% implement the English decimal point wherever one types a fullpoint in math mode. |
| 186 |
% For example the value $123.456$ is obtained by typing |
| 187 |
% |$123.456$|. |
| 188 |
% The correct positioning of the decimal is preserved even |
| 189 |
% when the smaller mathmode fonts are used, as shown in the |
| 190 |
% following two examples. |
| 191 |
% \[ |
| 192 |
% 23.562^{1.23^{\,2.6}}\hspace{2cm} |
| 193 |
% j = \sqrt{ \underbrace{{ax^2 + bx +c }}_{-3.78} \ +\cos(3\pi/4 +\theta)} |
| 194 |
% \] |
| 195 |
% |
| 196 |
% On those occasions when a true full point is |
| 197 |
% required in math mode (e.g.~at the end of a series of equations) |
| 198 |
% then this is implemented by typing |\.| |
| 199 |
% For example |
| 200 |
% \[ |
| 201 |
% y = ax^2 + bx +c\. |
| 202 |
% \] |
| 203 |
% is obtained by typing |$y = ax^2 + bx +c\.$| |
| 204 |
% |
| 205 |
% \textbf{Note:} It is important to appreciate that there are mathmode |
| 206 |
% commands which include a full point as an integral |
| 207 |
% part of the command, and in |
| 208 |
% these cases one must, of course, \textsl{not} use the |\.| command. |
| 209 |
% A common situation where this arises is in the |
| 210 |
% typesetting of unbalanced vertical braces, in which case |
| 211 |
% a full point is used by one of the commands (|\right.|) to represent the absent brace. |
| 212 |
% For example, the structure |
| 213 |
% \[ |
| 214 |
% \left\{ |
| 215 |
% \begin{array}{l} |
| 216 |
% \displaystyle x = -b/6 \\ |
| 217 |
% \displaystyle y = (4ac - b^2)/7 |
| 218 |
% \end{array} |
| 219 |
% \right. |
| 220 |
% \] |
| 221 |
% is typeset by the following code |
| 222 |
% \begin{verbatim} |
| 223 |
% \[ |
| 224 |
% \left\{ |
| 225 |
% \begin{array}{l} |
| 226 |
% \displaystyle x = -b/6 \\ |
| 227 |
% \displaystyle y = (4ac - b^2)/7 |
| 228 |
% \end{array} |
| 229 |
% \right. |
| 230 |
% \] |
| 231 |
% \end{verbatim} |
| 232 |
% which uses the command |\right.| to balance the left brace |
| 233 |
% command |\left\{| before the array. Since the full point |
| 234 |
% is part of the command there is no need to use the |\.| command. |
| 235 |
% |
| 236 |
% If we now add some punctuation to the above structure, say, a |
| 237 |
% comma terminating the first line and a full point to terminate |
| 238 |
% the second line as follows, |
| 239 |
% \[ |
| 240 |
% \left\{ |
| 241 |
% \begin{array}{l} |
| 242 |
% \displaystyle x = -b/6, \\ |
| 243 |
% \displaystyle y = (4ac - b^2)/3\. |
| 244 |
% \end{array} |
| 245 |
% \right. |
| 246 |
% \] |
| 247 |
% then we add the full point using |
| 248 |
% the command |\.| as shown in the following code.\newpage |
| 249 |
% \begin{verbatim} |
| 250 |
% \[ |
| 251 |
% \left\{ |
| 252 |
% \begin{array}{l} |
| 253 |
% \displaystyle x = -b/6, \\ |
| 254 |
% \displaystyle y = (4ac - b^2)/7\. |
| 255 |
% \end{array} |
| 256 |
% \right. |
| 257 |
% \] |
| 258 |
%\end{verbatim} |
| 259 |
% |
| 260 |
% Outside mathmode the command |\.| performs its usual |
| 261 |
% function of placing a dot above a character, for example |
| 262 |
% the command |\.{a}| generates the \.{a} character. |
| 263 |
% |
| 264 |
%\section{Installing the decimal package} |
| 265 |
% |
| 266 |
% The \textsc{decimal} package is included in the {\TeX}Live distribution, and is likely |
| 267 |
% to be already installed if you have a fairly complete recent {\TeX}Live installation. |
| 268 |
% The \textsc{decimal} package consists of the following files |
| 269 |
%\begin{verbatim} |
| 270 |
%decimal.ins |
| 271 |
%decimal.dtx |
| 272 |
%decimal.pdf (this file) |
| 273 |
%decimal.sty |
| 274 |
%\end{verbatim} |
| 275 |
% |
| 276 |
%\subsection*{Placing the files} |
| 277 |
%\begin{itemize} |
| 278 |
% |
| 279 |
%\item \texttt{decimal.sty} |
| 280 |
% {\TeX}Live typically places \texttt{decimal.sty} in the following directory |
| 281 |
% \newline |/usr/local/texlive/2010/texmf-dist/tex/latex/decimal/decimal.sty| |
| 282 |
% Alternatively, one could place it in the user's \texttt{/texmf-local/} directory, for example, |
| 283 |
% something like \newline |/usr/local/texlive/texmf-local/tex/latex/local/decimal/decimal.sty| |
| 284 |
% which has the merit of not being overwritten by {\TeX}Live. |
| 285 |
% |
| 286 |
% \item \texttt{decimal.pdf} |
| 287 |
% |
| 288 |
% {\TeX}Live typically places \texttt{decimal.pdf} in the \texttt{/doc/} directory, for example |
| 289 |
% \newline |/usr/local/texlive/2010/texmf-dist/doc/latex/decimal/| |
| 290 |
% {\newline}Using this directory has the great advantage that the \texttt{texdoc} utility |
| 291 |
% will then display the pdf when you type the command \command{texdoc decimal}. |
| 292 |
% |
| 293 |
%\end{itemize} |
| 294 |
%Once the files have been placed, then update the \TeX\ file database. On a Linux system this is |
| 295 |
%done by running the \command{texhash} command (as root). |
| 296 |
% |
| 297 |
%\section{Known bugs} |
| 298 |
% |
| 299 |
%\subsection*{Problems with the \texttt{mathpazo} and \texttt{hyperref} packages} |
| 300 |
% We know of only two package-interaction problems as follows. |
| 301 |
% The \texttt{mathspazo} package effectively neutralises a previously loaded \texttt{decimal} package. |
| 302 |
% If the \texttt{decimal} package is loaded before the \texttt{hyperref} package, then |
| 303 |
% \LaTeX\ fails, throwing out multiple maths-related error messages |
| 304 |
% |
| 305 |
% The work-around is simply to install the decimal package \textit{after} these two packages. |
| 306 |
% |
| 307 |
%\section{Version history} |
| 308 |
% \begin{itemize} |
| 309 |
% \item May 2, 2005 --- version $1.1$ |
| 310 |
% \item July 12, 2003 --- first release (version $1.0$) |
| 311 |
% \end{itemize} |
| 312 |
% |
| 313 |
% \section{The Implementation} |
| 314 |
% |
| 315 |
% The code of the package is quite simple. Initially, we introduce a new |
| 316 |
% command which has the functionality of the |\.| command. Then we redefine |
| 317 |
% the |\.| command so that it produces a dot in math mode, while it |
| 318 |
% retains its original functionality in text mode. |
| 319 |
% \begin{macrocode} |
| 320 |
%<*decimal> |
| 321 |
\let\peri@d\. |
| 322 |
\def\.{\ifmmode\mbox{.}\else\expandafter\peri@d\fi} |
| 323 |
% \end{macrocode} |
| 324 |
% One thing we need to do is to define a new math command which will yield a |
| 325 |
% |\cdot| without any leading or trailing white space. |
| 326 |
% \begin{macrocode} |
| 327 |
\DeclareMathSymbol{\cd@t}{\mathord}{symbols}{"01} |
| 328 |
% \end{macrocode} |
| 329 |
% Now, we are ready to change the mathcode of the period so that it produces |
| 330 |
% the desired result in math mode. Note that this ``trick'' is documented |
| 331 |
% in the \TeX{}book and in the book ``Digital Typography Using \LaTeX,'' |
| 332 |
% Springer-Verlag New York, ISBN 0-387-95217-9, 2003. |
| 333 |
% \begin{macrocode} |
| 334 |
\mathcode`\.="8000 |
| 335 |
{\catcode`\.=\active% |
| 336 |
\gdef.{\cd@t} } |
| 337 |
%</decimal> |
| 338 |
% \end{macrocode} |
| 339 |
% |
| 340 |
% \Finale |