summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/textualicomma/textualicomma.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-12-03 22:20:29 +0000
committerKarl Berry <karl@freefriends.org>2017-12-03 22:20:29 +0000
commitb712a410446a2d7a83b3c84c4cef0dcf4a653848 (patch)
treeaac6ae32f9c0566fb8eb4fccd3477a4cf6405035 /Master/texmf-dist/source/latex/textualicomma/textualicomma.dtx
parent0a0b0de2788454509ea578118b40418158981fb1 (diff)
textualicomma (3dec17)
git-svn-id: svn://tug.org/texlive/trunk@45980 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/textualicomma/textualicomma.dtx')
-rw-r--r--Master/texmf-dist/source/latex/textualicomma/textualicomma.dtx258
1 files changed, 258 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/textualicomma/textualicomma.dtx b/Master/texmf-dist/source/latex/textualicomma/textualicomma.dtx
new file mode 100644
index 00000000000..d68700216ec
--- /dev/null
+++ b/Master/texmf-dist/source/latex/textualicomma/textualicomma.dtx
@@ -0,0 +1,258 @@
+%\iffalse
+%<*package>
+%% \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 \~}
+%</package>
+%\fi
+% \iffalse
+% Doc-Source file to use with LaTeX2e
+% Copyright (C) 2017 Sebastian Friedl
+% This work is subject to the LaTeX Project Public License, Version 1.3c or -- at your option -- any later version of this license.
+% The work consists of the files textualicomma.ins and textualicomma.dtx
+% as well as the derived file textualicomma.sty
+% \fi
+% \iffalse
+%<*driver>
+\documentclass[11pt]{ltxdoc}
+
+\usepackage{alltt}
+\usepackage{csquotes}
+\usepackage{graphicx}
+\usepackage{hologo}
+\usepackage{multicol}
+\usepackage{hyperref}
+ \hypersetup{pdftitle={The textualicomma package}, pdfauthor={Sebastian Friedl}}
+\usepackage{verbatim}
+
+\usepackage[no-math]{fontspec}
+\usepackage[erewhon,vvarbb]{newtxmath}
+\setmainfont[Numbers=OldStyle]{Source Serif Pro}[ItalicFont={Erewhon-Italic}, BoldItalicFont={Erewhon-BoldItalic}]
+\setsansfont[Numbers=OldStyle,Scale=MatchLowercase]{Source Sans Pro}
+\setmonofont[Numbers=OldStyle,Scale=MatchLowercase]{Source Code Pro}
+
+\usepackage{polyglossia}
+\setdefaultlanguage{english}
+\usepackage[english]{selnolig}
+
+
+\usepackage[left=4.50cm,right=2.75cm,top=3.25cm,bottom=2.75cm,nohead]{geometry}
+
+\parindent0pt
+
+
+
+\CodelineNumbered
+
+\begin{document}
+\DocInput{textualicomma.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \MakeShortVerb{"}
+%
+% \title{The \texttt{textualicomma} package \\ {\large\url{https://github.com/SFr682k/textualicomma}}}
+% \author{Sebastian Friedl \\ \href{mailto:sfr682k@t-online.de}{\ttfamily sfr682k@t-online.de}}
+% \date{2017/12/03}
+% \maketitle
+%
+% \begin{abstract}\noindent
+% A solution for using the textual comma character as decimal separator in math mode. \\[\medskipamount]
+% \textbf{\texttt{textualicomma} is based on the \href{https://www.ctan.org/pkg/icomma}{\texttt{icomma} package} and intended as a solution for situations where the text comma character discerns from the math comma character.} Escaping to text mode every time a comma is used in math mode may slow down the compilation process. \\
+% Please check, whether \href{https://www.ctan.org/pkg/icomma}{\texttt{icomma}} already satisfies your needs.
+% \end{abstract}
+%
+%
+% \subsection*{Obtaining the package and documentation file}
+% \begin{small}
+% You can obtain the package files by running \LaTeX\ over the file "textualicomma.ins": \\
+% " latex textualicomma.ins"
+%
+% \medskip
+% For compiling the documentation, run \textbf{\hologo{LuaLaTeX}}~(!) twice over "textualicomma.dtx": \\
+% " lualatex textualicomma.dtx" \\
+% " lualatex textualicomma.dtx" \\
+% Please verify that all dependencies are fulfilled \emph{before} compiling.
+% \end{small}
+%
+% \subsection*{License}
+% \begin{small}
+% \addcontentsline{toc}{subsection}{License}
+% \textcopyright\ 2017 Sebastian Friedl
+%
+% \smallskip
+% 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.
+%
+% \smallskip
+% 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.
+%
+% \smallskip
+% This work has the LPPL maintenance status \enquote*{maintained}. The current maintainer of this work is Sebastian Friedl. \\
+% This work consists of the files "textualicomma.dtx" and "textualicomma.ins" and the derived file "textualicomma.sty".
+% \end{small}
+%
+%
+% \subsection*{Call for cooperation}
+% \begin{small}
+% \addcontentsline{toc}{subsection}{Call for cooperation}
+% Please report bugs and other problems as well as suggestions for improvements by using the \href{https://github.com/SFr682k/textualicomma/issues}{issue tracker on GitHub} or sending an email to \href{mailto:sfr682k@t-online.de}{\texttt{sfr682k@t-online.de}}.
+% \end{small}
+%
+%
+%
+%
+% \clearpage
+% \part{The documentation}
+% \section{Introduction}
+% Using the comma as decimal separator in ordinary \LaTeX\ has always been proble\-matic, since the comma is treated as a punctuation character and \LaTeX\ adds some space after it. \\
+% The solution was defining an ‘intelligent’ comma ‘recognizing’ whether it is used as decimal separator or punctuation character.
+%
+% \medskip
+% The common solution to this problem is the \texttt{icomma} package by Walter Schmidt \cite{icomma}. \\
+% However, some fonts, e.~g. Source Serif Pro, don't provide any math support. 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 ‘$,$’ to~‘,’). The only solution solving this ‘problem’ is escaping to text mode.
+%
+% \section{The \texttt{textualicomma} package}
+% \subsection{\texttt{textualicomma}'s behaviour}
+% \texttt{textualicomma} makes some changes and additions to \texttt{icomma}'s code in order to provide automated escaping to text mode. The behaviour remains the same:
+% \begin{itemize}
+% \item The comma is treated as decimal separator if it is directly followed by a number. Thus, a number is to be entered as, for instance, \\
+% "3,142"
+% \item whereas mathematical expressions like $(x\text{,}\,y)$ are to be written with a space after the comma: \\
+% \verb*|(x, y)|
+% \end{itemize}
+%
+% Also, the period is redefined so that it adapts to the used font.
+%
+%
+% \subsection{Package options}
+% By default, the font used for typesetting the comma is the roman text font. This behaviour can be modified by using package options:
+%
+% \medskip
+% \DescribeMacro{sffamily}
+% Passing the "sffamily" option to "textualicomma" results in the comma being printed using the loaded sans serif font
+%
+% \medskip
+% \DescribeMacro{ttfamily}
+% Passing the "ttfamily" option to "textualicomma" results in the comma being printed using the loaded typewriter font
+%
+% \bigskip
+% \DescribeMacro{\textualicommafont}
+% Both options change the used font \emph{for the whole document}. Changes inside a document can be made using the "\textualicommafont" command: \\
+% "\textualicommafont{\rmfamily}" \\
+% "\textualicommafont{\sffamily}" \\
+% "\textualicommafont{\ttfamily}" \\
+%
+%
+%
+% \section{Bugs and problems}
+% Generally, since the comma is made ‘active’, problems are not unlikely.
+%
+% \medskip
+% For example, when using the ‘intelligent comma’ together with the \texttt{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 instance:
+%
+% \begin{center}
+% \verb|\begin{tabular}{... D{,}{\mathord\mathcomma}{2} ...}|
+% \end{center}
+%
+% Note that specifying the comma as the related input character works as usual.
+%
+%
+%
+% \begin{thebibliography}{1}
+% \bibitem{icomma}
+% Walter Schmidt.
+% The \texttt{icomma} package for \LaTeXe.
+% Package and Documentation available on CTAN (\href{https://www.ctan.org/pkg/icomma}{\ttfamily https://www.ctan.org/pkg/icomma})
+% \end{thebibliography}
+%
+%
+%
+% \clearpage
+% \part{The package code}
+%
+% \begin{macrocode}
+\ProvidesPackage{textualicomma}[2017/12/03 textualicomma package]
+% \end{macrocode}
+%
+% Use the roman text font family by default
+% \begin{macrocode}
+\def\mathtxtcmmaffamily{\rmfamily}
+% \end{macrocode}
+%
+% Provide an option for switching to the sans serif font
+% \begin{macrocode}
+\newif\if@mathtxtcmmasffamily
+\@mathtxtcmmasffamilyfalse
+\DeclareOption{sffamily}{\@mathtxtcmmasffamilytrue}
+% \end{macrocode}
+%
+% Provide an option for switching to the typewriter font
+% \begin{macrocode}
+\newif\if@mathtxtcmmattfamily
+\@mathtxtcmmattfamilyfalse
+\DeclareOption{ttfamily}{\@mathtxtcmmattfamilytrue}
+% \end{macrocode}
+%
+% Process all defined options
+% \begin{macrocode}
+\ProcessOptions
+% \end{macrocode}
+%
+% If one of the "sffamily" or "ttfamily" options has been used, changes are applied
+% \begin{macrocode}
+\if@mathtxtcmmasffamily\def\mathtxtcmmaffamily{\sffamily}\fi
+\if@mathtxtcmmattfamily\def\mathtxtcmmaffamily{\ttfamily}\fi
+% \end{macrocode}
+%
+% Provide an command for switching the font inside the document
+% \begin{macrocode}
+\def\textualicommafont#1{\def\mathtxtcmmaffamily{#1}}
+% \end{macrocode}
+%
+% We define the comma character at the beginning of the document.
+% \begin{macrocode}
+\AtBeginDocument{%
+ \def\mathtextcomma{\text{\mathtxtcmmaffamily,}}
+% \end{macrocode}
+%
+% I don't know what the following lines are exactly doing, but they can't be removed; probably, because they are making the comma ‘active’
+% \begin{macrocode}
+ \mathchardef\mathcomma\mathcode`\,%
+ \mathcode`\,="8000 %
+}
+{\catcode`,=\active
+ \gdef,{\futurelet\@let@token\sm@rtcomma}
+}
+% \end{macrocode}
+%
+% Define the ‘smart comma’
+% \begin{macrocode}
+\def\sm@rtcomma{%
+ \ifx\@let@token\@sptoken\mathtextcomma\protect\,\else
+ \ifx\@let@token\space \else
+ \mathtextcomma\fi\fi}
+% \end{macrocode}
+%
+% Allow changing of the period's font.
+% \begin{macrocode}
+\DeclareMathSymbol{.}{\mathalpha}{operators}{`.}
+% \end{macrocode}
+%
+% \Finale
+% That's enough code. "\endinput".
+% \begin{macrocode}
+\endinput
+% \end{macrocode} \ No newline at end of file