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