Debian Codegraph @

texmf-dist/source/latex/textualicomma/textualicomma-doc.dtx

raw
1 %\iffalse
2 %% Doc-Source file to use with LaTeX2e
3 %% Copyright (C) 2017-18 Sebastian Friedl
4 %%
5 %% This work is subject to the LaTeX Project Public License, Version 1.3c or -- at
6 %% your option -- any later version of this license.
7 %% The work consists of the files textualicomma.dtx, textualicomma.ins,
8 %% textualicomma-doc.dtx and the derived file textualicomma.sty
9 %%
10 %% This work has the LPPL maintenance status ‘maintained’.
11 %% Current maintainer of the work is Sebastian Friedl.
12 %%
13 %% -------------------------------------------------------------------------------------------
14 %%
15 %% Use the textual comma character as decimal separator in math mode
16 %%
17 %% -------------------------------------------------------------------------------------------
18 %%
19 %% Please report bugs and other problems as well as suggestions for improvements
20 %% to my email address ([email protected]).
21 %%
22 %% -------------------------------------------------------------------------------------------
23 %\fi
24
25 % !TeX spellcheck=en_US
26
27 \documentclass[11pt]{ltxdoc}
28
29 \usepackage{iftex}
30 \RequireLuaTeX
31
32 \usepackage[no-math]{fontspec}
33 \usepackage{polyglossia}
34 \setdefaultlanguage{english}
35 \usepackage[english]{selnolig}
36
37
38
39 \usepackage{csquotes}
40 \usepackage{graphicx}
41 \usepackage{hologo}
42 \usepackage{multicol}
43
44 \usepackage{verbatim}
45
46
47 \usepackage[a4paper,left=4.50cm,right=2.75cm,top=3.25cm,bottom=2.75cm,nohead]{geometry}
48
49
50 \usepackage[unicode, pdfborder={0 0 0}, linktoc=all, hyperindex=false]{hyperref}
51
52
53 \usepackage[erewhon,vvarbb]{newtxmath}
54 \setmainfont{Source Serif Pro}
55 \setsansfont[Scale=MatchLowercase]{Source Sans Pro}
56 \setmonofont[Scale=MatchLowercase]{Hack}
57
58
59
60 \newcommand*{\cls}[1]{\textsf{#1}}
61 \newcommand*{\sty}[1]{\textsf{#1}}
62 \newcommand*{\opt}[1]{\texttt{#1}\index{#1=\texttt{#1}~~option|main}}
63
64 \def\DescribeOption#1{\marginpar{\raggedleft\PrintDescribeMacro{#1}}}
65
66 \renewcommand*{\usage}[1]{\hyperpage{#1}}
67 \renewcommand*{\main}[1]{\hyperpage{#1}}
68
69 \PageIndex
70 \RecordChanges
71
72 \parindent0pt
73
74 \MakeShortVerb{"}
75 \CheckSum{101}
76
77
78 \title{The \sty{textualicomma} package \\ {\large\url{https://gitlab.com/SFr682k/textualicomma}}}
79 \author{Sebastian Friedl \\ \href{mailto:[email protected]}{\ttfamily [email protected]}}
80 \date{2018/08/23 (v1.1)}
81
82 \hypersetup{pdftitle={The textualicomma package}, pdfauthor={Sebastian Friedl}}
83
84
85 \begin{document}
86 \maketitle
87
88 \begin{abstract}\noindent
89 Use the textual comma character as decimal separator in math mode. \\[\medskipamount]
90 \sty{textualicomma} is based on the \href{https://www.ctan.org/pkg/icomma}{\sty{icomma} package}
91 and intended as a solution for cases where the comma character used in horizontal (i.e.~text) mode
92 discerns from the one used in math mode. \\
93 Note: Escaping to text mode every time a comma is used in math mode might slow down the compilation of huge documents.
94 Please check, whether \href{https://www.ctan.org/pkg/icomma}{\sty{icomma}} already satisfies your needs.
95 \end{abstract}
96
97
98 \tableofcontents
99
100
101
102 \clearpage
103 \subsection*{Dependencies and other requirements}
104 \addcontentsline{toc}{subsection}{Dependencies and other requirements}
105 \sty{textualicomma} requires \LaTeXe\ and depends on the \sty{amstext} package. \\
106 Also, the three NFSS commands "\rmfamily", "\sffamily" and "\ttfamily" have to be defined
107 (which holds true for every common document class).
108
109
110
111 \subsection*{Installation}
112 \addcontentsline{toc}{subsection}{Installation}
113 Extract the \textit{package} file first:
114 \begin{enumerate}
115 \item Run \LaTeX\ over the file "textualicomma.ins"
116 \item Move the resulting ".sty" file to "TEXMF/tex/latex/textualicomma/"
117 \end{enumerate}
118
119 Then, you can compile the \textit{documentation} yourself by executing \\[\smallskipamount]
120 "lualatex textualicomma-doc.dtx" \\
121 "makeindex -s gind.ist textualicomma-doc.idx" \\
122 "makeindex -s gglo.ist -o textualicomma-doc.gls textualicomma-doc.glo" \\
123 "lualatex textualicomma-doc.dtx" \\
124 "lualatex textualicomma-doc.dtx"
125
126 \smallskip
127 or just use the precompiled documentation shipped with the source files. \\
128 In both cases, copy the files "textualicomma-doc.pdf" and "README.md" to \\
129 "TEXMF/doc/latex/textualicomma/"
130
131
132
133 \subsection*{License}
134 \addcontentsline{toc}{subsection}{License}
135 \begin{small}
136 \textcopyright\ 2017-18 Sebastian Friedl
137
138 \smallskip
139 This work may be distributed and/or modified under the conditions of the \LaTeX\ Project Public License, either version 1.3c of this license or (at your option) any later version.
140
141 \smallskip
142 The latest version of this license is available at \url{http://www.latex-project.org/lppl.txt} and version 1.3c or later is part of all distributions of \LaTeX\ version 2008-05-04 or later.
143
144 \smallskip
145 This work has the LPPL maintenace status \enquote*{maintained}. \\
146 Current maintainer of this work is Sebastian Friedl.
147
148 \medskip
149 This work consists of the following files:
150 \begin{itemize} \itemsep 0pt
151 \item "textualicomma.sty",
152 \item "textualicomma.ins",
153 \item "textualicomma-doc.dtx" and
154 \item the derived file "textualicomma.sty"
155 \end{itemize}
156 \end{small}
157
158
159
160
161
162
163
164 \clearpage
165 \part{The documentation}
166 \section{Introduction}
167 Using the comma as decimal separator in ordinary \LaTeX\ has always been proble\-matic: since the comma is treated as punctuation,\TeX\ adds some space after it. \\
168 The solution was defining an \enquote*{intelligent} comma recognizing whether it's used as decimal separator or punctuation character.
169
170 \medskip
171 The common package implementing this solution is \sty{icomma} by Walter Schmidt~\cite{icomma}.
172 However, some fonts, e.g. Source Serif Pro, don't provide any math support. \\
173 Although there are fonts looking very similar to Source Serif and providing math support (like Utopia and its ‘clones’ Fourier and Erewhon), more or less obvious differences are visible (compare \enquote*{$,$} to~\enquote*{,} at high magnifications). The only solution solving this \enquote*{problem} is escaping to text mode.
174
175
176
177 \section{The \sty{textualicomma} package}
178 \subsection{\sty{textualicomma}'s behaviour}
179 \sty{textualicomma} makes some changes and additions to \sty{icomma}'s code in order to provide automated escaping to text mode.
180 The behaviour remains the same:
181 \begin{itemize}
182 \item
183 The comma is treated as decimal separator if it is directly followed by a number.
184 Thus, a number is to be entered as, for instance, \\
185 "3,142"
186 \item
187 whereas mathematical expressions like $(x\text{,}\,y)$ are to be written with a space after the comma: \\
188 \verb*|(x, y)|
189 \end{itemize}
190
191 Also, the period is redefined so that it adapts to the used font.
192 This feature might be useful with \LaTeX\ \cls{beamer}'s sans-serif math.
193
194
195 \subsection{Package options}
196 By default, the font used for typesetting the comma is the current roman text font. This behavior can be modified by using package options:
197
198 \medskip\leavevmode%
199 \DescribeOption{sffamily}%
200 Passing the \opt{sffamily} option to \sty{textualicomma} results in the comma character being taken from the current sans serif text font
201
202 \medskip\leavevmode%
203 \DescribeOption{ttfamily}%
204 Passing the \opt{ttfamily} option to \sty{textualicomma} results in the comma character being taken from the current mono-spaced text font
205
206
207 \bigskip
208 \DescribeMacro{\textualicommafont}
209 Both options change the used font family \textit{for the whole document}.
210 Changes \emph{inside} the document can be made using the "\textualicommafont" command: \\[\smallskipamount]
211 "\textualicommafont{\rmfamily}" \qquad\rightarrow~~ roman comma in math mode \\
212 "\textualicommafont{\sffamily}" \qquad\rightarrow~~ sans-serif comma in math mode \\
213 "\textualicommafont{\ttfamily}" \qquad\rightarrow~~ monospaced comma in math mode
214
215
216
217 \section{Bugs and problems}
218 Generally, since the comma is made ‘active’, problems are not unlikely.
219
220 \medskip
221 For example, when using the ‘intelligent comma’ together with the \sty{dcolumn} package, a comma to be \textit{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 example:
222 \begin{center}
223 \verb|\begin{tabular}{... D{,}{\mathord\mathcomma}{2} ...}|
224 \end{center}
225
226 Note that specifying the comma as the related input character works as usual.
227
228
229
230 \phantomsection
231 \addcontentsline{toc}{section}{References}
232 \begin{thebibliography}{1}
233 \bibitem{icomma}
234 Walter Schmidt.
235 The \sty{icomma} package for \LaTeXe.
236 Package and Documentation available on CTAN (\url{https://www.ctan.org/pkg/icomma})
237 \end{thebibliography}
238
239
240
241
242
243 % Start determining the checksum from here
244 \StopEventually{%
245 \clearpage
246 \PrintChanges
247 \setcounter{IndexColumns}{2}
248 \phantomsection
249 \addcontentsline{toc}{part}{Index}%
250 \IndexPrologue{\section*{Index}}
251 \PrintIndex}
252
253 \clearpage
254 \part{The package code}
255 \CodelineNumbered
256 \DocInput{textualicomma.dtx}
257
258
259 \Finale
260 \end{document}