summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/frankenstein/slemph.sty
blob: f48c93cb7619f58a51719be0de6973c893eb5a81 (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
%^^A* legal notices
% \iffalse
%
%   This program is part of the Frankenstein bundle for LaTeX.  
%
%   Copyright 1995-2001 Matt Swift <swift@alum.mit.edu>.
%
%   This file contains both the code and documentation for the
%   slemph LaTeX package.  It will work ONLY if it is placed in a
%   proper directory.  Files called README, INSTALL, slemph.tex
%   and slemph.ins should have also been distributed to you
%   with this file.  See them for more information on how to typeset
%   the documentation with LaTeX and how to generate a version of this
%   file that will work faster than this one.
%
%   This program is free software; you may redistribute it and/or
%   modify it under the conditions of the LaTeX Project Public
%   License, either version 1.2 or (at your option) any later version.
%   The latest version of this license is in
%   http://www.latex-project.org/lppl.txt, and version 1.2 or later is
%   part of all distributions of LaTeX version 1999/12/01 or later.
%
%   This program is distributed in the hope that it will be useful,
%   but without any warranty; without even the implied warranty of
%   merchantability or fitness for a particular purpose.  See the
%   LaTeX Project Public License for more details.
%
% \fi  
%
%^^A* checks
%
%^^A NOTE:  The character table, with two %'s, will get written to all files.
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%
% \CheckSum{41}
%
% \begin{abstract}
%   The \package{slemph} package defines the commands \cs\itswitch, \cs\slswitch,
%   \cs\textitswitch, and \cs\textslswitch, which switch between slanted or
%   italic type and upright type.  They can be used to represent emphasis with
%   slanted type.
% \end{abstract}
% \tableofcontents
%
% \part{Discussion}
%
% \DescribeMacro\itswitch
%   \cs\itswitch calls \cs\itshape if the current font is not italic, and
%   \cs\upshape if the current font is italic.  
%
% \DescribeMacro\slswitch
%   \cs\slswitch calls \cs\slshape if the current font is not slanted, and
%   \cs\upshape if the current font is slanted.  
%
% \DescribeMacro\textitswitch
%   \cs\textitswitch\marg{text} sets its argument with \cs\itshape if the
%   current font is not italic, or \cs\upshape if the current font is italic.
%
% \DescribeMacro\textslswitch
%   \cs\textslswitch\marg{text} sets its argument with \cs\slshape if the
%   current font is not slanted, or \cs\upshape if the current font is slanted.
%
% Regarding all four commands above, notice that the factory definition of
% \cs\em would switch based on whether the current font was \emph{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.
%
% \StopEventually{}
%
% \part{Implementation}
%
% \section{Version control}
%
%  \begin{macro}{\fileinfo}
%  \begin{macro}{\DoXUsepackagE}
%  \begin{macro}{\HaveECitationS}
%  \begin{macro}{\fileversion}
%  \begin{macro}{\filedate}
%  \begin{macro}{\docdate}
%  \begin{macro}{\PPOptArg}
% These definitions must be the first ones in the file.
%    \begin{macrocode}
\def\fileinfo{slanted emphasis (Frankenstein's gait)}
\def\DoXPackageS {}
\def\fileversion{v1.2}
\def\filedate{1999/02/25}
\def\docdate{1999/02/25}
\edef\PPOptArg {%
  \filedate\space \fileversion\space \fileinfo
}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%
% If we're loading this file from a \cs\ProcessDTXFile command (see the
% \package{compsci} package), then \cs\JusTLoaDInformatioN will be defined;
% othewise we assume it is not (that's why the FunkY NamE).
% 
% If we're loading from \cs\ProcessDTXFile, we want to load the packages listed
% in \cs\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.  \cs\DoXPackageS, if there are any, are declared in
% the \ext{dtx} file, and, if you're reading the typeset documentation of this
% package, would appear just above.  (It's OK to call \cs\usepackage with an
% empty argument or \cs\relax, by the way.)
%    \begin{macrocode}
\makeatletter% A special comment to help create bst files.  Don't change!
\@ifundefined{JusTLoaDInformatioN} {%
  }{% ELSE (we know the compsci package is already loaded, too)
  \UndefineCS\JusTLoaDInformatioN
  \SaveDoXVarS
  \eExpand\csname DoXPackageS\endcsname\In {%use \csname in case it's undefined
    \usepackage{#1}%
  }%
  \RestoreDoXVarS
  \makeatother
  \endinput
}% A special comment to help create bst files.  Don't change!
%    \end{macrocode}
%
% Now we check for \LaTeX2e and declare the LaTeX package.
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{slemph}[\PPOptArg]
%    \end{macrocode}^^A special comment to help create bst files.  Don't change!
%
% ^^A NOTE: We have to compensate for the above backslashes, which are not
% ^^A       actually in the .dtx file the author works on, by adding to the
% ^^A       CheckSum.
%%
% \AddToCheckSum{17}^^A `dtx-update-checksum' automatically handles this.
% \AddToCheckSum{7}^^A The half a macrocode env. at the top is missed, however...
% \AddToCheckSum{10}^^A ... and so are the 5 \defs from the .dtx file 
%                   ^^A     that precede it.
% \IfCitations {%
%   \AddToCheckSum{2}^^A When \initelyHavECitationS is defined in
% }                  ^^A the .dtx file, we need 2 more in the CheckSum.
%
%
% \section{The switchers}
%
%  \begin{macro}{\itswitch}
%  \begin{macro}{\textitswitch}
%  \begin{macro}{\slswitch}
%  \begin{macro}{\textslswitch}
% Normally we would use the \cs\NewRobustCommand and \cs\NewTextFontCommand
% commands from the \package{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.
%    \begin{macrocode}
\newcommand\itswitch {}
\newcommand\slswitch {}
\newcommand\textitswitch {}
\newcommand\textslswitch {}

\DeclareRobustCommand\itswitch {%
  \@nomath\itswitch
  \def\reserved@a{it}%
  \ifx\f@shape\reserved@a
    \upshape
  \else 
    \itshape
  \fi
}
\DeclareRobustCommand\slswitch {%
  \@nomath\slswitch
  \def\reserved@a{sl}%
  \ifx\f@shape\reserved@a
    \upshape
  \else
    \slshape
  \fi
}
\DeclareTextFontCommand\textitswitch\itswitch
\DeclareTextFontCommand\textslswitch\slswitch
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%
% \part{Configuration}
%
% Load a configuration file.
%    \begin{macrocode}
\InputIfFileExists{slemph.cfg}{}{}
%    \end{macrocode}
%
%  The contents of the distributed configuration file are below.
%
% \InputIfFileExists{slemph.cfg}{}{}
%
% \Finale