summaryrefslogtreecommitdiff
path: root/usergrps/uktug/baskervi/8_1/ltx-logo.tex
blob: e2dc6beefe54468b18dd61508fa0619872b79523 (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
%
% define the standard logo (since we use the new logo throughout)
\makeatletter
\DeclareRobustCommand{\stdLaTeX}{L\kern-.36em
  {%
    \sbox\z@ T%
    \vbox to\ht0{\hbox{$\m@th$%
        \csname S@\f@size\endcsname
        \fontsize\sf@size\z@
        \math@fontsfalse\selectfont
        A}%
      \vss}%
  }%
  \kern-.15em
  \TeX}
%
\DeclareRobustCommand{\faqLaTeX}{L%
  {%
    \setbox0\hbox{T}%
    \setbox\@tempboxa\hbox{$\m@th$%
      \csname S@\f@size\endcsname
      \fontsize\sf@size\z@
      \math@fontsfalse\selectfont
      A}%
    \@tempdima\ht0
    \advance\@tempdima-\ht\@tempboxa
    \@tempdima\strip@pt\fontdimen1\font\@tempdima
    \advance\@tempdima-.36em
    \kern\@tempdima
    \vbox to\ht0{\box\@tempboxa
      \vss}%
  }%
  \kern-.15em
  \TeX}
\makeatother
%
\title{Typesetting the \LaTeX{} Logo: a Saga}
\author{Robin Fairbairns}
\begin{Article}
  When I was collating the first edition of the \uktug\ \acro{FAQ},
  one of the people I asked to review it was Barbara Beeton, and one
  of her comments was that the \LaTeX{} logo looked awful,
  specifically when typeset in \emph{Baskerville Italic}.

  Barbara's observation set me on a quest for a resilient macro to
  typeset this curious object; I still haven't found any philosopher's
  stone for this task, but I have at least got a formula that enables
  one to codify some working parameters in a \LaTeX-like sort of
  way\dots.

  Sebastian Rahtz, in one of his fulminating editorials, cried `a pox
  on all these logos'.  In retrospect one could wish that Lamport
  hadn't taken us beyond Knuth's original \TeX{} logo (which seemed
  amusing at first encounter), but while one can steadfastly ignore
  most other logos, it seems difficult to ignore \LaTeX{} (whether
  you're a convinced user or a virulent hater).  I hope that the work
  I describe here will make its own small contribution to the beauty
  of descriptions, in \LaTeX{}, of \LaTeX{} itself~\dots or will, at
  least, draw them back from the abyss of hideousness that the logo
  itself seems inexorably to pull towards.

  \section{The Old \LaTeX\ coding}

  The last release of~2.09 (dating from March~1992), had:
\begin{verbatim}
\def\p@LaTeX{{\reset@font\rm L\kern-.36em%
    \raise.3ex\hbox{\sc a}\kern-.15em%
    T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
\def\LaTeX{\protect\p@LaTeX}
\end{verbatim}
  Apart from the \cs{reset@font}, this is (in essence) Lamport's
  original coding; the definition of \cs{p@LaTeX} provides the basis
  for the robust command \cs{LaTeX} (Lamport's original was fragile).

  The output the macro produces is reasonable, \emph{if} you're using
  \texttt{cmr} at a `reasonable' size: at \texttt{10pt}, we see
  {\fontfamily{cmr}\fontencoding{OT1}\selectfont L\kern-.36em\raise.3ex\hbox{\sc a}%
    \kern-.15emT\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}\@.  It's
  odd that its code includes that for (Knuth's) logo \cs{TeX} (rather
  than referring to the older macro), and it's noteworthy that neither
  it nor Knuth's code makes the spacefactor adjustment due at the end
  of the word\footnote{This observation is due to Barbara Beeton.} (in
  English typesetting, it's common practice to set the capitals in
  acronyms and logos as if they were lower-case letters).

  The problems that arise from the macro are:
  \begin{itemize}
  \setlength{\itemsep}{0pt}%
  \item that it steadfastly sets in the default font (\texttt{cmr}),
    and
  \item that its use of \cs{sc} restricts it to a smaller range of
    sizes than one might hope.
  \end{itemize}
  These restrictions make it appear odd in section titles (which are
  set in bold in \LaTeX's standard classes), and prevent (what seems
  to me) entirely reasonable use in sans fonts, etc.  However, since
  it's now history, I shan't discuss it further.

  \section{The standard \LaTeX{} coding}

  I don't any longer have the sources, but as I recall at least some
  of the pre-release versions of \LaTeXe{} had something similar to
  the \LaTeX209{} version of the logo.  This version, instead of using
  the `old' font command \cs{sc} (which selects some `fixed' font,
  rather than a font related to that which surrounds it), used the
  \LaTeX{} command \cs{scshape}.  (The same would also have been true
  of pre-\LaTeXe{} versions of the \acro{NFSS} with their subversion
  of the \LaTeX209{} font commands.)  This had the unfortunate effect
  that \LaTeX{} warned you about using \cs{LaTeX} in a section title,
  since almost no font family defines a bold-series
  Caps-and-Small-Caps font\dots.

  The appearance of the present \LaTeX{} logo was therefore a minor
  relief for navel-contemplating\footnote{`Real' users, writing about
    anything other than \LaTeX{} itself would never have noticed the
    problem!} users such as myself.  The new logo coding sets the `\acro{A}'
  of \LaTeX{} in the scriptfont size related to the current text size,
  and with its apex at the same level as the top of the `T'.  This
  logo actually looks slightly different from the one in \LaTeX209{},
  but is noticeably more stable:
\begin{verbatim}
\DeclareRobustCommand{\LaTeX}{L\kern-.36em
  {%
    \sbox\z@ T%
    \vbox to\ht0{\hbox{$\m@th$%
        \csname S@\f@size\endcsname
        \fontsize\sf@size\z@
        \math@fontsfalse\selectfont
        A}%
      \vss}%
  }%
  \kern-.15em
  \TeX}
\end{verbatim}
  As you can see, the code sets `T' into a scratch \cs{hbox} which it
  then uses as the height of a \cs{vbox} into the top of which the `\acro{A}'
  is stuck.  The size of the `\acro{A}' is selected in the curious sequence
  involving an empty maths mode (with zero \cs{mathsurround}), the
  setting-up of current maths sizes using \cs{S@}\meta{\cs{f@size}}
  (as it were), and then using the \cs{sf@size} (which is the `current
  script font size') thus defined.

  This version of the logo deals with some of the problems of the
  \LaTeX209{} version, and pushes back the boundaries of difficulty into
  new areas:
  \begin{itemize}
  \setlength{\itemsep}{0pt}%
  \item very small font sizes, where the scriptfont size doesn't
    differ much (or at all) from the textfont size,
  \item font sizes for which no \cs{DeclareMathSizes} has been issued:
    in this case, \LaTeX{} will calculate a value for the size of
    \cs{scriptstyle} which ought to be appropriate, but which could
    well not be available within the set of fonts \LaTeX{} is willing
    to employ,
  \item thoroughly peculiar uses (for example, the man who complained
    on \Newsgroup|comp.text.tex| that the \textsf{textfit} package
    produces odd effects, like:
    {{\huge\global\edef\grumble{\the\font}}\grumble\stdLaTeX},
    which fails because the font is selected outside of the
    \acro{NFSS}, and so the `\acro{A}' matches whatever size is
    \acro{NFSS}-selected\Dash in this case 10pt\footnote{That example
      was achieved by selecting \cs{huge} outside of the \acro{NFSS}:
      the original complaint was about a 1~inch high logo, at which
      size it's difficult to see that there's an `\acro{A}' there at all!}),
    and
  \item use in fonts that don't match the kerning parameters used.
  \end{itemize}
  It's the last problem that I've been attempting to address in my
  investigations of the logo.

  \begin{figure*}[tp]
    \begin{center}
      \leavevmode
      \includegraphics{logo-mbvx-m-n}
      \caption{\LaTeX{} logo samples for Baskerville medium, normal}
      \label{fig:bv-latex-sample}
    \end{center}
  \end{figure*}
  \section{My first attempt}

  This code deals with the slant of an italic character, and has been
  used in the published editions of the \acro{FAQ}.
\begin{verbatim}
\DeclareRobustCommand{\LaTeX}{L%
  {%
    \setbox0\hbox{T}%
    \setbox\@tempboxa\hbox{$\m@th$%
      \csname S@\f@size\endcsname
      \fontsize\sf@size\z@
      \math@fontsfalse\selectfont
      A}%
    \@tempdima\ht0
    \advance\@tempdima-\ht\@tempboxa
\end{verbatim}
  That sets up the amount by which the `\acro{A}' will be raised,
  in \cs{@tempdima}; the next line of code extracts the font dimension
  that gives the slant, and multiplies \cs{@tempdima} by it; this is
  simple coordinate geometry, and gives an amount by which to adjust
  the negative kern in the standard version of the logo.  We then
  calculate an actual value to use for the kern, and complete the
  fractured coding of the standard logo.
\begin{verbatim}
    \@tempdima
    \strip@pt\fontdimen1\font\@tempdima
    \advance\@tempdima-.36em
    \kern\@tempdima
    \vbox to\ht0{\box\@tempboxa
      \vss}%
  }%
  \kern-.15em
  \TeX}
\end{verbatim}
  This code improves the appearance of inclined copies of the
  logo\Dash inclined copies are absolutely dire if you're using
  Baskerville fonts (as we do in \BV): compare \emph{\stdLaTeX} (the
  standard logo) with \emph{\faqLaTeX} (the above code).

  \section{But the standard code doesn't even work with
    \acro{CM}-family fonts!}

  Section titles in \tub{} are set in \texttt{cmssbx}\footnote{\tub{}
    `sections' are collections of related papers within one issue;
    sections within a \tub{} paper are like sections within any
    \LaTeX{} document.}: the fragility of the logo is demonstrated by
  the fact that the standard code fails with this font:
  {\fontfamily{cmss}\fontencoding{OT1}\bfseries\selectfont\stdLaTeX}.  When the first
  `\LaTeX{} macros' section turned up since I joined the \tub{}
  production team, Barbara Beeton asked me to `sort it out'.  Since
  this problem is occurring for an upright font, the trick I developed
  for use in \BV{} doesn't help.

  I could have taken a hint from the documentation that's included in
  the \LaTeX{} distribution, which defines a different logo for each
  font family one might use to print it; however, I didn't notice
  this, and developed a version that can in principle behave
  differently for every value of font family, series and shape.

  The \cs{LaTeX} command itself is simple: it simply chooses a set of
  pre-defined parameters (or, in default of that, selects the
  parameters used in the standard logo), and then relays to a patched
  version of the standard logo:
\begin{verbatim}
\DeclareRobustCommand\LaTeX{%
 \expandafter\let\expandafter\@tempa
 \csname @LaTeX@\f@family/\f@series/%
   \f@shape\endcsname
 \ifx\@tempa\relax\let\@tempa\@LaTeX@default\fi
 \expandafter\@LaTeX\@tempa}
\end{verbatim}
  The patched version of the standard logo is equally trivial:
\begin{verbatim}
\newcommand\@LaTeX[2]{L\kern-#1em
  {%
    \sbox\z@ T%
    \vbox to\ht0{\hbox{$\m@th$%
        \csname S@\f@size\endcsname
        \fontsize\sf@size\z@
        \math@fontsfalse\selectfont
        A}%
      \vss}%
    }%
  \kern-#2em%
  \TeX}
\end{verbatim}
  The parameters are defined by the command
\begin{verbatim}
\newcommand\DeclareLaTeXLogo[5]{%
  \expandafter\def
  \csname @LaTeX@#1/#2/#3\endcsname
   {{#4}{#5}}}
\end{verbatim}
  whose parameters are font family, series and shape, and then the two
  extra parameters to be used by \cs{@LaTeX}.  The default setting is
  simply:
\begin{verbatim}
\def\@LaTeX@default{{.36}{.15}}
\end{verbatim}
  My \textsf{ltugboat} class defines three sets of \acro{CM}-family
  parameters:
\begin{verbatim}
\DeclareLaTeXLogo{cmss}{bx}{n}{.3}{.15}
\DeclareLaTeXLogo{cmr}{m}{it}{.3}{.27}
\DeclareLaTeXLogo{cmr}{bx}{it}{.3}{.27}
\end{verbatim}
  the first of which deals with the problem that Barbara Beeton had
  highlighted.

  Finding sets of parameters to use isn't entirely trivial; I generate
  a set of logos with different parameters for the font family, series
  and shape under consideration, examine them, adjust the set of
  parameters and iterate until I have something that looks
  satisfactory.  The last sample in this exercise for Baskerville
  medium, normal, is shown in figure~\ref{fig:bv-latex-sample}.

  \section{Conclusion: future work}

  The macros I describe above are available on \acro{CTAN} in
  directory \url{macros/latex/contrib/supported/ltx-logo} (together
  with the source of this note, by way of justification).  The
  \texttt{ltx-logo} package takes font family names as package
  options: for each option quoted, the package will define any logo
  parameter sets it knows for that family: at the time of writing, the
  package knows about the \texttt{cm} family (using the parameters
  shown above for \url{cmss/bx/n}, \url{cmr/m/it} and \url{cmr/bx/it})
  and the Monotype Baskerville families \texttt{mbv} and \texttt{mbvx}
  (the latter includes use of the so-called `expert' fonts: for the
  purposes of the \LaTeX{} logo, the required parameters are the same
  as for the non-expert set).

  I remarked above that the \LaTeX{} team had defined special-purpose
  \LaTeX{} logos for a number of font families, in the macros used for
  the documentation distributed with \LaTeX.  Their approach (which
  was developed independently of mine) isn't as general as mine, but I
  was interested to note that they also redefine the \TeX{} logo: I
  hadn't bothered with that, on the grounds that it seemed `mostly
  \acro{OK}' in texts I had set.  I suppose it offers an avenue for
  still further enthralling developments in my study of \TeX-based
  logos.

  The macros on \acro{CTAN} include the test code I used to evaluate
  parameters for the fonts.  People who feel moved to work out sets
  for their own favourite font family are encouraged to submit them to
  me for inclusion in the distribution\dots.
\end{Article}