The slemph LaTeX package

slanted emphasis (Frankenstein’s gait)

          Matt Swift <swift@alum.mit.edu>

Version: 1.2 Date: 1999/02/25

Documentation revision: 1999/02/25

Abstract

The slemph package defines the commands \itswitch, \slswitch, \textitswitch, and \textslswitch, which switch between slanted or italic type and upright type. They can be used to represent emphasis with slanted type.

Contents

I Discussion 2

II Implementation 3

1 Version control 3

2 The switchers 3

III Configuration 5

Part I

Discussion

\itswitch \itswitch calls \itshape if the current font is not italic, and \upshape if the

current font is italic.

\slswitch \slswitch calls \slshape if the current font is not slanted, and \upshape if

the current font is slanted.

\textitswitch \textitswitch {⟨text⟩} sets its argument with \itshape if the current font

is not italic, or \upshape if the current font is italic.

\textslswitch \textslswitch {⟨text⟩} sets its argument with \slshape if the current font

is not slanted, or \upshape if the current font is slanted.

Regarding all four commands above, notice that the factory definition of \em would switch based on whether the current font was sloped, which includes both slanted and italic type. I think slanted and italic type are different enough that you can leave, say, an italic word in the midst of a slanted context and it will still communicate to the reader whatever italic type signifies in an upright context.

Part II

Implementation

1 Version control

\fileinfo \DoXUsepackagE \HaveECitationS \fileversion \filedate \docdate \PPOptArg These definitions must be the first ones in the file.
 1 \def\fileinfo{slanted emphasis (Frankenstein's gait)}
 2 \def\DoXPackageS {}
 3 \def\fileversion{v1.2}
 4 \def\filedate{1999/02/25}
 5 \def\docdate{1999/02/25}
 6 \edef\PPOptArg {%
 7 \filedate\space \fileversion\space \fileinfo
 8 }

If we’re loading this file from a \ProcessDTXFile command (see the compsci package), then \JusTLoaDInformatioN will be defined; othewise we assume it is not (that’s why the FunkY NamE).

If we’re loading from \ProcessDTXFile, we want to load the packages listed in \DoXPackageS (needed to typeset the documentation for this file) and then bail out. Otherwise, we’re using this file in a normal way as a package, so do nothing. \DoXPackageS, if there are any, are declared in the dtx file, and, if you’re reading the typeset documentation of this package, would appear just above. (It’s OK to call \usepackage with an empty argument or \relax, by the way.)

 9 \makeatletter% A special comment to help create bst files.  Don't change!
10 \@ifundefined{JusTLoaDInformatioN} {%
11 }{% ELSE (we know the compsci package is already loaded, too)
12 \UndefineCS\JusTLoaDInformatioN
13 \SaveDoXVarS
14 \eExpand\csname DoXPackageS\endcsname\In {%use \csname in case it's undefined
15  \usepackage{#1}%
16 }%
17 \RestoreDoXVarS
18 \makeatother
19 \endinput
20 }% A special comment to help create bst files.  Don't change!

Now we check for L^{A}TEX2e and declare the LaTeX package.

21 \NeedsTeXFormat{LaTeX2e}
22 \ProvidesPackage{slemph}[\PPOptArg]

2 The switchers

\itswitch \textitswitch \slswitch \textslswitch Normally we would use the \NewRobustCommand and \NewTextFontCommand com-

mands from the moredefs package, but this package is so small we might as well do that by hand and avoid dependence on that larger package, for efficiency.

23 \newcommand\itswitch {}
24 \newcommand\slswitch {}
25 \newcommand\textitswitch {}
26 \newcommand\textslswitch {}

27

28 \DeclareRobustCommand\itswitch {%
29 \@nomath\itswitch
30 \def\reserved@a{it}%
31 \ifx\f@shape\reserved@a
32  \upshape
33 \else
34  \itshape
35 \fi

36 }

37 \DeclareRobustCommand\slswitch {%
38 \@nomath\slswitch
39 \def\reserved@a{sl}%
40 \ifx\f@shape\reserved@a
41  \upshape
42 \else
43  \slshape
44 \fi

45 }

46 \DeclareTextFontCommand\textitswitch\itswitch
47 \DeclareTextFontCommand\textslswitch\slswitch

Part III

Configuration

Load a configuration file.

1 \InputIfFileExists{slemph.cfg}{}{}

The contents of the distributed configuration file are below.

2 \def\fileinfo{slemph package configuration}
3 \def\fileversion{v1.0}
4 \def\filedate{1996/01/24}
5 \def\docdate{1996/01/24}
6 \ProvidesFile{slemph.cfg}

\em Slanted emphasis.

7 \let\em\slswitch

Index

Numbers written in italic refer to the page where the corresponding entry is described, the ones underlined to the code line of the definition, the rest to the code lines where the entry is used.

Symbols

\@ifundefined . . . . . 10

\@nomath . . . . . . . 29, 38

C

\csname . . . . . . . . . . 14

D

\DeclareRobustCommand

. . . . . . . . . 28, 37

\DeclareTextFontCommand

. . . . . . . . . 46, 47 \def . . . . . . . 1–5, 30, 39 \docdate . . . . . . . . \underline{1}, 5

\DoXPackageS . . . . . . . 2
\DoXUsepackagE . . . . . \underline{1}

E

\edef . . . . . . . . . . . . . 6 \eExpand . . . . . . . . . 14 \else . . . . . . . . . . 33, 42 \em . . . . . . . . . . . . . . \underline{7}

\endcsname . . . . . . . 14

\endinput . . . . . . . . 19

F

\f@shape . . . . . . . 31, 40 \fi . . . . . . . . . . . 35, 44 \filedate . . . . . . . \underline{1}, 4 \fileinfo . . . . . . . \underline{1}, 2

                          \fileversion . . . . . \underline{1}, 3

H

                          \HaveECitationS . . . . \underline{1}

I \ifx . . . . . . . . . . . 31, 40 \In . . . . . . . . . . . . . 14

                          \InputIfFileExists . . 1

\itshape . . . . . . . . . 34 \itswitch . . . . . . . 2, \underline{23}

J

                          \JusTLoaDInformatioN 12

L \let . . . . . . . . . . . . . . 7

M

                          \makeatletter . . . . . . 9
                          \makeatother . . . . . . 18

N

                          \NeedsTeXFormat . . . 21

                                                   \newcommand . . . . . 23–26

P \PPOptArg . . . . . . . \underline{1}, 22

                                                   \ProvidesFile . . . . . . 6
                                                   \ProvidesPackage . . 22

R

                                                   \reserved@a 30, 31, 39, 40
                                                   \RestoreDoXVarS . . . 17

S

                                                   \SaveDoXVarS . . . . . . 13

\slshape . . . . . . . . . 43 \slswitch . . . . . 2, 7, \underline{23} \space . . . . . . . . . . . . 7

T

                                                   \textitswitch . . . . 2, \underline{23}
                                                   \textslswitch . . . . 2, \underline{23}

U

                                                   \UndefineCS . . . . . . . 12

\upshape . . . . . . . 32, 41

                                                   \usepackage . . . . . . . 15