Mercurial > cpython-lru_cache-weakref
annotate Doc/texinputs/underscore.sty @ 39042:c02fa187e0f4 legacy-trunk
Part of SF patch #1484695. This removes dead code. The chksum was
already verified in .frombuf() on the lines above. If there was
a problem an exception is raised, so there was no way this condition
could have been true.
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Mon, 10 Jul 2006 00:23:17 +0000 |
| parents | 2380f9d1ebab |
| children |
| rev | line source |
|---|---|
|
34807
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
1 % underscore.sty 12-Oct-2001 Donald Arseneau asnd@triumf.ca |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
2 % Make the "_" character print as "\textunderscore" in text. |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
3 % Copyright 1998,2001 Donald Arseneau; Distribute freely if unchanged. |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
4 % Instructions follow after the definitions. |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
5 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
6 \ProvidesPackage{underscore}[2001/10/12] |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
7 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
8 \begingroup |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
9 \catcode`\_=\active |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
10 \gdef_{% \relax % No relax gives a small vulnerability in alignments |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
11 \ifx\if@safe@actives\iftrue % must be outermost test! |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
12 \string_% |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
13 \else |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
14 \ifx\protect\@typeset@protect |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
15 \ifmmode \sb \else \BreakableUnderscore \fi |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
16 \else |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
17 \ifx\protect\@unexpandable@protect \noexpand_% |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
18 \else \protect_% |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
19 \fi\fi |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
20 \fi} |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
21 \endgroup |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
22 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
23 % At begin: set catcode; fix \long \ttdefault so I can use it in comparisons; |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
24 \AtBeginDocument{% |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
25 {\immediate\write\@auxout{\catcode\number\string`\_ \string\active}}% |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
26 \catcode\string`\_\string=\active |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
27 \edef\ttdefault{\ttdefault}% |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
28 } |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
29 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
30 \newcommand{\BreakableUnderscore}{\leavevmode\nobreak\hskip\z@skip |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
31 \ifx\f@family\ttdefault \string_\else \textunderscore\fi |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
32 \usc@dischyph\nobreak\hskip\z@skip} |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
33 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
34 \DeclareRobustCommand{\_}{% |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
35 \ifmmode \nfss@text{\textunderscore}\else \BreakableUnderscore \fi} |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
36 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
37 \let\usc@dischyph\@dischyph |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
38 \DeclareOption{nohyphen}{\def\usc@dischyph{\discretionary{}{}{}}} |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
39 \DeclareOption{strings}{\catcode`\_=\active} |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
40 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
41 \ProcessOptions |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
42 \ifnum\catcode`\_=\active\else \endinput \fi |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
43 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
44 %%%%%%%% Redefine commands that use character strings %%%%%%%% |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
45 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
46 \@ifundefined{UnderscoreCommands}{\let\UnderscoreCommands\@empty}{} |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
47 \expandafter\def\expandafter\UnderscoreCommands\expandafter{% |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
48 \UnderscoreCommands |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
49 \do\include \do\includeonly |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
50 \do\@input \do\@iinput \do\InputIfFileExists |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
51 \do\ref \do\pageref \do\newlabel |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
52 \do\bibitem \do\@bibitem \do\cite \do\nocite \do\bibcite |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
53 } |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
54 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
55 % Macro to redefine a macro to pre-process its string argument |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
56 % with \protect -> \string. |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
57 \def\do#1{% Avoid double processing if user includes command twice! |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
58 \@ifundefined{US\string_\expandafter\@gobble\string#1}{% |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
59 \edef\@tempb{\meaning#1}% Check if macro is just a protection shell... |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
60 \def\@tempc{\protect}% |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
61 \edef\@tempc{\meaning\@tempc\string#1\space\space}% |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
62 \ifx\@tempb\@tempc % just a shell: hook into the protected inner command |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
63 \expandafter\do |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
64 \csname \expandafter\@gobble\string#1 \expandafter\endcsname |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
65 \else % Check if macro takes an optional argument |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
66 \def\@tempc{\@ifnextchar[}% |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
67 \edef\@tempa{\def\noexpand\@tempa####1\meaning\@tempc}% |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
68 \@tempa##2##3\@tempa{##2\relax}% |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
69 \edef\@tempb{\meaning#1\meaning\@tempc}% |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
70 \edef\@tempc{\noexpand\@tempd \csname |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
71 US\string_\expandafter\@gobble\string#1\endcsname}% |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
72 \if \expandafter\@tempa\@tempb \relax 12\@tempa % then no optional arg |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
73 \@tempc #1\US@prot |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
74 \else % There is optional arg |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
75 \@tempc #1\US@protopt |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
76 \fi |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
77 \fi |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
78 }{}} |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
79 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
80 \def\@tempd#1#2#3{\let#1#2\def#2{#3#1}} |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
81 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
82 \def\US@prot#1#2{\let\@@protect\protect \let\protect\string |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
83 \edef\US@temp##1{##1{#2}}\restore@protect\US@temp#1} |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
84 \def\US@protopt#1{\@ifnextchar[{\US@protarg#1}{\US@prot#1}} |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
85 \def\US@protarg #1[#2]{\US@prot{{#1[#2]}}} |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
86 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
87 \UnderscoreCommands |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
88 \let\do\relax \let\@tempd\relax % un-do |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
89 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
90 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
91 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
92 \endinput |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
93 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
94 underscore.sty 12-Oct-2001 Donald Arseneau |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
95 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
96 Features: |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
97 ~~~~~~~~~ |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
98 \_ prints an underscore so that the hyphenation of constituent words |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
99 is not affected and hyphenation is permitted after the underscore. |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
100 For example, "compound\_fracture" hyphenates as com- pound_- frac- ture. |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
101 If you prefer the underscore to break without a hyphen (but still with |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
102 the same rules for explicit hyphen-breaks) then use the [nohyphen] |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
103 package option. |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
104 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
105 A simple _ acts just like \_ in text mode, but makes a subscript in |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
106 math mode: activation_energy $E_a$ |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
107 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
108 Both forms use an underscore character if the font encoding contains |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
109 one (e.g., "\usepackage[T1]{fontenc}" or typewriter fonts in any encoding), |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
110 but they use a rule if the there is no proper character. |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
111 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
112 Deficiencies: |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
113 ~~~~~~~~~~~~~ |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
114 The skips and penalties ruin any kerning with the underscore character |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
115 (when a character is used). However, there doesn't seem to be much, if |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
116 any, such kerning in the ec fonts, and there is never any kerning with |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
117 a rule. |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
118 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
119 You must avoid "_" in file names and in cite or ref tags, or you must use |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
120 the babel package, with its active-character controls, or you must give |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
121 the [strings] option, which attempts to redefine several commands (and |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
122 may not work perfectly). Even without the [strings] option or babel, you |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
123 can use occasional underscores like: "\include{file\string_name}". |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
124 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
125 Option: [strings] |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
126 ~~~~~~~~~~~~~~~~~ |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
127 The default operation is quite simple and needs no customization; but |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
128 you must avoid using "_" in any place where LaTeX uses an argument as |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
129 a string of characters for some control function or as a name. These |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
130 include the tags for \cite and \ref, file names for \input, \include, |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
131 and \includegraphics, environment names, counter names, and placement |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
132 parameters (like "[t]"). The problem with these contexts is that they |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
133 are `moving arguments' but LaTeX does not `switch on' the \protect |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
134 mechanism for them. |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
135 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
136 If you need to use the underscore character in these places, the package |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
137 option [strings] is provided to redefine commands taking a string argument |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
138 so that the argument is protected (with \protect -> \string). The list |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
139 of commands is given in "\UnderscoreCommands", with "\do" before each, |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
140 covering \cite, \ref, \input, and their variants. Not included are many |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
141 commands regarding font names, everything with counter names, environment |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
142 names, page styles, and versions of \ref and \cite defined by external |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
143 packages (e.g. \vref and \citeyear). |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
144 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
145 You can add to the list of supported commands by defining \UnderscoreCommands |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
146 before loading this package; e.g. |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
147 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
148 \usepackage{chicago} |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
149 \newcommand{\UnderscoreCommands}{% (\cite already done) |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
150 \do\citeNP \do\citeA \do\citeANP \do\citeN \do\shortcite |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
151 \do\shortciteNP \do\shortciteA \do\shortciteANP \do\shortciteN |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
152 \do\citeyear \do\citeyearNP |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
153 } |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
154 \usepackage[strings]{underscore} |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
155 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
156 Not all commands can be supported this way! Only commands that take a |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
157 string argument *first* can be protected. One optional argument before |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
158 the string argument is also permitted, as exemplified by \cite: both |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
159 \cite{tags} and \cite[text]{tags} are allowed. A command like |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
160 \@addtoreset which takes two counter names as arguments could not |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
161 be protected by adding it to \UnderscoreCommands. |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
162 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
163 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
164 !! When you use the [strings] option, you must load this package !! |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
165 !! last (or nearly last). !! |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
166 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
167 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
168 There are two reasons: 1) The redefinitions done for protection must come |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
169 after other packages define their customized versions of those commands. |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
170 2) The [strings] option requires the _ character to be activated immediately |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
171 in order for the cite and ref tags to be read properly from the .aux file |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
172 as plain strings, and this catcode setting might disrupt other packages. |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
173 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
174 The babel package implements a protection mechanism for many commands, |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
175 and will be a complete fix for most documents without the [strings] option. |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
176 Many add-on packages are compatible with babel, so they will get the |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
177 strings protection also. However, there are several commands that are |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
178 not covered by babel, but can easily be supported by the [strings] and |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
179 \UnderscoreCommands mechanism. Beware that using both [strings] and babel |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
180 may lead to conflicts, but does appear to work (load babel last). |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
181 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
182 Implementation Notes: |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
183 ~~~~~~~~~~~~~~~~~~~~~ |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
184 The first setting of "_" to be an active character is performed in a local |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
185 group so as to not interfere with other packages. The catcode setting |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
186 is repeated with \AtBeginDocument so the definition is in effect for the |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
187 text. However, the catcode setting is repeated immediately when the |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
188 [strings] option is detected. |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
189 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
190 The definition of the active "_" is essentially: |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
191 \ifmmode \sb \else \BreakableUnderscore \fi |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
192 where "\sb" retains the normal subscript meaning of "_" and where |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
193 "\BreakableUnderscore" is essentially "\_". The rest of the definition |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
194 handles the "\protect"ion without causing \relax to be inserted before |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
195 the character. |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
196 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
197 \BreakableUnderscore uses "\nobreak\hskip\z@skip" to separate the |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
198 underscore from surrounding words, thus allowing TeX to hyphenate them, |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
199 but preventing free breaks around the underscore. Next, it checks the |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
200 current font family, and uses the underscore character from tt fonts or |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
201 otherwise \textunderscore (which is a character or rule depending on |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
202 the font encoding). After the underscore, it inserts a discretionary |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
203 hyphenation point as "\usc@dischyph", which is usually just "\-" |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
204 except that it still works in the tabbing environment, although it |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
205 will give "\discretionary{}{}{}" under the [nohyphen] option. After |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
206 that, another piece of non-breaking interword glue is inserted. |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
207 Ordinarily, the comparison "\ifx\f@family\ttdefault" will always fail |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
208 because \ttdefault is `long' where \f@family is not (boooo hisss), but |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
209 \ttdefault is redefined to be non-long by "\AtBeginDocument". |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
210 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
211 The "\_" command is then defined to use "\BreakableUnderscore". |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
212 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
213 If the [strings] option is not given, then that is all! |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
214 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
215 Under the [strings] option, the list of special commands is processed to: |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
216 - retain the original command as \US_command (\US_ref) |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
217 - redefine the command as \US@prot\US_command for ordinary commands |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
218 (\ref -> \US@prot\US_ref) or as \US@protopt\US_command when an optional |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
219 argument is possible (\bibitem -> \US@protopt\US_bibitem). |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
220 - self-protecting commands (\cite) retain their self-protection. |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
221 Diagnosing the state of the pre-existing command is done by painful |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
222 contortions involving \meaning. |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
223 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
224 \US@prot and \US@protopt read the argument, process it with \protect |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
225 enabled, then invoke the saved \US_command. |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
226 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
227 Modifications: |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
228 ~~~~~~~~~~~~~~ |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
229 12-Oct-2001 Babel (safe@actives) compatibility and [nohyphen] option. |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
230 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
231 Test file integrity: ASCII 32-57, 58-126: !"#$%&'()*+,-./0123456789 |
|
2380f9d1ebab
clean up the underscore mess for the typeset formats so that subscripts
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
232 :;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ |
