| 1 |
\documentclass{article} |
| 2 |
|
| 3 |
\usepackage{lmodern} |
| 4 |
\usepackage[T1]{fontenc} |
| 5 |
\usepackage[nosetpagesize]{graphicx} |
| 6 |
\usepackage{mathpunctspace} |
| 7 |
|
| 8 |
\title{Control the Space After Punctuation in Expressions} |
| 9 |
\author{Yuwsuke Kieda} |
| 10 |
\date{2018/02/27 v1.1} |
| 11 |
|
| 12 |
\begin{document} |
| 13 |
\maketitle |
| 14 |
|
| 15 |
\section{Descriptions} |
| 16 |
|
| 17 |
We provide a mechanism to control the space after the comma in the expressions. |
| 18 |
|
| 19 |
\section{Usage} |
| 20 |
|
| 21 |
\subsection{Sample of Preamble} |
| 22 |
|
| 23 |
\begin{verbatim} |
| 24 |
\usepackage{mathpunctspace} |
| 25 |
\end{verbatim} |
| 26 |
|
| 27 |
\subsection{Options} |
| 28 |
|
| 29 |
\begin{itemize} |
| 30 |
\item unit: mu or other (default: mu) |
| 31 |
\item comma: substitute keyword ``natural'' or skip (default: natural) |
| 32 |
\item semicolon: substitute keyword ``natural'' or skip (default: natural) |
| 33 |
\item colon: substitute keyword ``natural'' or skip (default: natural) |
| 34 |
\item latexorg: original behavior of LaTeX |
| 35 |
\end{itemize} |
| 36 |
|
| 37 |
Remark: keyword ``natural'' mean the spacing of the in-line. |
| 38 |
|
| 39 |
\section{License} |
| 40 |
|
| 41 |
BSD 2-Clause License |
| 42 |
|
| 43 |
\section{Repository} |
| 44 |
|
| 45 |
\texttt{https://github.com/yuw/texmf-mathpunctspace} |
| 46 |
|
| 47 |
\section{Samples} |
| 48 |
|
| 49 |
|
| 50 |
\subsection{Sources} |
| 51 |
|
| 52 |
\begin{verbatim} |
| 53 |
Lorem ipsum $(x, y)$, dolor sit amet. |
| 54 |
|
| 55 |
Lorem ipsum $\{x; x \in A\}$; dolor sit amet. |
| 56 |
|
| 57 |
Lorem ipsum $f\colon g \to h$: dolor sit amet. |
| 58 |
\end{verbatim} |
| 59 |
|
| 60 |
\subsection{Sample of Options and Results} |
| 61 |
|
| 62 |
\begin{verbatim} |
| 63 |
\usepackage[latexorg]{mathpunctspace} |
| 64 |
\end{verbatim} |
| 65 |
|
| 66 |
\includegraphics{latexorg.pdf} |
| 67 |
|
| 68 |
\begin{verbatim} |
| 69 |
\usepackage{mathpunctspace} |
| 70 |
% same: comma=natural,semicolon=natural,colon=natural |
| 71 |
\end{verbatim} |
| 72 |
|
| 73 |
Lorem ipsum $(x, y)$, dolor sit amet. |
| 74 |
|
| 75 |
Lorem ipsum $\{x; x \in A\}$; dolor sit amet. |
| 76 |
|
| 77 |
Lorem ipsum $f\colon g \to h$: dolor sit amet. |
| 78 |
|
| 79 |
\begin{verbatim} |
| 80 |
\usepackage[comma=10mu,semicolon=20mu,colon=30mu]{mathpunctspace} |
| 81 |
\end{verbatim} |
| 82 |
|
| 83 |
\includegraphics{comma10mu-semicolon20mu-colon30mu.pdf} |
| 84 |
|
| 85 |
\begin{verbatim} |
| 86 |
\usepackage[unit=pt,comma=5pt,semicolon=5pt,colon=5pt]{mathpunctspace} |
| 87 |
\end{verbatim} |
| 88 |
|
| 89 |
\includegraphics{comma5pt-semicolon5pt-colon5pt.pdf} |
| 90 |
|
| 91 |
\begin{verbatim} |
| 92 |
\usepackage[comma=0mu,semicolon=natural,colon=natural]{mathpunctspace} |
| 93 |
\end{verbatim} |
| 94 |
|
| 95 |
\includegraphics{comma0mu-semicolonnat-colonnat.pdf} |
| 96 |
|
| 97 |
\section{Risks} |
| 98 |
|
| 99 |
If the option (\texttt{comma=10mu}) is given as follows, ``right'' output can not be obtained. See \textit{The \TeX{}book} p.~134. |
| 100 |
|
| 101 |
\begin{verbatim} |
| 102 |
\usepackage[comma=10mu]{mathpunctspace} |
| 103 |
\end{verbatim} |
| 104 |
|
| 105 |
\begin{center} |
| 106 |
\makeatletter |
| 107 |
\begingroup |
| 108 |
\catcode`\,=\active |
| 109 |
\def\@x@{\def,{\thinmuskip20mu\normalcomma}}% |
| 110 |
\expandafter\endgroup\@x@% |
| 111 |
% \catcode`\,=\active |
| 112 |
% \def\@x@{\def,{\normalcomma\mskip10mu}}% |
| 113 |
% \expandafter\endgroup\@x@% |
| 114 |
\makeatother |
| 115 |
\setbox9\hbox{,}% |
| 116 |
Input: \verb!$1{,}000$!\qquad |
| 117 |
Output: $1{,}000$\quad $1,000$ |
| 118 |
\end{center} |
| 119 |
|
| 120 |
\end{document} |