summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/lexikon/lexikon.sty
blob: 83596f9ccc004298a0155660817248c6d75ce786 (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
%% 
%% This is file `lexikon.sty'
%% 
%% Copyright (C) 1998-1999 by Axel Kielhorn.  All rights reserved.
%% For additional copyright information see further down in this file.
%% 
%% This file is to be used with the LaTeX2e system.
%% ------------------------------------------------
%% 
%% This program can be redistributed and/or modified under the terms
%% of the LaTeX Project Public License Distributed from CTAN
%% archives in directory macros/latex/base/lppl.txt; either
%% version 1 of the License, or any later version.
%% 
%% IMPORTANT NOTICE:
%% 
%% Error reports in case of UNCHANGED versions to
%% Axel Kielhorn
%% A.Kielhorn@tu-bs.de
%% 
%% \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         \~}
%%

\ProvidesPackage{lexikon}%
              [1999/05/13 v0.1c LaTeX2e lexikon package]

\setlength{\parskip}{0.5\baselineskip plus 3pt}
\setlength{\parindent}{0pt}

\newlength\leftfield
\newlength\rightfield
\newlength\dictindent

%% Skip the 2nd entry
\newif\ifgrammar
\DeclareOption{grammar}    {\grammartrue}
\DeclareOption{nogrammar}  {\grammarfalse}
%% Show only the keywords of the entry
%% Usefull to generate short overviews
\newif\ifkeywordonly 
\DeclareOption{keywordonly}{\keywordonlytrue}
\DeclareOption{fullentry}  {\keywordonlyfalse}
%% Show only the first language
%% To create single language dictionaries
\newif\ifsinglelanguage 
\DeclareOption{singlelanguage}{\singlelanguagetrue}
\DeclareOption{duallanguage}  {\singlelanguagefalse}
%% Show the second language in the first collumn
%% The entries should be sorted by the 4th column
\newif\ifinvertlanguages 
\DeclareOption{invertlanguages}%
{\PackageError{Not supported yet, sorry}{Send me the code and I'll include it.}}
\DeclareOption{noinvertlanguages}%
{\invertlanguagesfalse}
%% No phonetic by default (You will need ipa.sty and the WSUIPA fonts)
\newif\ifphonetic 
\DeclareOption{phonetic}  {\phonetictrue}
\DeclareOption{nophonetic}{\phoneticfalse}

\ExecuteOptions{grammar,fullentry,duallanguage,noinvertlanguages,nophonetic}
\ProcessOptions

\ifphonetic
  \RequirePackage{ipa}
\fi

\if@twoside
 \def\ps@dictheadings{\let\@mkboth\@gobbletwo
  \def\@evenhead{\vbox{\hsize=\textwidth
   \hb@xt@ \textwidth{{\strut\rightmark\ -- \leftmark\hfil}}
   \vskip 1.5\p@ \hrule}}%
  \def\@oddhead{\vbox{\hsize=\textwidth
   \hb@xt@ \textwidth{{\hfil\strut\rightmark\ -- \leftmark}}
   \vskip 1.5\p@ \hrule}}%
  \def\@evenfoot{\vbox{\hsize=\textwidth
   \hb@xt@ \textwidth{{\thepage\hfil}}}}%
  \def\@oddfoot{\vbox{\hsize=\textwidth
   \hb@xt@ \textwidth{{\hfil\thepage}}}}%
  \def\chaptermark##1{}
  \def\sectionmark##1{}}
\else
 \def\ps@dictheadings{\let\@mkboth\@gobbletwo
  \def\@evenhead{}%
  \def\@oddhead{\vbox{\hsize=\textwidth
   \hb@xt@ \textwidth{{\hfil\strut\rightmark\ -- \leftmark}}
   \vskip 1.5\p@ \hrule}}%
  \def\@evenfoot{}%
  \def\@oddfoot{\vbox{\hsize=\textwidth
   \hb@xt@ \textwidth{{\hfil\thepage\hfil}}}}%
  \def\chaptermark##1{}%
  \def\sectionmark##1{}}
\fi
\raggedbottom

\setlength{\headheight}{1.25\baselineskip}


\ifsinglelanguage
  \setlength{\leftfield}{\textwidth}
  \setlength{\rightfield}{0pt}
\else
  \setlength{\leftfield}{0.45\textwidth}
  \setlength{\rightfield}{0.45\textwidth}
\fi
\setlength{\dictindent}{1em}
\addtolength{\leftfield}{-\dictindent}
\addtolength{\rightfield}{-\dictindent}

\newcommand{\dictentry}[8]{
\hspace{\dictindent}%
 \parbox[t]{\leftfield}
   {\raggedright \hspace{-\dictindent}{\textbf{#1} }%
   \ifkeywordonly
   \else
     \ifphonetic
       {#2 }
     \fi
     \ifgrammar
       {\textit{#3} }
     \fi
    {#4\par}
   \fi
   }  
 \hfill%
\ifsinglelanguage
\else
   \parbox[t]{\rightfield}
     {\raggedright \hspace{-\dictindent}{\textbf{#5} }%
     \ifkeywordonly
     \else
       \ifphonetic
         {#6 }
       \fi
       \ifgrammar
         {\textit{#7} }
       \fi
      {#8\par}
     \fi  
     }
  \fi
\par
\markboth{#1}{#1}
}

\newcommand*{\dictchar}[1]{\goodbreak\vspace{1\baselineskip}%
  \parbox[t]{\leftfield}{%
    \centerline{\large\textbf{#1}}%
  \vspace{0.5\baselineskip}%
  }\par\nopagebreak%
}


\endinput
%% 
%% End of file `lexikon.sty'.