summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/mathpunctspace/doc/mathpunctspace.tex
blob: 73a3ac22b4c7a49ec1fdd5601a33975c2ffbc776 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
\documentclass{article}

\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[nosetpagesize]{graphicx}
\usepackage{mathpunctspace}

\title{Control the Space After Punctuation in Expressions}
\author{Yuwsuke Kieda}
\date{2018/02/27 v1.1}

\begin{document}
\maketitle

\section{Descriptions}

We provide a mechanism to control the space after the comma in the expressions.

\section{Usage}

\subsection{Sample of Preamble}

\begin{verbatim}
\usepackage{mathpunctspace}
\end{verbatim}

\subsection{Options}

\begin{itemize}
 \item unit: mu or other (default: mu)
 \item comma: substitute keyword ``natural'' or skip (default: natural)
 \item semicolon: substitute keyword ``natural'' or skip (default: natural)
 \item colon: substitute keyword ``natural'' or skip (default: natural)
 \item latexorg: original behavior of LaTeX
\end{itemize}

Remark: keyword ``natural'' mean the spacing of the in-line.

\section{License}

BSD 2-Clause License

\section{Repository}

\texttt{https://github.com/yuw/texmf-mathpunctspace}

\section{Samples}


\subsection{Sources}

\begin{verbatim}
Lorem ipsum $(x, y)$, dolor sit amet.

Lorem ipsum $\{x; x \in A\}$; dolor sit amet.

Lorem ipsum $f\colon g \to h$: dolor sit amet.
\end{verbatim}

\subsection{Sample of Options and Results}

\begin{verbatim}
\usepackage[latexorg]{mathpunctspace}
\end{verbatim}

\includegraphics{latexorg.pdf}

\begin{verbatim}
\usepackage{mathpunctspace}
% same: comma=natural,semicolon=natural,colon=natural
\end{verbatim}

Lorem ipsum $(x, y)$, dolor sit amet.

Lorem ipsum $\{x; x \in A\}$; dolor sit amet.

Lorem ipsum $f\colon g \to h$: dolor sit amet.

\begin{verbatim}
\usepackage[comma=10mu,semicolon=20mu,colon=30mu]{mathpunctspace}
\end{verbatim}

\includegraphics{comma10mu-semicolon20mu-colon30mu.pdf}

\begin{verbatim}
\usepackage[unit=pt,comma=5pt,semicolon=5pt,colon=5pt]{mathpunctspace}
\end{verbatim}

\includegraphics{comma5pt-semicolon5pt-colon5pt.pdf}

\begin{verbatim}
\usepackage[comma=0mu,semicolon=natural,colon=natural]{mathpunctspace}
\end{verbatim}

\includegraphics{comma0mu-semicolonnat-colonnat.pdf}

\section{Risks}

If the option (\texttt{comma=10mu}) is given as follows, ``right'' output can not be obtained. See \textit{The \TeX{}book} p.~134.

\begin{verbatim}
\usepackage[comma=10mu]{mathpunctspace}
\end{verbatim}

\begin{center}
 \makeatletter
 \begingroup
 \catcode`\,=\active
 \def\@x@{\def,{\thinmuskip20mu\normalcomma}}%
 \expandafter\endgroup\@x@%
% \catcode`\,=\active
% \def\@x@{\def,{\normalcomma\mskip10mu}}%
% \expandafter\endgroup\@x@%
 \makeatother
 \setbox9\hbox{,}%
 Input: \verb!$1{,}000$!\qquad
 Output: $1{,}000$\quad $1,000$
\end{center}

\end{document}