summaryrefslogtreecommitdiff
path: root/fonts/greek/levy/slgreek.sty
blob: e5f3c70a040453b5dfbbd2329edca7a0b13e17c7 (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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Greek.sty
% A latex style file for use with Silvio Levy's classical Greek fonts
% (see TUGboat 9.1 (1988), pp. 20 ff.).  The following style file 
% consists of Levy's own greekmac.tex macros unaltered, followed by
% some macros published by R. Wonneberger and slightly modified
% by D. Wujastyk, which fix a problem in using Greek accents in LaTeX
% footnotes.  See below for more explanation of the footnote stuff.
%
% Usage: \documentstyle[greek]{book} ... as normal.  This makes all the
%        greekmac macros available, and fixes the footnote problem.
% 29 Jan 1991
%
%    Copyright (C) 1991 Silvio Levy, Dominik Wujastyk, Reinhard Wonneberger
%     
%    This file 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 file 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, see <http://www.gnu.org/licenses/>.

\def\ifnextchar#1#2#3{\let\tempe #1\def\tempa{#2}\def\tempb{#3}\futurelet
  \tempc\ifnch}
\def\ifnch{\ifx\tempc\tempe\let\tempd\tempa\else\let\tempd\tempb\fi\tempd}
\def\gobble#1{}
\font\tengr=grreg10
\font\tengrbf=grbld10
\font\tengrtt=grtt10
\def\greekmode{%
\catcode`\<=13
\catcode`\>=13
\catcode`\'=11
\catcode`\`=11
\catcode`\~=11
\catcode`\"=11
\catcode`\|=11
\lccode`\<=`\<%
\lccode`\>=`\>%
\lccode`\'=`\'%
\lccode`\`=`\`%
\lccode`\~=`\~%
\lccode`\"=`\"%
\lccode`\|=`\|%
\tengr\def\bf{\tengrbf}\def\tt{\tengrtt}}
\newcount\vwl
\newcount\acct
\def\lt{<}
\def\gt{>}
{
  \greekmode
  \gdef>{\ifnextchar `{\expandafter\smoothgrave\gobble}{\char\lq\>}}
  \gdef<{\ifnextchar `{\expandafter\roughgrave\gobble}{\char\lq\<}}
  \gdef\smoothgrave#1{\acct=\rq137 \vwl=\lq#1 \dobreathinggrave}
  \gdef\roughgrave#1{\acct=\rq103 \vwl=\lq#1 \dobreathinggrave}
  \gdef\dobreathinggrave{\ifnum\vwl\lt\rq140	%if uppercase
    \char\the\acct\char\the\vwl\else\expandafter\testiota\fi}
  \gdef\testiota{\ifnextchar |{\addiota\doaccent\gobble}{\doaccent}}
  \gdef\addiota{\ifnum\vwl=\lq a\vwl=\rq370
    \else\ifnum\vwl=\lq h\vwl=\rq371 \else\vwl=\rq372 \fi\fi}
  \gdef\doaccent{\accent\the\acct \char\the\vwl\relax}
}

\newif\ifgreek\greekfalse

\def\begingreek{\bgroup\greektrue\greekmode}
\def\endgreek{\egroup}

\let\math=$
{\catcode`\$=13
\gdef\greekdelims{\catcode`\$=13
\def${\ifgreek\endgreek\else\begingreek\fi}
\def\display{\math\math}\def\enddisplay{\math\math}}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The following macros are taken from Reinhard Wonnenberger's
% article "Chapter Mottos ..." in TUGboat 7(3), 1986, p.179.  I (Dominik
% Wujastyk) have edited out those bits in which Reinhard was altering
% the default values of LaTeX to his own liking.  If you want to do 
% that as well, you might prefer to do it in a separate style file.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The following macros avoid the need to read the footnote text as
% a parameter.  They are taken from PLAIN.TEX.
% LaTeX control sequences have been substituted for those from
% PLAIN, and are marked thus: %LATEX
%
% \newinsert\footins
% \def\footnote#1{\let\@sf\empty % parameter #2 (the text) is read later
%   \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
%   #1\@sf\vfootnote{#1}}
% \def\vfootnote#1{\insert\footins\bgroup
\def\@footnotetext{\insert\footins\bgroup               %LATEX
  \footnotesize                                         %LATEX
  \interlinepenalty\interfootnotelinepenalty
% \splittopskip\ht\strutbox % top baseline for broken footnotes
  \splittopskip\footnotesep                             %LATEX
  \splitmaxdepth\dp\strutbox \floatingpenalty\@MM
%   \leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip
  \hsize\columnwidth \@parboxrestore                    %LATEX
  \edef\@currentlabel{\csname p@footnote\endcsname      %LATEX
    \@thefnmark}%                                       %LATEX
%   \textindent{#1}%Knuth
% \textindent{\@thefnmark} % yields normal numbers
\@makefnlabel                                           %LATEX
\footstrut\futurelet\next\fo@t}
%
% Format the footnote label inside the footnote; based on book.sty:
\def\@makefnlabel{\@@par \parindent 1em\noindent
   \hbox to 1.8em{\hss$^{\@thefnmark}$}}
%
% From latex.tex, for comparison:
% \long\def\@footnotetext#1{\insert\footins{\footnotesize
%     \interlinepenalty\interfootnotelinepenalty
%     \splittopskip\footnotesep
%     \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
%     \hsize\columnwidth \@parboxrestore
%    \edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}\@makefntext
%     {\rule{\z@}{\footnotesep}\ignorespaces
%       #1\strut}}}
%
% Rewritten on the basis of plain.tex:
\def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t
  \else\let\next\f@t\fi \next}
\def\f@@t{\bgroup
  \rule{\z@}{\footnotesep}\ignorespaces                 %LATEX
  \aftergroup\@foot\let\next}
\def\f@t#1{#1\@foot}
% \def\@foot{\strut\egroup}
\def\@foot{\strut\egroup                                %LATEX
  \ifhmode\spacefactor\@x@sf\relax\fi}                  %LATEX
\def\footstrut{\vbox to\splittopskip{}}
\skip\footins=\bigskipamount % space added when footnote is present
\count\footins=1000 % footnote magnification factor (1 to 1)
\dimen\footins=8in % maximum footnotes per page

% End of Greek.sty