Debian Codegraph @

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

raw
1 % \iffalse meta comment
2 % File: slantsc.dtx Copyright (C) 2003, 2012 Harald Harders
3 % \fi
4 %
5 % \iffalse
6 %
7 %<*driver>
8 \documentclass{ltxdoc}
9 \usepackage[T1]{fontenc}
10 \IfFileExists{slantsc.sty}{\usepackage{slantsc}
11 \let\slantscSTYfound\active}{\GenericWarning{slantsc.dtx}{Package
12 file slantsc.sty not found (Documentation will be messed up!^^J^^A
13 Generate slantsc.sty by (La)TeXing slantsc.ins, process
14 slantsc.dtx again)^^J}\stop}
15 \usepackage{longtable}
16 \GetFileInfo{slantsc.sty}
17 \title{The \texttt{slantsc} package}
18 \author{Harald Harders\\\texttt{[email protected]}}
19 \date{Version \fileversion, \filedate, printed \today}
20 \newlength{\tempdima}%
21 \makeatletter
22 \renewenvironment{table}[1][]{%
23 \@float{table}[#1]%
24 \centering%
25 \setlength{\tempdima}{\abovecaptionskip}%
26 \setlength{\abovecaptionskip}{\belowcaptionskip}%
27 \setlength{\belowcaptionskip}{\tempdima}%
28 }{%
29 \end@float
30 }
31 \makeatother
32 \EnableCrossrefs
33 \CodelineIndex
34 \DoNotIndex{\def,\edef,\let,\newcommand,\newenvironment,\newcounter}
35 \DoNotIndex{\setcounter,\space,\if,\else,\fi,\empty,\@empty,\ifx,\fi}
36 \DoNotIndex{\ifnum,\fi,\expandafter,\DeclareRobustCommand,\ProvidesPackage}
37 \DoNotIndex{\NeedsTeXFormat,\newif,\not@math@alphabet,\fontshape,\relax}
38 \DoNotIndex{\selectfont}
39 \CodelineNumbered
40 \RecordChanges
41 \CheckSum{146}
42 \begin{document}
43 \DocInput{slantsc.dtx}
44 \end{document}
45 %</driver>
46 % \fi
47 %
48 % \changes{2.11}{2012/01/01}{Update e-mail address}%
49 % \changes{2.10}{2003/11/09}{State date and version explicitely in
50 % \cs{ProvidesPackage}}%
51 %
52 % \maketitle
53 % \begin{abstract}
54 % \noindent
55 % This package enables the use of small capitals in different font
56 % shapes, e.g., slanted or bold slanted for all fonts that provide
57 % appropriate font shapes.
58 % The only prerequisite is that the corresponding |fd| file has to
59 % define the font shapes |scsl| resp.\ |scit| for slanted resp.\
60 % italic small capitals.
61 % \end{abstract}
62 %
63 % \tableofcontents
64 %
65 % \section*{Copyright}
66 % Copyright 2003, 2012 Harald Harders.
67 %
68 % This program can be redistributed and/or modified under the terms
69 % of the LaTeX Project Public License Distributed from \textsc{ctan}
70 % archives in directory macros/latex/base/lppl.txt; either
71 % version 1 of the License, or any later version.
72 %
73 %
74 % \section{The user interface}
75 %
76 % To use this package place
77 % \begin{verbatim}
78 % \usepackage{slantsc}
79 % \end{verbatim}
80 % in the preamble of your document. No options are necessary.
81 %
82 % In \LaTeX, you can combine different font parameters like a bold
83 % series with an italic shape,
84 % \begin{verbatim}
85 % {\bfseries\itshape bold italic text}
86 % \end{verbatim}
87 % to get {\bfseries\itshape bold italic text}.
88 % But you are not able to combine two font shapes.
89 %
90 % Since \emph{italic, slanted,} and \emph{small caps} are shapes, you
91 % are not able write in {\slshape\scshape slanted small capitals}, for
92 % instance.
93 % This problem is avoided by the package |smallcap|, available from the
94 % \textsc{ctan} network, which redefines small caps to be a font
95 % family rather than a shape.
96 % But what to do if your font provides small capitals in roman style
97 % and in sans serifs?
98 % You are not able to access the sans serif version, then.
99 %
100 % The |slantsc| package has a different approach.
101 % It preserves small caps to be a font shape, but it enables to
102 % combine the small caps shape with the other shapes (upright, italic,
103 % slanted).
104 % \DescribeMacro{\upshape}%
105 % \DescribeMacro{\itshape}%
106 % \DescribeMacro{\slshape}%
107 % \DescribeMacro{\scshape}%
108 % Thus, you use the normal font shape switching commands
109 % \cs{upshape}, \cs{itshape}, \cs{slshape}, and \cs{scshape}.
110 % The first three commands act as usual among themselves.
111 % But if you use the \cs{scshape} command, it just adds the
112 % information "`small capitals"' to the current font shape.
113 %
114 % For example, if the current font shape is italic and you use
115 % \cs{scshape}, the following text is written in italic small
116 % capitals:
117 % \begin{verbatim}
118 %\itshape This is italic text, \scshape now additionally in Small Capitals.
119 % \end{verbatim}
120 % This leads to:
121 % \begin{quote}
122 % \itshape This is italic text, \scshape now additionally in Small
123 % Capitals.
124 % \end{quote}
125 % If you are in a small-capitals area, using one of the other font
126 % switching commands does not affect the small capitals status, but
127 % the rest of the font shape:
128 % \begin{verbatim}
129 %\itshape\scshape This is italic Small Capitals text, \upshape now Upright.
130 % \end{verbatim}
131 % This leads to:
132 % \begin{quote}
133 % \itshape\scshape This is italic Small Capitals text, \upshape now
134 % Upright.
135 % \end{quote}
136 %
137 % As usual, the change of font shape is terminated by the end of the
138 % group, e.g., by using braces:
139 % \begin{verbatim}
140 %\itshape This is italic {\scshape with Small Capitals} and without.
141 % \end{verbatim}
142 % This leads to:
143 % \begin{quote}
144 % \itshape This is italic {\scshape with Small Capitals} and without.
145 % \end{quote}
146 % Sometimes, you may want to switch off small capitals without using a
147 % group.
148 % \DescribeMacro{\noscshape}%
149 % To be able to do so, this package provides the \cs{noscshape}
150 % command, which works as follows:
151 % \begin{verbatim}
152 %\itshape This is italic \scshape with Small Capitals \noscshape and without.
153 % \end{verbatim}
154 % This leads to:
155 % \begin{quote}
156 % \itshape This is italic \scshape with Small Capitals \noscshape and without.
157 % \end{quote}
158 %
159 % \DescribeMacro{\textup}%
160 % \DescribeMacro{\textit}%
161 % \DescribeMacro{\textsl}%
162 % \DescribeMacro{\textsc}%
163 % \DescribeMacro{\emph}%
164 % Instead of the font switching commands you may also use the
165 % \cs{text}\ldots commands \cs{textup}, \cs{textit}, \cs{textsl},
166 % \cs{textsc} as well as the \cs{emph} command, e.g.
167 % \begin{verbatim}
168 %This is \emph{the person \textsc{Harald Harders} who wrote} this
169 %documentation.
170 % \end{verbatim}
171 % which leads to:
172 % \begin{quote}
173 % This is \emph{the person \textsc{Harald Harders} who wrote} this
174 % documentation.
175 % \end{quote}
176 %
177 % \DescribeMacro{\shapedefault}%
178 % \changes{2.00}{2003/09/17}{Describe \cs{shapedefault} command}%
179 % If you want another default font than the default, you may redefine
180 % the \cs{shapedefault} command.
181 % If you, for instance, want to use an italic small caps font as
182 % default font, you may simply use
183 % \begin{verbatim}
184 % \renewcommand\shapedefault{\scdefault\itdefault}
185 % \end{verbatim}
186 % or
187 % \begin{verbatim}
188 % \renewcommand\shapedefault{\scitdefault}
189 % \end{verbatim}
190 % in the preamble of your document.
191 % Both variants are equivalent.
192 % Notice, that you have to use the command \cs{scdefault} before the
193 % other command for combined font shapes.
194 % If you want an upright small caps font as default, just use:
195 % \begin{verbatim}
196 % \renewcommand\shapedefault{\scdefault}
197 % \end{verbatim}
198 % You may not use \cs{scdefault}\cs{updefault} as argument!
199 % To switch to the default font, you may use the \cs{defaultfont}
200 % command.
201 %
202 % \DescribeMacro{\fontshape}%
203 % \changes{2.00}{2003/09/17}{Describe \cs{fontshape} command}%
204 % If you want to set the font shape directly, using the \cs{fontshape}
205 % command, e.g.:
206 % \begin{verbatim}
207 % \fontshape{\scdefault\itdefault}\selectfont
208 % \end{verbatim}
209 % The argument of this command is used in the same way as for the
210 % \cs{shapedefault} command.
211 %
212 %
213 % \section{Using other fonts than European Modern}
214 %
215 % This package works with all fonts that provide slanted and italic
216 % versions of the small capitals.\footnote{If bold versions are also
217 % available, they are of course also supported.}
218 % It is important that these font shapes are declared in a specific
219 % way that |slantsc| can find them.
220 %
221 % |slantsc| uses two additional font shapes |scsl| and |scit|
222 % which are slanted small caps and italic small caps,
223 % respectively.\footnote{In this section, I assume that you haven't
224 % redefined the default values for the different shapes. If you have
225 % done so, you have do adobt all strings according to your changes.}
226 % These font shapes have to be declared in the corresponding file with
227 % the file name \meta{encoding}\meta{font family}|.fd|, e.g.,
228 % |t1lmr.fd| for the Latin Modern fonts.
229 % For instance, the Latin Modern font family (version 0.86) provides
230 % slanted small capitals.
231 % The corresponding entry in the |fd| file looks like this:
232 % \begin{verbatim}
233 %\DeclareFontShape{T1}{lmr}{m}{scsl}%
234 % {<-> cork-lmcsco10}{}
235 % \end{verbatim}
236 % This command declares to use the font |cork-lmcsco10| for the
237 % encoding |T1|, the font family |lmr|, the font series |m| (normal)
238 % and the font shape |scsl| (slanted small caps).
239 %
240 % Unfortunately, Latin Modern does not contain the bold variant of the
241 % slanted small caps.
242 % But if it had it, the entry would look like that:
243 % \begin{verbatim}
244 %\DeclareFontShape{T1}{lmr}{bx}{scsl}%
245 % {<-> ...}{}
246 % \end{verbatim}
247 %
248 % Since nearly no font family will contain real italic small caps
249 % variants, the best approach is to substitute them by slanted
250 % variants.
251 % This could be done for Latin Modern by the following commands:
252 % \begin{verbatim}
253 %\DeclareFontShape{T1}{lmr}{m}{scit}{<->ssub * lmr/m/scsl}{}
254 %\DeclareFontShape{T1}{lmr}{bx}{scit}{<->ssub * lmr/bx/scsl}{}
255 % \end{verbatim}
256 %
257 % With the OT1 encoded Computer Modern fonts, slanted small capitals
258 % are not available, since these fonts do not contain them.
259 % Nevertheless, the font encoding is not forced to T1 by this package
260 % because it works with all encodings, if the font shapes are
261 % present.
262 %
263 % \StopEventually{\PrintChanges \PrintIndex}
264 %
265 %
266 % \section{The implementation}
267 % \iffalse
268 %<*package>
269 % \fi
270 % Heading of the package:
271 % \begin{macrocode}
272 \NeedsTeXFormat{LaTeX2e}
273 \ProvidesPackage{slantsc}
274 [2012/01/01 v2.11 Provide Slanted an Italic Small Caps]
275 % \end{macrocode}
276 % More robust string comparisons.
277 % \begin{macrocode}
278 \RequirePackage{ifthen}
279 % \end{macrocode}
280 % Declare additional font shapes for European Computer Modern.
281 % I think, this should normally go to |t1cmr.fd|, but it is never
282 % read, since it is hardcoded to the format file.
283 % \begin{macrocode}
284 \DeclareFontFamily{T1}{cmr}{}
285 \DeclareFontShape{T1}{cmr}{m}{scsl}%
286 {<5><6><7><8><9><10><10.95><12><14.4>%
287 <17.28><20.74><24.88><29.86><35.83>genb*ecsc}{}
288 \DeclareFontShape{T1}{cmr}{bx}{scsl}%
289 {<5><6><7><8><9><10><10.95><12><14.4>%
290 <17.28><20.74><24.88><29.86><35.83>genb*ecoc}{}
291 % \end{macrocode}
292 % Since European Computer Modern does not have real italic Small Caps
293 % substitute them silently by slanted ones.
294 % \begin{macrocode}
295 \DeclareFontShape{T1}{cmr}{m}{scit}{<->ssub * cmr/m/scsl}{}
296 \DeclareFontShape{T1}{cmr}{bx}{scit}{<->ssub * cmr/bx/scsl}{}
297 % \end{macrocode}
298 % \begin{macro}{\scitdefault}
299 % \changes{2.00}{2003/09/17}{Use commands for combined shapes}%
300 % Default shortcut for italic small caps.
301 % \begin{macrocode}
302 \providecommand*\scitdefault{\scdefault\itdefault}
303 % \end{macrocode}
304 % \end{macro}
305 % \begin{macro}{\scsldefault}
306 % \changes{2.00}{2003/09/17}{Use commands for combined shapes}%
307 % Default shortcut for slanted small caps.
308 % \begin{macrocode}
309 \providecommand*\scsldefault{\scdefault\sldefault}
310 % \end{macrocode}
311 % \end{macro}
312 % \begin{macro}{\upshape}
313 % \changes{2.00}{2003/09/17}{Avoid using booleans because that causes
314 % problems with explicit use of \cs{fontshape}}%
315 % Redefine the macro \cs{upshape} that switches to an upright font.
316 % If small caps are ``on'', switch to ordinary small caps, otherwise
317 % switch to the normal upright font.
318 % \begin{macrocode}
319 \DeclareRobustCommand\upshape{%
320 \not@math@alphabet\upshape\relax
321 % \end{macrocode}
322 % Font shape is with small caps.
323 % \begin{macrocode}
324 \ifthenelse{\equal{\f@shape}{\scdefault}\or
325 \equal{\f@shape}{\scitdefault}\or\equal{\f@shape}{\scsldefault}}{%
326 \fontshape\scdefault
327 }{%
328 % \end{macrocode}
329 % Current font shape is without small caps or not known.
330 % \begin{macrocode}
331 \fontshape\updefault
332 }%
333 \selectfont
334 }
335 % \end{macrocode}
336 % \end{macro}
337 % \begin{macro}{\slshape}
338 % \changes{2.00}{2003/09/17}{Avoid using booleans because that causes
339 % problems with explicit use of \cs{fontshape}}%
340 % Redefine the macro \cs{slshape} that switches to a slanted font.
341 % If small caps are ``on'', switch to slanted small caps, otherwise
342 % switch to the normal slanted font.
343 % \begin{macrocode}
344 \DeclareRobustCommand\slshape{%
345 \not@math@alphabet\slshape\relax
346 % \end{macrocode}
347 % Font shape is with small caps.
348 % \begin{macrocode}
349 \ifthenelse{\equal{\f@shape}{\scdefault}\or
350 \equal{\f@shape}{\scitdefault}\or\equal{\f@shape}{\scsldefault}}{%
351 \fontshape\scsldefault
352 }{%
353 % \end{macrocode}
354 % Current font shape is without small caps or not known.
355 % \begin{macrocode}
356 \fontshape\sldefault
357 }%
358 \selectfont
359 }
360 % \end{macrocode}
361 % \end{macro}
362 % \begin{macro}{\itshape}
363 % \changes{2.00}{2003/09/17}{Avoid using booleans because that causes
364 % problems with explicit use of \cs{fontshape}}%
365 % Redefine the macro \cs{itshape} that switches to an italic font.
366 % If small caps are ``on'', switch to italic small caps, otherwise
367 % switch to the normal italic font.
368 % \begin{macrocode}
369 \DeclareRobustCommand\itshape{%
370 \not@math@alphabet\itshape\relax
371 % \end{macrocode}
372 % Font shape is with small caps.
373 % \begin{macrocode}
374 \ifthenelse{\equal{\f@shape}{\scdefault}\or
375 \equal{\f@shape}{\scitdefault}\or\equal{\f@shape}{\scsldefault}}{%
376 \fontshape\scitdefault
377 }{%
378 % \end{macrocode}
379 % Current font shape is without small caps or not known.
380 % \begin{macrocode}
381 \fontshape\itdefault
382 }%
383 \selectfont
384 }
385 % \end{macrocode}
386 % \end{macro}
387 % \begin{macro}{\scshape}
388 % \changes{2.00}{2003/09/17}{Avoid using booleans because that causes
389 % problems with explicit use of \cs{fontshape}}%
390 % Redefine the macro \cs{scshape} that switches to small capitals.
391 % If the actual font is italic, switch to italic small caps, if it is
392 % slanted, switch to slanted small caps, otherwise switch to ordinary
393 % small caps.
394 % \begin{macrocode}
395 \DeclareRobustCommand\scshape{%
396 \not@math@alphabet\scshape\relax
397 % \end{macrocode}
398 % Font shape is with small caps.
399 % Nothing to do.
400 % \begin{macrocode}
401 \ifthenelse{\equal{\f@shape}{\scdefault}\or
402 \equal{\f@shape}{\scitdefault}\or\equal{\f@shape}{\scsldefault}}{%
403 }{%
404 % \end{macrocode}
405 % Current font shape is without small caps or not known.
406 %
407 % If current font is italic, switch to italic small caps.
408 % \begin{macrocode}
409 \ifthenelse{\equal{\f@shape}{\itdefault}}{%
410 \fontshape\scitdefault
411 }{%
412 % \end{macrocode}
413 % If current font is slanted, switch to slanted small caps.
414 % \begin{macrocode}
415 \ifthenelse{\equal{\f@shape}{\sldefault}}{%
416 \fontshape\scsldefault
417 }{%
418 % \end{macrocode}
419 % If current font is either upright or unknown, switch to upright
420 % small caps.
421 % \begin{macrocode}
422 \fontshape\scdefault
423 }%
424 }%
425 }%
426 \selectfont
427 }
428 % \end{macrocode}
429 % \end{macro}
430 % \begin{macro}{\noscshape}
431 % \changes{2.00}{2003/09/17}{Avoid using booleans because that causes
432 % problems with explicit use of \cs{fontshape}}%
433 % Normally, using one of the font-shape commands \cs{upshape},
434 % \cs{slshape}, \cs{itshape}, and \cs{scshape} switches from one font
435 % shape to another, forgetting the old font shape.
436 % The new approach is switches only between \cs{upshape},
437 % \cs{slshape}, and \cs{itshape}.
438 % \cs{scshape} is ``added'' to the other font shape information.
439 % Thus, you are not able to use either of the commands \cs{upshape},
440 % \cs{slshape}, and \cs{itshape} to switch off small caps again.
441 % Therefor, you may use the command \cs{noscshape} which preserves the
442 % used font shape but moves from small caps to ordinary characters.
443 % \begin{macrocode}
444 \DeclareRobustCommand\noscshape{%
445 \not@math@alphabet\noscshape\relax
446 % \end{macrocode}
447 % Font shape is with small caps.
448 % \begin{macrocode}
449 \ifthenelse{\equal{\f@shape}{\scdefault}\or
450 \equal{\f@shape}{\scitdefault}\or\equal{\f@shape}{\scsldefault}}{%
451 % \end{macrocode}
452 % If current font is italic small caps, switch to italic.
453 % \begin{macrocode}
454 \ifthenelse{\equal{\f@shape}{\scitdefault}}{%
455 \fontshape\itdefault
456 }{%
457 % \end{macrocode}
458 % If current font is slanted small caps, switch to slanted.
459 % \begin{macrocode}
460 \ifthenelse{\equal{\f@shape}{\scsldefault}}{%
461 \fontshape\sldefault
462 }{%
463 % \end{macrocode}
464 % If current font is upright small caps, switch to upright.
465 % \begin{macrocode}
466 \fontshape\updefault
467 }%
468 }%
469 }{%
470 % \end{macrocode}
471 % Current font shape is without small caps or not known.
472 % Nothing to do.
473 % \begin{macrocode}
474 }%
475 \selectfont
476 }
477 % \end{macrocode}
478 % \end{macro}
479 % \iffalse
480 %</package>
481 % \fi
482 % \Finale