The slantsc package^{∗}

Harald Harders

                   h.harders@tu-bs.de

File Date 2003/11/09, Printed November 9, 2003

Abstract This package enables the use of small capitals in different font shapes, e.g., slanted or bold slanted for all fonts that provide appropriate font shapes. The only prerequisite is that the corresponding fd file has to define the font shapes scsl resp. scit for slanted resp. italic small capitals.

Contents

1 The user interface 1 2 Using other fonts than European Modern 3 3 The implementation 4

Copyright

Copyright 2003 Harald Harders.

This program can be redistributed and/or modified under the terms of the LaTeX Project Public License Distributed from ctan archives in directory macros/latex/base/lppl.txt; either version 1 of the License, or any later version.

1 The user interface

To use this package place

 \usepackage{slantsc}

in the preamble of your document. No options are necessary.

In L^{A}TEX, you can combine different font parameters like a bold series with an italic shape,

∗This file has version v2.10 last revised 2003/11/09.

 {\bfseries\itshape bold italic text}

to get bold italic text. But you are not able to combine two font shapes.

Since italic, slanted, and small caps are shapes, you are not able write in slanted small capitals, for instance. This problem is avoided by the package smallcap, available from the ctan network, which redefines small caps to be a font family rather than a shape. But what to do if your font provides small capitals in roman style and in sans serifs? You are not able to access the sans serif version, then.

The slantsc package has a different approach. It preserves small caps to be a font shape, but it enables to combine the small caps shape with the other shapes

\upshape (upright, italic, slanted). Thus, you use the normal font shape switching com-

\itshape
\slshape
\scshape

mands \upshape, \itshape, \slshape, and \scshape. The first three commands

act as usual among themselves. But if you use the \scshape command, it just adds the information "‘small capitals"’ to the current font shape.

For example, if the current font shape is italic and you use \scshape, the following text is written in italic small capitals:

\itshape This is italic text, \scshape now additionally in Small Capitals.

This leads to:

This is italic text, now additionally in Small Capitals.

If you are in a small-capitals area, using one of the other font switching commands does not affect the small capitals status, but the rest of the font shape:

\itshape\scshape This is italic Small Capitals text, \upshape now Upright.

This leads to:

This is italic Small Capitals text, now Upright.

As usual, the change of font shape is terminated by the end of the group, e.g., by using braces:

\itshape This is italic {\scshape with Small Capitals} and without.

This leads to:

This is italic with Small Capitals and without.

\noscshape Sometimes, you may want to switch off small capitals without using a group. To be able to do so, this package provides the \noscshape command, which works as follows:

\itshape This is italic \scshape with Small Capitals \noscshape and without.

This leads to:

This is italic with Small Capitals and without.

\textup Instead of the font switching commands you may also use the \text… commands

\textit
\textsl
\textsc
\emph

\textup, \textit, \textsl, \textsc as well as the \emph command, e.g.
This is \emph{the person \textsc{Harald Harders} who wrote} this
documentation.

which leads to:

This is the person Harald Harders who wrote this documentation.

\shapedefault If you want another default font than the default, you may redefine the \shapedefault command. If you, for instance, want to use an italic small caps font as default font, you may simply use

 \renewcommand\shapedefault{\scdefault\itdefault}

or

 \renewcommand\shapedefault{\scitdefault}

in the preamble of your document. Both variants are equivalent. Notice, that you have to use the command \scdefault before the other command for combined font shapes. If you want an upright small caps font as default, just use:

 \renewcommand\shapedefault{\scdefault}

You may not use \scdefault\updefault as argument! To switch to the default font, you may use the \defaultfont command.

\fontshape If you want to set the font shape directly, using the \fontshape command, e.g.:

 \fontshape{\scdefault\itdefault}\selectfont

The argument of this command is used in the same way as for the \shapedefault command.

2 Using other fonts than European Modern

This package works with all fonts that provide slanted and italic versions of the small capitals.^{1} It is important that these font shapes are declared in a specific way that slantsc can find them.

1If bold versions are also available, they are of course also supported.

slantsc uses two additional font shapes scsl and scit which are slanted small caps and italic small caps, respectively.^{2} These font shapes have to be declared in the corresponding file with the file name ⟨encoding⟩⟨font family⟩.fd, e.g., t1lmr.fd for the Latin Modern fonts. For instance, the Latin Modern font family (version 0.86) provides slanted small capitals. The corresponding entry in the fd file looks like this:

\DeclareFontShape{T1}{lmr}{m}{scsl}%
     {<-> cork-lmcsco10}{}

This command declares to use the font cork-lmcsco10 for the encoding T1, the font family lmr, the font series m (normal) and the font shape scsl (slanted small caps).

Unfortunately, Latin Modern does not contain the bold variant of the slanted small caps. But if it had it, the entry would look like that:

\DeclareFontShape{T1}{lmr}{bx}{scsl}%
     {<-> ...}{}

Since nearly no font family will contain real italic small caps variants, the best approach is to substitute them by slanted variants. This could be done for Latin Modern by the following commands:

\DeclareFontShape{T1}{lmr}{m}{scit}{<->ssub * lmr/m/scsl}{}
\DeclareFontShape{T1}{lmr}{bx}{scit}{<->ssub * lmr/bx/scsl}{}

With the OT1 encoded Computer Modern fonts, slanted small capitals are not available, since these fonts do not contain them. Nevertheless, the font encoding is not forced to T1 by this package because it works with all encodings, if the font shapes are present.

3 The implementation

Heading of the package:

 1 \NeedsTeXFormat{LaTeX2e}
 2 \ProvidesPackage{slantsc}
 3 [2003/11/09  v2.10  Provide Slanted an Italic Small Caps]

More robust string comparisons.

 4 \RequirePackage{ifthen}

Declare additional font shapes for European Computer Modern. I think, this should normally go to t1cmr.fd, but it is never read, since it is hardcoded to the format file.

2In this section, I assume that you haven’t redefined the default values for the different shapes.

If you have done so, you have do adobt all strings according to your changes.

 5 \DeclareFontFamily{T1}{cmr}{}
 6 \DeclareFontShape{T1}{cmr}{m}{scsl}%
 7 {<5><6><7><8><9><10><10.95><12><14.4>%
 8 <17.28><20.74><24.88><29.86><35.83>genb*ecsc}{}
 9 \DeclareFontShape{T1}{cmr}{bx}{scsl}%
10 {<5><6><7><8><9><10><10.95><12><14.4>%
11 <17.28><20.74><24.88><29.86><35.83>genb*ecoc}{}

Since European Computer Modern does not have real italic Small Caps substitute them silently by slanted ones.

12 \DeclareFontShape{T1}{cmr}{m}{scit}{<->ssub * cmr/m/scsl}{}
13 \DeclareFontShape{T1}{cmr}{bx}{scit}{<->ssub * cmr/bx/scsl}{}

\scitdefault Default shortcut for italic small caps.

14 \providecommand*\scitdefault{\scdefault\itdefault}

\scsldefault Default shortcut for slanted small caps.

15 \providecommand*\scsldefault{\scdefault\sldefault}

\upshape Redefine the macro \upshape that switches to an upright font. If small caps are “on”, switch to ordinary small caps, otherwise switch to the normal upright font.

16 \DeclareRobustCommand\upshape{%
17 \not@math@alphabet\upshape\relax

Font shape is with small caps.

18 \ifthenelse{\equal{\f@shape}{\scdefault}\or
19  \equal{\f@shape}{\scitdefault}\or\equal{\f@shape}{\scsldefault}}{%
20  \fontshape\scdefault
21 }{%

Current font shape is without small caps or not known.

22  \fontshape\updefault
23 }%
24 \selectfont

25 }

\slshape Redefine the macro \slshape that switches to a slanted font. If small caps are “on”, switch to slanted small caps, otherwise switch to the normal slanted font.

26 \DeclareRobustCommand\slshape{%
27 \not@math@alphabet\slshape\relax

Font shape is with small caps.

28 \ifthenelse{\equal{\f@shape}{\scdefault}\or
29  \equal{\f@shape}{\scitdefault}\or\equal{\f@shape}{\scsldefault}}{%
30  \fontshape\scsldefault
31 }{%

Current font shape is without small caps or not known.

32  \fontshape\sldefault
33 }%
34 \selectfont

35 }

\itshape Redefine the macro \itshape that switches to an italic font. If small caps are “on”, switch to italic small caps, otherwise switch to the normal italic font.

36 \DeclareRobustCommand\itshape{%
37 \not@math@alphabet\itshape\relax

Font shape is with small caps.

38 \ifthenelse{\equal{\f@shape}{\scdefault}\or
39  \equal{\f@shape}{\scitdefault}\or\equal{\f@shape}{\scsldefault}}{%
40  \fontshape\scitdefault
41 }{%

Current font shape is without small caps or not known.

42  \fontshape\itdefault
43 }%
44 \selectfont

45 }

\scshape Redefine the macro \scshape that switches to small capitals. If the actual font is italic, switch to italic small caps, if it is slanted, switch to slanted small caps, otherwise switch to ordinary small caps.

46 \DeclareRobustCommand\scshape{%
47 \not@math@alphabet\scshape\relax

Font shape is with small caps. Nothing to do.

48 \ifthenelse{\equal{\f@shape}{\scdefault}\or
49  \equal{\f@shape}{\scitdefault}\or\equal{\f@shape}{\scsldefault}}{%
50 }{%

Current font shape is without small caps or not known.

If current font is italic, switch to italic small caps.

51  \ifthenelse{\equal{\f@shape}{\itdefault}}{%
52  \fontshape\scitdefault
53  }{%

If current font is slanted, switch to slanted small caps.

54  \ifthenelse{\equal{\f@shape}{\sldefault}}{%
55  \fontshape\scsldefault
56  }{%

If current font is either upright or unknown, switch to upright small caps.

57  \fontshape\scdefault
58  }%
59  }%
60 }%
61 \selectfont

62 }

\noscshape Normally, using one of the font-shape commands \upshape, \slshape, \itshape, and \scshape switches from one font shape to another, forgetting the old font shape. The new approach is switches only between \upshape, \slshape, and \itshape. \scshape is “added” to the other font shape information. Thus, you are not able to use either of the commands \upshape, \slshape, and \itshape to switch off small caps again. Therefor, you may use the command \noscshape which preserves the used font shape but moves from small caps to ordinary characters.

63 \DeclareRobustCommand\noscshape{%
64 \not@math@alphabet\noscshape\relax

Font shape is with small caps.

65 \ifthenelse{\equal{\f@shape}{\scdefault}\or
66  \equal{\f@shape}{\scitdefault}\or\equal{\f@shape}{\scsldefault}}{%

If current font is italic small caps, switch to italic.

67  \ifthenelse{\equal{\f@shape}{\scitdefault}}{%
68  \fontshape\itdefault
69  }{%

If current font is slanted small caps, switch to slanted.

70  \ifthenelse{\equal{\f@shape}{\scsldefault}}{%
71  \fontshape\sldefault
72  }{%

If current font is upright small caps, switch to upright.

73  \fontshape\updefault
74  }%
75  }%
76 }{%

Current font shape is without small caps or not known. Nothing to do.

77 }%
78 \selectfont

79 }

Change History

2.00

General: Describe \fontshape command . . . . . . . . . . . . . . . . . . . 3

     Describe \shapedefault com-

mand . . . . . . . . . . . . . . . . . . . 3 \itshape: Avoid using booleans because that causes problems with explicit use of \fontshape …. 6

\noscshape: Avoid using booleans because that causes problems with explicit use of \fontshape 6

\scitdefault: Use commands for

combined shapes . . . . . . . . . . . 5 \scshape: Avoid using booleans because that causes problems with explicit use of \fontshape …. 6

\scsldefault: Use commands for

combined shapes . . . . . . . . . . . 5 \slshape: Avoid using booleans because that causes problems with explicit use of \fontshape …. 5

\upshape: Avoid using booleans because that causes problems with explicit use of \fontshape …. 5

2.10

General: Avoid usage of \fileversion etc. . . . . . . . . . . 1

Index

Numbers written in italic refer to the page where the corresponding entry is described; numbers underlined refer to the code line of the definition; numbers in roman refer to the code lines where the entry is used.

D

\DeclareFontFamily . . 5
\DeclareFontShape .

. . . . . . 6, 9, 12, 13

E

\emph . . . . . . . . . . . . . 3 \equal 18, 19, 28, 29,

38, 39, 48, 49, 51, 54, 65–67, 70

F

\f@shape 18, 19, 28, 29, 38, 39, 48, 49, 51, 54, 65–67, 70

\fontshape . . . . . . . . 3

I

\ifthenelse . . . . . . .

. 18, 28, 38, 48, 51, 54, 65, 67, 70 \itdefault 14, 42, 51, 68 \itshape . . . . . . . . 2, \underline{36}

N

\noscshape . . . . . . 2, \underline{63}

O

\or 18, 19, 28, 29, 38, 39, 48, 49, 65, 66

P

\providecommand . 14, 15

R

\RequirePackage . . . . 4

S

\scdefault . . . . . . .

. 14, 15, 18, 20, 28, 38, 48, 57, 65

\scitdefault . . . . . .

. \underline{14}, 19, 29, 39, 40, 49, 52, 66, 67

\scshape . . . . . . . . 2, \underline{46}

\scsldefault . . . . . .

. \underline{15}, 19, 29, 30, 39, 49, 55, 66, 70

\shapedefault . . . . . . 3

\sldefault 15, 32, 54, 71 \slshape . . . . . . . . 2, \underline{26}

T

\textit . . . . . . . . . . . 3 \textsc . . . . . . . . . . . 3 \textsl . . . . . . . . . . . 3 \textup . . . . . . . . . . . 3

U

\updefault . . . . . 22, 73

\upshape . . . . . . . . 2, \underline{16}