summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/germkorr/germkorr.sty
blob: 6edb6d9b71b209316d89e6336c8e36d34d5a7aa8 (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
\typeout{Supplement style option \string`GERMKORR\string' 1.0 \string<26 Jul 2009\string>}

%%    This LaTeX style file modifies the commands for quotation marks which
%%    are pre-defined in GERMAN.STY: GERMKORR.STY brings the lower single
%%    quotes (\glq), and the lower double quotes (\glqq or "`) nearer to a
%%    following letter C, G, O, Q, U, V, v, W, w, T, Y, \O, or \OE -- even
%%    if that letter has an usual accent; see the doumentation GERMKORR.TEX.
%%    KNOWN ERRORS:
%%    * GERMKORR will even do its job in typewriter fonts, where that is
%%    probably not wanted.  Then, you have to switch GERMKORR off, e.g. as
%%    \texttt{\nogermkorr"`Text"'}, or \texttt{"`{}Text"'}!
%%    * GERMKORR can not handle accents which are related to more than one
%%    letter.  "`\t{CC}"', therefore, will not be handled!
%%    * Concerning the TeX command \accent, GERMKORR in any case needs the
%%    two following arguments separated by a space, e.g. "`\accent 22 C"'!

%%    This program is free software; you can redistribute it and/or modify
%%    it under the terms of the GNU General Public License as published by
%%    the Free Software Foundation; either version 2 of the License, or
%%    (at your option) any later version.
%%
%%    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
%%    GNU General Public License for more details.
%%
%%    You should have received a copy of the GNU General Public License
%%    along with this program; if not, write to the Free Software
%%    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

%%    GERMKORR  (c) Timo Baumann  26.~Juli 2009



\def\next@kg{}
\def\txen@kg{}
\def\test@kg{}

\def\allowhy@kg{{\nobreak \hskip 0pt plus 0pt}}

\def\Otest@kg{O@}
\def\Utest@kg{U@}

\def\acckorr@kg#1{%
 \def\test@kg{#1}%
 \ifx#1C\kern -0.07em\fi
 \ifx#1G\kern -0.07em\fi
 \ifx#1O\kern -0.07em\fi  \ifx\test@kg\Otest@kg\kern -0.07em\fi
 \ifx#1Q\kern -0.07em\fi
 \ifx#1U\kern -0.09em\fi  \ifx\test@kg\Utest@kg\kern -0.09em\fi
 \ifx#1V\kern -0.13em\fi
 \ifx#1v\kern -0.07em\fi
 \ifx#1W\kern -0.11em\fi
 \ifx#1w\kern -0.07em\fi
 \ifx#1T\kern -0.11em\fi
 \ifx#1Y\kern -0.13em\fi
 \ifx#1\O\kern -0.05em\fi
 \ifx#1\OE\kern -0.09em\fi
 \allowhy@kg\txen@kg{#1}}

\def\accentnum@kg#1 #2{%
 \ifx#2C\kern -0.07em\fi
 \ifx#2G\kern -0.07em\fi
 \ifx#2O\kern -0.07em\fi
 \ifx#2Q\kern -0.07em\fi
 \ifx#2U\kern -0.09em\fi
 \ifx#2V\kern -0.13em\fi
 \ifx#2v\kern -0.07em\fi
 \ifx#2W\kern -0.11em\fi
 \ifx#2w\kern -0.07em\fi
 \ifx#2T\kern -0.11em\fi
 \ifx#2Y\kern -0.13em\fi
 \ifx#2\O\kern -0.05em\fi
 \ifx#2\OE\kern -0.09em\fi
 \allowhy@kg\accent #1 #2}

\def\getelse@kg{\allowhy@kg\txen@kg}

\def\aktacckorr@kg#1{\ifx#1\dq@prtct \else
  \message{[ GERMKORR: Get unexpected \string#1 ] }\fi
 \acckorr@kg}

\def\getarg@kg{\afterassignment\nextarg@kg\let\txen@kg= }

\def\nextarg@kg{\bgroup
 \ifx\txen@kg\accent
 \expandafter\accentnum@kg\else
 \expandafter\getelse@kg\fi}

\def\gonext@kg{\let\txen@kg=\next@kg \let\next@kg=\acckorr@kg}
\def\goact@kg{\let\txen@kg=\next@kg \let\next@kg=\aktacckorr@kg}

{\catcode`\"=13%
\gdef\gqhkorr@kg{%
 \if@germkorr
 \ifx\next@kg C\kern -0.07em\fi
 \ifx\next@kg G\kern -0.07em\fi
 \ifx\next@kg O\kern -0.07em\fi
 \ifx\next@kg Q\kern -0.07em\fi
 \ifx\next@kg U\kern -0.09em\fi
 \ifx\next@kg V\kern -0.13em\fi
 \ifx\next@kg v\kern -0.07em\fi
 \ifx\next@kg W\kern -0.11em\fi
 \ifx\next@kg w\kern -0.07em\fi
 \ifx\next@kg T\kern -0.11em\fi
 \ifx\next@kg Y\kern -0.13em\fi
 \ifx\next@kg \O\kern -0.05em\fi
 \ifx\next@kg \OE\kern -0.09em\fi
 \ifx\next@kg          "\gonext@kg\fi
 \ifx\next@kg \newumlaut\gonext@kg\fi
 \ifx\next@kg \active@dq\goact@kg \fi
 \ifx\next@kg \bgroup   \let\next@kg=\getarg@kg\fi
 \ifx\next@kg \accent\let\next@kg=\accentnum@kg\fi
 \ifx\next@kg \"\gonext@kg\fi
 \ifx\next@kg \.\gonext@kg\fi
 \ifx\next@kg \=\gonext@kg\fi
 \ifx\next@kg \^\gonext@kg\fi
 \ifx\next@kg \'\gonext@kg\fi
 \ifx\next@kg \`\gonext@kg\fi
 \ifx\next@kg \~\gonext@kg\fi
 \ifx\next@kg \b\gonext@kg\fi  \ifx\next@kg \pb\gonext@kg\fi
 \ifx\next@kg \c\gonext@kg\fi  \ifx\next@kg \pc\gonext@kg\fi
 \ifx\next@kg \d\gonext@kg\fi  \ifx\next@kg \pd\gonext@kg\fi
 \ifx\next@kg \H\gonext@kg\fi
 \ifx\next@kg \k\gonext@kg\fi
 \ifx\next@kg \r\gonext@kg\fi
 %\ifx\next@kg \t\gonext@kg\fi
 \ifx\next@kg \u\gonext@kg\fi
 \ifx\next@kg \v\gonext@kg\fi
 \ifx\next@kg `\kern -0.1em\fi
 \ifx\next@kg \glq\kern 0.03em\fi
 \ifx\next@kg \@glq\kern 0.03em\fi
 \fi
 \allowhy@kg\next@kg}%
}

\def\after@kg{\afterassignment\gqhkorr@kg\let\next@kg= }

\newif\if@germkorr\@germkorrtrue

\expandafter\ifx\csname mdqon\endcsname\relax
      \typeout{ ** Error **: GERMAN not (yet) loaded. Do not re-define \string"\string` and \string\glq\string!}%
\else \typeout{GERMAN expected. Try to re-define \string"\string` and \string\glq\string!}%
  \def@dqmacro{`}{\glqq}{\glqq}%    %% Elder vers says {\glqq{}}{\glqq{}} %%
\expandafter\ifx\csname @glqq\endcsname\relax
  \let\glqq@kg\glqq     %% LaTeX2e %%
  \DeclareRobustCommand{\glqqkgk}{\after@kg}%
  \def\glqq{\glqq@kg\glqqkgk}%
  \let\glq@kg\glq
  \def\Tone@kg{T1}%
  \DeclareRobustCommand{\glqkgk}{\if@germkorr\ifx\encodingdefault\Tone@kg\kern-0.075em\fi\fi\after@kg}%
  \def\glq{\glq@kg\glqkgk}%
   \DeclareRobustCommand{\germkorr}{\@germkorrtrue}%
   \DeclareRobustCommand{\nogermkorr}{\@germkorrfalse}%
\else
  \let\glqq@kg\@glqq    %% LaTeX 2.09 %%
  \def\@glqq{\glqq@kg\after@kg}%
  \let\glq@kg\@glq
  \def\@glq{\glq@kg\after@kg}%
   \def\@yeskg{\@germkorrtrue}%
   \def\germkorr{\protect\@yeskg}%
   \def\@nokg{\@germkorrfalse}%
   \def\nogermkorr{\protect\@nokg}%
\fi
\fi

\endinput