Debian Codegraph @

texmf-dist/source/latex/cmll/cmll.dtx

raw
1 % \title{Linear Logic symbols for Computer Modern}
2 % \author{Emmanuel Beffara}
3 % \date{April 20, 2010}
4 %
5 % \maketitle
6 %
7 % \section{Documentation}
8 %
9 % \subsection{Installation}
10 %
11 % The installation consists in copying the |.mf| files from the |mf|
12 % subdirectory somewhere in Metafont's search path and the |.sty| and |.fd|
13 % files from the |latex| subdirectory somewhere in \LaTeX's search path.
14 %
15 % Call |TEXMF| the base directory of your installation (on Unix this should be
16 % something like |/usr/share/texmf| or |~/texmf| for a single user
17 % installation). Then copy the directories as follows:
18 % \begin{itemize}
19 % \item copy |mf| as |TEXMF/fonts/source/public/cmll|
20 % \item copy |latex| as |TEXMF/tex/latex/cmll|
21 % \end{itemize}
22 % If you want to install the fonts in Type1 format:
23 % \begin{itemize}
24 % \item copy |type1| as |TEXMF/fonts/type1/public/cmll|
25 % \item copy |tfm| as |TEXMF/fonts/tfm/public/cmll|
26 % \item copy |cmll.map| as |TEXMF/fonts/map/dvips/misc/cmll.map|
27 % \end{itemize}
28 % You may have to update \TeX's databases by running |texhash| or |mktexlsr|
29 % (this is for Kpathsea-based distributions like te\TeX) or a similar command.
30 % You may also have to register the map file for the Type1 fonts using
31 % |updmap|, depending on your installation.
32 % Linux users using Debian or Ubuntu can avoid all this by using the package
33 % at |http://iml.univ-mrs.fr/~beffara/soft/| (updated more often than TexLive).
34 %
35 % \subsection{Package loading}
36 %
37 % The package is loaded by simply saying |\usepackage{cmll}|. The variant of
38 % the font that should be used is chosen using the following package options:
39 % \begin{quote}
40 % \begin{tabular}{>{\ttfamily}ll}
41 % cm & Computer Modern serif \\
42 % ss & Computer Modern sans serif \\
43 % euler & AMS Euler \\
44 % emu & emulation mode (see section~\ref{selection}) \\
45 % auto & automatic selection among the above
46 % (default, see section~\ref{selection})
47 % \end{tabular}
48 % \end{quote}
49 %
50 % \subsection{Symbols}
51 %
52 % The \texttt{cmll} font defines a handful of symbols useful in linear logic
53 % that were not defined in other fonts and packages.
54 % \begin{symbols}{Unary operators:}
55 % \dosymbol\oc
56 % \dosymbol\wn
57 % \dosymbol\shpos
58 % \dosymbol\shneg
59 % \dosymbol\shift
60 % \end{symbols}
61 % \begin{symbols}{Binary operators:}
62 % \dosymbol\parr
63 % \dosymbol\invamp
64 % \dosymbol\with
65 % \end{symbols}
66 % \begin{symbols}{Large operators:}
67 % \dosymbol\bigparr
68 % \dosymbol\biginvamp
69 % \dosymbol\bigwith
70 % \end{symbols}
71 % \begin{symbols}{Binary relations:}
72 % \dosymbol\coh
73 % \dosymbol\scoh
74 % \dosymbol\incoh
75 % \dosymbol\sincoh
76 % \dosymbol\Perp
77 % \dosymbol\simperp
78 % \dosymbol\multimapinv
79 % \dosymbol\multimapboth
80 % \dosymbol\nmultimap
81 % \dosymbol\nmultimapinv
82 % \dosymbol\nmultimapboth
83 % \end{symbols}
84 % \begin{symbols}{Letter-like symbols:}
85 % \dosymbol\Bot
86 % \dosymbol\simbot
87 % \end{symbols}
88 % The symbols $\oc$, $\wn$ and $\with$ are actually characters from the
89 % standard Computer Modern fonts declared with a new math code to get proper
90 % spacing. See the following examples:
91 % \[\begin{tabular}{ll@{\hspace{4em}}ll}
92 % \verb/A \& B/ & $A \& B$ & \verb/A \with B/ & $A \with B$ \\
93 % \verb/A = !B/ & $A = !B$ & \verb/A = \oc B/ & $A = \oc B$ \\
94 % \verb/A = ?B/ & $A = ?B$ & \verb/A = \wn B/ & $A = \wn B$
95 % \end{tabular}\]
96 % The names |\parr| and |\invamp| are synonyms, the names |\bigparr| and
97 % |\biginvamp| too. The macros |\biginvampemu| and |\bigwithemu| provide
98 % emulations for the |\biginvamp| and |\bigwith| symbols, built using the
99 % normal symbols at different sizes (using the |relsize| package). In
100 % emulation mode (i.e. with the package option |emu|) the names |\biginvamp|
101 % and |\bigwith| are synonyms for them.
102 %
103 % \subsection{Emulation and automatic selection}
104 % \label{selection}
105 %
106 % If you use a math font family other than Computer Modern or Euler, you may
107 % have an ampersand symbol that does not match the reversed ampersand from any
108 % variant of CMLL. In this case, the |cmll| package provides a ``poor man''
109 % version of the reversed ampersand and large ampersands, built using the
110 % standard |\&| symbol.
111 % Also provided are the ``big'' variants of |\with| and |\invamp| built using
112 % the normal version at a different size (using the |relsize| package).
113 % These versions can be used explicitly under the names |\invampemu|,
114 % |\bigwithemu| and |\biginvampemu|.
115 %
116 % In the emulation mode, that is when the package is loaded with the |emu|
117 % option, these variants are used instead of the symbols provided by the
118 % font.
119 % Moreover, in emulation mode, any symbol that already exists is preserved by
120 % |cmll|, otherwise all symbols are redefined.
121 % This is useful for instance with |txfonts|, which already provides |\invamp|
122 % and |\multimapboth|.
123 % Note that this feature works only if the package |cmll| is loaded
124 % \emph{after} loading any package that might define one of the symbols
125 % provided by CMLL.
126 %
127 % The automatic selection works as follows:
128 % \begin{itemize}
129 % \item if |euler| is loaded, use the Euler variant,
130 % \item if |txfonts| or |pxfonts| is loaded, use the emulation mode,
131 % \item if the default font is |cmss|, use the |ss| variant,
132 % \item otherwise use the |cm| variant.
133 % \end{itemize}
134 %
135 % \subsection{History}
136 %
137 % \begin{description}
138 % \item [2010-04-20]
139 % New symbols: |\multimapinv|, |\nmultimap|, |\nmultimapinv|,
140 % |\nmultimapboth|.
141 % \item [2009-01-23]
142 % New symbols: |\multimapboth|, |\Perp|, |\Bot|, |\simperp|, |\simbot|.
143 % Synonyms |\invamp| and |\biginvamp| added for compatibility.
144 % New package option |emu|.
145 % Various fixes and code improvements.
146 % \item [2006-02-22]
147 % First public release.
148 % \end{description}
149 %
150 %
151 % \section{Files}
152 %
153 % \subsection{This document}
154 %
155 % \begin{macrocode}
156 %<*driver>
157 \documentclass{ltxdoc}
158 \usepackage{array,cmll}
159 \newenvironment{symbols}[1]{%
160 \par%
161 \def\dosymbol##1{\leavevmode\hbox to .5\textwidth{%
162 \kern.25\textwidth \hbox to 2em{\hss$##1$\hfil}%
163 \texttt{\string##1}\hss}\penalty10}%
164 \flushleft%
165 #1\strut\\}{\endflushleft}
166 \begin{document}
167 \DocInput{cmll.dtx}
168 \end{document}
169 %</driver>
170 % \end{macrocode}
171 %
172 % \subsection{Font definitions}
173 %
174 % The font definition file is deduced from the ones for Computer Modern. We
175 % provide an NFSS entry named \texttt{cmllr} in medium and bold extended
176 % versions.
177 %
178 % \begin{macrocode}
179 %<*ucmllr>
180 \DeclareFontShape{U}{cmllr}{m}{n}{%
181 <5><6><7><8><9>gen*cmllr%
182 <10><10.95>cmllr10%
183 <12><14.4>cmllr12%
184 <17.28->cmllr17%
185 }{}
186 \DeclareFontShape{U}{cmllr}{bx}{n}{%
187 <5><6><7><8><9>gen*cmllbx%
188 <10><10.95>cmllbx10%
189 <12->cmllbx12%
190 }{}
191 %</ucmllr>
192 % \end{macrocode}
193 %
194 % The following is a definition for the sans-serif version, named
195 % \texttt{cmllss}.
196 %
197 % \begin{macrocode}
198 %<*ucmllss>
199 \DeclareFontShape{U}{cmllss}{m}{n}{%
200 <-8>cmllss8%
201 <9>cmllss9%
202 <10>cmllss10
203 <12><14.4>cmllss12%
204 <17.28->cmllss17%
205 }{}
206 \DeclareFontShape{U}{cmllss}{bx}{n}{%
207 <->cmllssbx10}{}
208 %</ucmllss>
209 % \end{macrocode}
210 %
211 % The following is a definition for the Euler-style version, named
212 % \texttt{eull}.
213 %
214 % \begin{macrocode}
215 %<*ueull>
216 \DeclareFontShape{U}{eull}{m}{n}{%
217 <5><6><7><8><9>gen*eullr%
218 <10->eullr10}{}
219 \DeclareFontShape{U}{eull}{bx}{n}{%
220 <5><6><7><8><9>gen*eullbx%
221 <10->eullbx10}{}
222 %</ueull>
223 % \end{macrocode}
224 %
225 % \subsection{The package}
226 %
227 % \begin{macrocode}
228 %<*package>
229 \NeedsTeXFormat{LaTeX2e}
230 \ProvidesPackage{cmll}[2010/04/20 Linear Logic symbols for Computer Modern]
231 % \end{macrocode}
232 %
233 % With the package option |emu|, symbols already defined are used and
234 % |\invamp| (if undefined) is made by rotation using an ampersand. This
235 % requires the |graphicx| package.
236 %
237 % \begin{macrocode}
238 \let\cmll@ifemu=\iffalse
239 \DeclareOption{emu}{\let\cmll@ifemu=\iftrue}
240 % \end{macrocode}
241 %
242 % The font is declared as a symbol font named \texttt{llsymbols}, in normal
243 % and bold versions. We provide package options to switch between the
244 % standard, sans-serif and Euler-style variants.
245 %
246 % \begin{macrocode}
247 \def\cmll@style{auto}
248 \DeclareOption*{\edef\cmll@style{\CurrentOption}}
249 \ProcessOptions\relax
250 % \end{macrocode}
251 %
252 % The following code is used to detect which family should be used. Euler is
253 % detected if its package is loaded, emulation is activated for txfonts and
254 % pxfonts, sans-serif is detected by looking at the default font family name.
255 % \begin{macrocode}
256 \RequirePackage{ifthen}
257 \def\cmll@use@auto{%
258 \@ifpackageloaded{euler}{%
259 \def\cmll@style{euler}}{%
260 \@ifpackageloaded{txfonts}{%
261 \let\cmll@ifemu=\iftrue%
262 \def\cmll@style{cm}}{%
263 \@ifpackageloaded{pxfonts}{%
264 \let\cmll@ifemu=\iftrue%
265 \def\cmll@style{cm}}{%
266 \ifthenelse{\equal{\rmdefault}{cmss}}{%
267 \def\cmll@style{ss}}{%
268 \def\cmll@style{cm}}%
269 }}}%
270 \csname cmll@use@\cmll@style\endcsname}
271 % \end{macrocode}
272 %
273 % The following macros are used to set up the font families and symbols from
274 % other fonts.
275 % \begin{macrocode}
276 \def\cmll@use@cm{%
277 \DeclareSymbolFont{llsymbols}{U}{cmllr}{m}{n}%
278 \SetSymbolFont{llsymbols}{bold}{U}{cmllr}{bx}{n}%
279 \DeclareMathSymbol{\with}{\mathbin}{operators}{`\&}%
280 \DeclareMathSymbol{\oc}{\mathord}{operators}{`!}%
281 \DeclareMathSymbol{\wn}{\mathord}{operators}{`?}}
282 % \end{macrocode}
283 % Here is the sans-serif variant.
284 % \begin{macrocode}
285 \def\cmll@use@ss{%
286 \DeclareSymbolFont{llsymbols}{U}{cmllss}{m}{n}%
287 \SetSymbolFont{llsymbols}{bold}{U}{cmllss}{bx}{n}%
288 \DeclareMathSymbol{\with}{\mathbin}{operators}{`\&}%
289 \DeclareMathSymbol{\oc}{\mathord}{operators}{`!}%
290 \DeclareMathSymbol{\wn}{\mathord}{operators}{`?}}
291 % \end{macrocode}
292 % And here is the Euler variant.
293 % \begin{macrocode}
294 \def\cmll@use@euler{%
295 \DeclareSymbolFont{llsymbols}{U}{eull}{m}{n}%
296 \SetSymbolFont{llsymbols}{bold}{U}{eull}{bx}{n}%
297 \DeclareMathSymbol{\with}{\mathbin}{EulerFraktur}{"26}%
298 \DeclareMathSymbol{\oc}{\mathord}{EulerFraktur}{"21}%
299 \DeclareMathSymbol{\wn}{\mathord}{EulerFraktur}{"3F}}
300 % \end{macrocode}
301 % Finally we activate the proper variant.
302 % \begin{macrocode}
303 \csname cmll@use@\cmll@style\endcsname
304 % \end{macrocode}
305 %
306 % In some cases it is preferable to emulate the |\invamp| by rotating the
307 % ampersand symbol. Here is a robust definition of this rotation:
308 % \begin{macrocode}
309 \newcommand\invampemu{%
310 \mathbin{\mathchoice%
311 {\rotatebox[origin=c]{180}{$\&$}}%
312 {\rotatebox[origin=c]{180}{$\&$}}%
313 {\rotatebox[origin=c]{180}{$\scriptstyle\&$}}%
314 {\rotatebox[origin=c]{180}{$\scriptscriptstyle\&$}}%
315 }}
316 % \end{macrocode}
317 % We may also want to emulate the big versions of the ampersand. In this case
318 % we change ther text size appropriately for each style, using the |relsize|
319 % package. This version is reasonable at normal size and becomes approximative
320 % when math is composed in small or large sizes.
321 % \begin{macrocode}
322 \newcommand\bigwithemu{%
323 \mathop{\mathchoice%
324 {\vcenter{\hbox{\relsize{+4}$\&$}}}%
325 {\vcenter{\hbox{\relsize{+2}$\&$}}}%
326 {\vcenter{\hbox{\relsize{+0.5}$\&$}}}%
327 {\vcenter{\hbox{\relsize{-1}$\&$}}}%
328 }}
329 % \end{macrocode}
330 % For the large inversed ampersand, we call the |\invamp| macro, which is
331 % supposed to be defined (either as a proper character or as an emulation as
332 % above). When it is emulated, this makes two nested |\mathchoice|s, which is
333 % not very efficient.
334 % \begin{macrocode}
335 \newcommand\biginvampemu{%
336 \mathop{\mathchoice%
337 {\vcenter{\hbox{\relsize{+4}$\invamp$}}}%
338 {\vcenter{\hbox{\relsize{+2}$\invamp$}}}%
339 {\vcenter{\hbox{\relsize{+0.5}$\invamp$}}}%
340 {\vcenter{\hbox{\relsize{-1}$\invamp$}}}}}
341 % \end{macrocode}
342 %
343 % The actual commands |\invamp|, |\bigwith| and |\biginvamp| can be defined in
344 % various ways depending on the setup.
345 %
346 % \begin{macrocode}
347 \cmll@ifemu
348 \@ifundefined{invamp}{%
349 \RequirePackage{graphicx}%
350 \let\invamp=\invampemu
351 }{}%
352 \RequirePackage{relsize}%
353 \let\bigwith=\bigwithemu
354 \let\biginvamp=\biginvampemu
355 % \end{macrocode}
356 % Already existing symbols are preserved in emulation mode.
357 % \begin{macrocode}
358 \def\cmll@declare@symbol#1#2#3#4{%
359 \@ifundefined{#1}{%
360 \expandafter\DeclareMathSymbol%
361 \expandafter{\csname#1\endcsname}{#2}{#3}{#4}}{}}
362 \else
363 \def\cmll@declare@symbol#1#2#3#4{%
364 \expandafter\DeclareMathSymbol%
365 \expandafter{\csname#1\endcsname}{#2}{#3}{#4}}
366 \fi
367 % \end{macrocode}
368 %
369 % The new symbol definitions are the same for all variants.
370 % \begin{macrocode}
371 \cmll@declare@symbol{invamp}{\mathbin}{llsymbols}{0}
372 \let\parr=\invamp
373 \cmll@declare@symbol{shpos}{\mathord}{llsymbols}{1}
374 \cmll@declare@symbol{shneg}{\mathord}{llsymbols}{2}
375 \cmll@declare@symbol{shift}{\mathord}{llsymbols}{3}
376 \cmll@declare@symbol{coh}{\mathrel}{llsymbols}{4}
377 \cmll@declare@symbol{scoh}{\mathrel}{llsymbols}{5}
378 \cmll@declare@symbol{incoh}{\mathrel}{llsymbols}{6}
379 \cmll@declare@symbol{sincoh}{\mathrel}{llsymbols}{7}
380 \cmll@declare@symbol{bigwith}{\mathop}{llsymbols}{8}
381 \cmll@declare@symbol{biginvamp}{\mathop}{llsymbols}{10}
382 \let\bigparr=\biginvamp
383 \cmll@declare@symbol{multimapboth}{\mathrel}{llsymbols}{12}
384 \cmll@declare@symbol{Bot}{\mathord}{llsymbols}{13}
385 \cmll@declare@symbol{Perp}{\mathrel}{llsymbols}{13}
386 \cmll@declare@symbol{simbot}{\mathord}{llsymbols}{14}
387 \cmll@declare@symbol{simperp}{\mathrel}{llsymbols}{14}
388 \cmll@declare@symbol{multimapinv}{\mathrel}{llsymbols}{15}
389 \cmll@declare@symbol{nmultimap}{\mathrel}{llsymbols}{16}
390 \cmll@declare@symbol{nmultimapinv}{\mathrel}{llsymbols}{17}
391 \cmll@declare@symbol{nmultimapboth}{\mathrel}{llsymbols}{18}
392 %</package>
393 % \end{macrocode}
394 %
395 % \Finale