Debian Codegraph @

texmf-dist/doc/latex/freemath/freemath-doc.tex

raw
1 % \DocumentMetadata{tagging=on}
2 \documentclass[11pt]{article}
3
4 \usepackage{geometry}
5
6 \usepackage{mlmodern}
7
8 \usepackage{enumitem}
9 \setlist[itemize]{align=parleft,left=0pt..30pt}
10
11 \parindent=0pt
12 \parskip=\medskipamount
13
14 \usepackage[hidelinks]{hyperref}
15
16 \usepackage{mathtools}
17 \DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
18 \DeclarePairedDelimiter{\norm}{\lVert}{\rVert}
19
20 \usepackage{freemath}
21 \freemathon
22
23 % \usepackage{mleftright}
24 % \mleftright
25
26 \protected\def\link{\futurelet\tempa\linkA}
27 \def\linkA{\ifx[\tempa \expandafter\linkB \else \expandafter\linkC \fi}
28 \long\def\linkB[#1]#2{\href{#2}{\ttul{#1}}}
29 \long\def\linkC#1{\href{#1}{\ttul{#1}}}
30 \protected\long\def\email#1{\href{mailto:#1}{\ttul{#1}}}
31
32 \protected\long\def\ttul#1{%
33 \leavevmode
34 \setbox0=\hbox{\ttfamily #1}%
35 \lower2.25pt\rlap{\leaders\hrule height.625px\hskip\wd0}%
36 \pdfliteral{q 1 G 2 Tr 1.7 w 1 j 1 J}%
37 \rlap{\copy0}%
38 \pdfliteral{Q}%
39 \box0
40 }
41
42 \title{The \texttt{freemath} Package, version 1.1}
43 \author{plante}
44
45 \begin{document}
46
47 \maketitle
48
49 \noindent
50
51 \subsection*{Usage}
52
53 The \texttt{freemath} package allows for the omission of backslashes from most math mode commands. Specifically, any maximal consecutive string of at least two (Latin) letters appearing in math mode will automatically be replaced with the control sequence having the same name, if it is defined.
54
55 The package is loaded by \verb|\usepackage{freemath}| and provides the \verb|\freemathon| and \verb|\freemathoff| commands which respectively activate and deactivate this behaviour. It is \textbf{disabled} by default upon loading.
56
57 Regular commands initiated by a backslash may of course still be used when freemath is active, and can furthermore be freely mixed with backslash-free commands.
58
59 To prevent undesirable command formation simply insert spaces in-between letters to break the word apart (eg.\ to write the product of three variables $e$, $x$, and $p$ you can write \verb|e x p|, \verb|ex p|, or \verb|e xp|).
60
61 \medskip
62
63 \textit{Example with freemath:} \vadjust{\vskip-\medskipamount}
64 \[ \hbox{\verb|lim_{n to infty} int_Omega n log left( 1 + frac{f}{n} right) d mu|}. \]
65 \textit{Example without freemath:} \vadjust{\vskip-\medskipamount}
66 \[ \hbox{\verb|\lim_{n\to\infty} \int_\Omega n \log\left( 1 + \frac{f}{n} \right) d\mu|}. \]
67
68 \vskip-\medskipamount
69 \[ lim_{n to infty} int_Omega n log left( 1 + frac{f}{n} right) d mu. \]
70
71 \subsection*{Known Limitations}
72
73 \begin{itemize}
74
75 \item Braces are required whenever such a string of letters appears as an argument to another macro. For instance, one must write \verb|frac{omega}{phi}| instead of \verb|frac omega phi|, even though \verb|\frac\omega\phi| is acceptable in ordinary \LaTeX.
76
77 Exceptions to the rule above are superscripts, subscripts, and \verb|\left| \verb|\right|, where for instance \verb|left lVert f_mu right rVert| renders as expected ($left lVert f_mu right rVert$).
78
79 \item When used in conjunction with the \texttt{unicode-math} package, some math mode commands like \verb|\sqrt| and \verb|\vec| require mandatory braces for single-letter arguments.
80
81 % \item
82 % Braces are required around the argument to \verb|\sqrt| even when it consists of a single letter.
83 % Backslash commands must be used for \verb|\left| and \verb|\right| delimiters that are not single characters (eg.\ \verb|left \lVert|).
84
85 \end{itemize}
86
87 Changes to \LaTeX\ internals are summarised below:
88
89 \begin{itemize}
90
91 \item All letters are assigned a mathcode of \verb|"8000| (\verb|"1000000| in Lua\LaTeX).
92
93 \item The characters \verb|^| and \verb|_| have been made active (category code 13).
94
95 \item The primitives \verb|\left| and \verb|\right| have been redefined.
96
97 \item The primitive \verb|\radical| has been redefined to have a macro-style argument in the second parameter.
98
99 \item Commands which typeset their own name may result in infinite loops.
100 One class of such commands is the math operators (eg.\ \verb|\lim|, \verb|\exp|) and the package includes a fix in this case by modifying \verb|\operator@font|.
101 The workaround in general is to patch these commands to insert \verb|\freemathoff| locally.
102
103 \end{itemize}
104
105 \subsection*{License}
106
107 This package is copyright \copyright\ 2025 plante, and
108 released under the \LaTeX\ Project Public License (\textsc{lppl}) 1.3c.
109
110 \subsection*{Repository}
111
112 The upstream repository of this package may be found at
113 \[ \link{https://github.com/plante3/freemath/tree/main}. \]
114
115 \end{document}
116
117 \newpage
118
119 \begingroup
120 \everymath={\displaystyle} \openup3\jot \obeylines
121 \def\abs#1{\lvert#1\rvert}
122
123 $phi_g(x)$ $f_theta^xi(omega)$ $a^2+b^2=c^2$ $x^n+y^n=z^n$ $A_abc$ $A_alpha$ $x_ix_j$
124 $forall epsilon > 0 \, forall x in S \, exists delta > 0 \ abs{y-x} < delta implies abs{f(y)-f(x)} < epsilon$
125 $limsup_{n to infty} frac{abs{a_{n+1} - L}}{abs{a_n - L}^mu} < infty$
126 $prod_{n=2}^infty e left( 1 - frac{1}{n^2} right)^{n^2} = frac{pi}{e sqrt e}$
127 $sin 2x = 2 sin x cos x$ $displaystyle sum_{i=1}^infty sum_{j=1}^i a_{i j} < e$ $prod_i sin(2^i x)$
128 $frac{partial^2 ell(beta)}{partial beta partial beta^top} = -sum_{i=1}^N x_i x_i^top p(x_i; beta)(1 - p(x_i; beta))$
129 $left lVert vec u + vec v right rVert leq left lVert vec u right rVert + left lVert vec v right rVert $
130 $norm{ vec u + vec v } leq norm{vec u} + norm{vec v}$
131 $norm{ frac12 } norm*{ frac12 } norm[\Big]{ frac12 }$
132 $biggl{lVert} x biggr{rVert}$
133 $R_theta = begin{bmatrix} cos theta & -sin theta \\ sin theta & cos theta end{bmatrix}$
134
135 \endgroup
136
137 \end{document}
138