%% \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-2011 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
% asyropoulos@yahoo.com dick@nickalls.org
%
%\fi
% \CheckSum{21}
% \iffalse This is a Metacomment
%
%\ProvidesFile{decimal.sty}
%
% [2011/06/03 v1.1 Package `decimal.sty']
%
% \begin{macrocode}
%<*driver>
\documentclass{ltxdoc}
\usepackage{ifpdf}
\newcommand{\journal}[1]{\textit{#1}}
\newcommand{\book}[1]{\textit{#1}}
\newcommand{\vol}[1]{\underline{#1}}
\newcommand{\etal}{\textit{et al.}}
\newcommand{\syntax}[1]{\noindent\texttt{#1}}
\newcommand{\command}[1]{$\langle$\texttt{#1}$\rangle$}
\pagestyle{myheadings}
\markright{A Syropoulos \& RWD Nickalls\hspace{2cm}\journal{The decimal package}}
\ifpdf
\usepackage[verbose]{microtype}
\usepackage[a4,pdftex]{crop}
\pdfinfo{/Title (The `decimal' package: (version 1.1))
/Subject (typesetting tex macro package)
/Author (A Syropoulos and RWD Nickalls, 2011)
/Keywords (typesetting, tex, latex, mathematics, macros, mathematics)
}
\usepackage[unicode]{hyperref}
\hypersetup{debug=true,pdftoolbar=true, pdfmenubar=true, plainpages=false,
breaklinks=true, linktocpage=true, bookmarksopen=true, bookmarksopenlevel=2,
bookmarksnumbered=true, bookmarkstype=toc, pdfwindowui=true,
hyperindex, hyperfigures=true, hyperfootnotes,
colorlinks, urlcolor=blue, linkcolor=blue,
pdfstartview=FitH, pdfview=FitH, pdfcenterwindow=true,
pdfnewwindow=true, pdfpagelayout=SinglePage,
pdfpagelabels=true, pdftitle={The `decimal' package: (version 1.1)},
pdfauthor={A Syropoulos and RWD Nickalls 2011},
pdfsubject={typesetting tex macro package},
pdfkeywords={typesetting, tex},
}
\else
\fi
\usepackage{decimal}
\newcommand{\hidot}{\ensuremath{\raise.95ex\hbox{.}}}
\newcommand{\dntop}{\ifpdf\pdfbookmark[1]{Title}{Title}\fi \vspace*{1mm}}
\GetFileInfo{decimal.drv}
\begin{document}
\DocInput{decimal.dtx}
\end{document}
%
% \end{macrocode}
% \fi
%\StopEventually{}
%\MakeShortVerb{\|}
%\title{\dntop The `decimal' package\\(\textit{version}~$1.1$)}
%\author{A.\ Syropoulos\,\footnote{Greek \TeX\ Friends, Xanthi, Greece. email:\,\textsf{apostolo@yahoo.com}}
% \ and R.\ W.\ D.\ Nickalls\,\footnote{(retired), c/o Department of Anaesthesia, Nottingham University Hospitals, City Hospital Campus, Nottingham, UK. \
%email:\,\textsf{dick@nickalls.org} \ \
%web:\,\texttt{www.nickalls.org} }}
%\date{June 1, 2011}
%\maketitle
%\begin{abstract}
% \noindent In traditional English typography the decimal point is printed as a raised dot.
% The \textit{decimal} package provides this functionality by making the full point, or period (\,.\,)
% active in maths mode, and implementing the \verb!\cdot! character instead. In addition, the command
% |\.| is redefined in such a way that that it produces a full point in math mode, but
% retains its usual functionality in text mode.
%\end{abstract}
%
%\section{Introduction}
%
% The decimal point (decimal separator) is variously implemented 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 in electronic typesetting,
% the English raised decimal point has been somewhat overlooked---until now.
% For a nice history of the decimal fraction see the chapter on \book{The invention of decimal
% fractions and of logarithms} in Scott\footnote{Scott JF (1960). \book{A history of mathematics}
% (Taylor \& Francis, London), pp 266.} (1960).
%
%\section{Typography}
%
% In Great Britain until about 1970 or so the decimal separator was typically implemented as a
% raised dot (middle dot). For example, when currency decimalisation was introduced in the UK
% in 1971, the recommended way of writing currency was with a raised dot, as in $\pounds\,21.34$.
% However, since then there has been a gradual decline in the use of the raised point most probably
% owing to the fact that this glyph was not generally available on electronic typewriters or computer
% wordprocessors. While the raised dot does make occasional appearances in British newspapers, it is,
% unfortunately, seldom seen nowadays even in British scientific journals.
%
% This decline was highlighted relatively recently when the UK journal Nature reprinted some
% 1953 articles as part of the $50^{th}$ anniversary of the discovery of the double helix.
% For example, one of the reprinted articles (\textit{Nature} 2003; \underline{421}, 400--401)
% states that Franklin and Gosling\footnote{RWD Nickalls says that he was drawn to this particular
% series of articles since he spent a year as a student of Ray Gosling in the then Physics Department
% at Guy's Hospital Medical School, London, in the 1960s.} mentioned the ``\ldots very strong
% reflexion at $3.4$\,A \ldots''. Ironically, if this sentence were published in a journal in
% Britain today the {\AA}ngstr\"{o}m symbol would probably be typeset correctly but
% the decimal point would most likely appear in the American `full point' style as {3.4\,\AA}.
%
% The most pleasing position of the raised decimal point is level with
% the center of the `equals' sign, as shown by the expression $x=0.3456$,
% and this is what the \textit{decimal} package implements.
% 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 the `turned commas' entry
% in the same dictionary, 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}
%
%\noindent 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---by simply turning the metal block of the full point through $180\deg$ the typesetter
% had access to a practical decimal point, albeit slightly on the high side.
%
%\section{Usage}
%
% First load the \textsl{decimal} package ({\em after} the \texttt{mathpazo} and \texttt{hyperref}
% packages---see Bugs section) using the preamble command
% \begin{verbatim}
% \usepackage{decimal}
% \end{verbatim}
% The \textsl{decimal} package will now operate globally to
% implement the English decimal point wherever 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\.$|
%
% \textbf{Note:} It is important to appreciate that there are mathmode
% 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 (|\right.|) 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 |\right.| to balance the left brace
% command |\left\{| before the array. Since the full point
% is part of the command 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.\newpage
% \begin{verbatim}
% \[
% \left\{
% \begin{array}{l}
% \displaystyle x = -b/6, \\
% \displaystyle y = (4ac - b^2)/7\.
% \end{array}
% \right.
% \]
%\end{verbatim}
%
% Outside mathmode the command |\.| performs its usual
% function of placing a dot above a character, for example
% the command |\.{a}| generates the \.{a} character.
%
%\section{Installing the decimal package}
%
% The \textsc{decimal} package is included in the {\TeX}Live distribution, and is likely
% to be already installed if you have a fairly complete recent {\TeX}Live installation.
% The \textsc{decimal} package consists of the following files
%\begin{verbatim}
%decimal.ins
%decimal.dtx
%decimal.pdf (this file)
%decimal.sty
%\end{verbatim}
%
%\subsection*{Placing the files}
%\begin{itemize}
%
%\item \texttt{decimal.sty}
% {\TeX}Live typically places \texttt{decimal.sty} in the following directory
% \newline |/usr/local/texlive/2010/texmf-dist/tex/latex/decimal/decimal.sty|
% Alternatively, one could place it in the user's \texttt{/texmf-local/} directory, for example,
% something like \newline |/usr/local/texlive/texmf-local/tex/latex/local/decimal/decimal.sty|
% which has the merit of not being overwritten by {\TeX}Live.
%
% \item \texttt{decimal.pdf}
%
% {\TeX}Live typically places \texttt{decimal.pdf} in the \texttt{/doc/} directory, for example
% \newline |/usr/local/texlive/2010/texmf-dist/doc/latex/decimal/|
% {\newline}Using this directory has the great advantage that the \texttt{texdoc} utility
% will then display the pdf when you type the command \command{texdoc decimal}.
%
%\end{itemize}
%Once the files have been placed, then update the \TeX\ file database. On a Linux system this is
%done by running the \command{texhash} command (as root).
%
%\section{Known bugs}
%
%\subsection*{Problems with the \texttt{mathpazo} and \texttt{hyperref} packages}
% We know of only two package-interaction problems as follows.
% The \texttt{mathspazo} package effectively neutralises a previously loaded \texttt{decimal} package.
% If the \texttt{decimal} package is loaded before the \texttt{hyperref} package, then
% \LaTeX\ fails, throwing out multiple maths-related error messages
%
% The work-around is simply to install the decimal package \textit{after} these two packages.
%
%\section{Version history}
% \begin{itemize}
% \item May 2, 2005 --- version $1.1$
% \item July 12, 2003 --- first release (version $1.0$)
% \end{itemize}
%
% \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