-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmathphysletter.dtx
More file actions
284 lines (260 loc) · 9.69 KB
/
mathphysletter.dtx
File metadata and controls
284 lines (260 loc) · 9.69 KB
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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
% \iffalse
%% File: mathphysletter.dtx by Arno Trautmann, mail: arno dot trautmann at gmx dot de
%<*driver>
\def\nameofplainTeX{plain}
\ifx\fmtname\nameofplainTeX\else
\expandafter\begingroup
\fi
\input docstrip.tex
\askforoverwritefalse
\preamble
EXPERIMENTAL CODE
Do not distribute this file without also distributing the
source files specified above.
Do not distribute a modified version of this file under the same name.
\endpreamble
\postamble
\endpostamble
\keepsilent
\generate{\file{mathphysletter.cls}{\from{mathphysletter.dtx}{class}}}
\ifx\fmtname\nameofplainTeX
\expandafter\endbatchfile
\else
\expandafter\endgroup
\fi
\ProvidesFile{mathphysletter.cls}
[22.04.2012 v0.a ––]
\documentclass[english]{ltxdoc}
\usepackage{
babel,
fontspec, %% the documentation must by typeset with LuaLaTeX. period.
graphicx,
ifluatex,
hyperref,
xcolor
}
\hypersetup{
pdfborder= 0 0 0,
colorlinks=true,
linkcolor=blue,
filecolor=blue
}
\setmainfont{Linux Libertine}
\title{The \textsf{mathphysletter} class\\[2ex] \normalsize or: letters in the style of the university of Heidelberg}
\author{Arno L. Trautmann\thanks{arno.trautmann@gmx.de}}
\begin{document}
\maketitle
\begin{abstract}
With the |mathphysletter| class, members of the mathphys-FS of Heidelberg can write letters in the corporate design of the university.\footnote{\url{http://www.uni-heidelberg.de/intern/cd/manual.html}} The user interface tries to be very easy and intuitive.
\end{abstract}
\section{Important Notes}
To use this class, please read section \ref{UI}: User Interface carefully. This class must be compiled with Lua\LaTeX. If you don’t know about Lua\LaTeX\ and how to use it, feel free to contact the author. You need to have the file |unilogo.jpg| in the folder you’re operating in! Maybe the path will change, but you need the picture to successfully compile your document. The fonts |Goudy Old Style| and |Arial Regular|\footnote{Maybe these fonts have different names on your operating system. Please contact the author if you notice any problems regarding fonts.} are used. If you don’t have this font, please contact the author or say |\documentclass[freefonts]{mathphysletter}|. Then the |lmodern| fonts will be used for the whole document.
\newpage\tableofcontents
\section{User Interface}\label{UI}
At the moment, there are 9 commands for the user. The red commands have to be used in the preamble; the black ones must \emph{not} be used in the preamble! See section \ref{example} for an example.\def\red{\color{red}}
\begin{itemize}
\item[\red|Empfänger|] This is the ”to“-field of the letter. Use |\\| to separate the lines.
\item[\red|Anrede|] This is used for the opening, like |\Anrede{Sehr geehrte Damen und Herren,}|
\item[\red|Ansprechperson|] The contact person in the right column under the entry ”Ansprechperson“.
\item[\red|Email|] The e-mail address of this person.
\item[|Rückadresse|] The content of the “backaddress“-field. Default is the address of the FSK.
\item[|Gruß|] Sets a greeting under the letter. Please use it at the place in the document where it belongs. Do not set this one or the following commands into the preamble!
\item[|PS|] For a post scriptum.
\item[|Anlagen|] Enclosings.
\item[|Kopie|] cc to other persons.
\end{itemize}
Please notize that these commands are case-sensitive!
That’s everything a normal user has to know about this class. The following section describes the implementation. Section \ref{example} gives an example how to use this class.
\section{Implementation}
\DocInput{mathphysletter.dtx}
\end{document}
%</driver>
%
%<*class>
% \fi
% \subsection{Preamble Settings}
% |xkeyval| is needed to define some keys for the layout. Not yet used, but necessary in the future.\\
% |scrlttr2| is used to produce the letters. Loading of packages and passing of options:
% \begin{macrocode}
\RequirePackage{xkeyval}
\newif \iffreefonts
\newif \ifbiolinum
\freefontsfalse
\biolinumfalse
\DeclareOptionX{freefonts}{\freefontstrue}
\DeclareOptionX{nicefonts}{\freefontstrue} %% ok, Libertine /is/ a good font, so these are synonyms
\DeclareOptionX{biolinum}{\biolinumtrue} %% for goudy plus Libertine instead of Arial
\ProcessOptionsX
\LoadClass[ngerman]{scrlttr2}
\RequirePackage{
babel,
geometry,
graphicx,
marginnote,
scrpage2,
xcolor,
fontspec
}
%% setting the fonts.
%% default is: main font = sans font = Arial (which is ugly) plus goudy for roman
%% nice/free is: main font = sans font = Biolinum, plus Libertine for rm
%% „biolinum“ is: main font = sans font = Biolinum, plus goudy for roman
%%
%% so we set up the fonts as meant, using main and sans. then we say that main is sans and call rm explicitely …
\iffreefonts
\setmainfont{Linux Libertine}
\setsansfont{Linux Biolinum}
\else %% then its either default or biolinum
\setmainfont{Goudy-Old-Style}
\ifbiolinum
\setsansfont{Linux Biolinum}
\else
\setsansfont{Arial} %% default, sadly …
\fi
\fi
% \end{macrocode}
% We need heavy use of |geometry| to achieve the layout:
% \begin{macrocode}
\geometry{
top=60.5mm,
headheight=30mm,
%headsep=50mm,
headsep=0mm,
bottom=45mm,
right=68mm,
marginparsep=19mm,
marginpar=65mm,
bindingoffset=0mm,
left=25mm,
}
% \end{macrocode}
% \subsection{The Right Column}
% The right column is set using the following command. If |freefonts| is not set, it is written using Goudy-Old-Style font, else lmodern will be used.
% \begin{macrocode}
\def\unired{
\color[rgb]{
0.650980392157,
0.207843137255,
0.18431372549
}
}
%% FIXME: This should be variable.
% first suggestion: give optional arguments to the macro
% the default would then be the MP fachschaft
\newcommand\mathphysaddr{\small
\iffreefonts
\rmfamily
\else
\fontspec{Goudy-Old-Style}
\fi
\fontsize{9pt}{13pt}\selectfont
Fachschaft MathPhys\\
Im Neuenheimer Feld 305\\
D-69120 Heidelberg\\ \\
Fon: +49(0)\,62\,21/54\,24\,56\\
Fax: +49(0)\,62\,21/54\,24\,57\\ \\
E-Mail:\\
fachschaft@mathphys.\\fsk.uni-heidelberg.de\vspace{24mm}\\
\today
\\ \\
Ansprechperson \\
\Ansprech\\ \\
E-Mail\\
\EMail
}
% \end{macrocode}
% \subsection{Page Layout}
% We put the university-logo on the upper right. The date is set seperately in the right column, so we don’t need it in the class itself.
% \begin{macrocode}
\date{}
\pagestyle{scrheadings}
\ihead{\hspace*{80mm}\includegraphics[height=45mm]{unilogo}}
\setheadwidth[0pt]{text}
\setfootwidth{text}
\cfoot{}
\ifoot{\vspace*{-15mm}\\\hspace*{121mm}
\mbox{\rm\fontsize{9pt}{13pt}
\iffreefonts\else
\fontspec{Goudy-Old-Style}
\fi\linethickness{.3mm}
\put(0,0){\unired\line(0,-1){80}}
\put(0,0){\unired\line(0,1){9}}
\hspace*{3mm}
Seite \thepage}
}
% \end{macrocode}
% \subsection{Macros for User Interaction}
% The following macros are defined for user interaction. See section User Interface.
% Attention: |\ZweiteSeite| does not work so far! Has to be fixed.
% \begin{macrocode}
\newcommand\Empfänger[1]{\def\Empf{#1}}
\newcommand\Anrede[1]{\def\Anre{#1}}
\newcommand\Ansprechperson[1]{\def\Ansprech{#1}}
\newcommand\Email[1]{\def\EMail{#1}}
\newcommand\ZweiteSeite{\endoffirstpage}
\def\endoffirstpage{\pagebreak}
\setkomavar{backaddress}{Universität Heidelberg Fachschaftskonferenz
Albert-Überle-Straße 3-5 69120 Heidelberg}
\newcommand\Rückadresse[1]{\setkomavar{backaddress}{#1}}
\newcommand\Gruß[1]{\closing{#1}}
\newcommand\PS[1]{\ps{#1}}
\newcommand\Anlage[1]{\setkomavar*{enclseparator}{Anlage}\encl{#1}}
\newcommand\Anlagen[1]{\setkomavar*{enclseparator}{Anlagen}\encl{#1}}
\newcommand\Kopie[1]{\cc{#1}}
% \end{macrocode}
% And that’s it for the preamble.
%
% As the letter should be typeset automatically, the |\begin{letter}{}| and |\opening{}| are set automatically. The command |\thispagestyle{scrheadings}| is needed because |scrlttr2| defines another pagestyle for the first page. |\ofoot{}| suppresses the pagenumber for the first page.
%
% If |freefonts| is set, |lmodern| is the default font of the document. Else Arial will be used; both are set in 10pt with 13pt skip.
% \begin{macrocode}
\renewcommand\familydefault{\sfdefault}
\iffreefonts
\relax
\else
\setsansfont{Arial}
\setkomafont{backaddress}{\fontspec{Goudy-Old-Style}}
\setkomafont{addressee}{\fontspec{Goudy-Old-Style}} %% yes, the komafont is addressee with two "e"!
\fi
\AtBeginDocument{
\fontsize{10}{13}\selectfont
\begin{letter}{\Empf}
\opening{\Anre}
\thispagestyle{scrheadings}
\marginnote{\hspace*{-12mm}
\begin{minipage}{\marginparwidth}\vspace*{-30mm}\mathphysaddr\end{minipage} %%-39.5mm-13pt %% blind correction from -55mm to -30mm as suggested by Stefan
}
}
% \end{macrocode}
% At the end of the document, the letter is closed.
% \begin{macrocode}
\AtEndDocument{
\end{letter}
}
% \end{macrocode}
% And that’s it. Happy \TeX{}ing!
% \newpage\section{Example Document}
% \label{example}
% This is a short document showing the usage of the |mathphysletter| class.
% \begin{verbatim}
% \documentclass[ngerman,freefonts]{mathphysletter} %The language must be given!
% \usepackage{mypackage} % load whatever special package you need
% \Empfänger{An \\ Die kleine Hexe \\ Blocksberg 7 \\ 666 Blocksberghausen}
% \Ansprechperson{Die große Hexe}
% \Email{grosse.hexe@blocksmail.org}
% \Anrede{Liebe kleine Hexe!}
% \begin{document}
% Können wir dich dieses Jahr wieder besuchen? Ich freue mich schon sehr auf
% die tolle Feier. Fritz will dir auch noch schreiben, aber auf der nächsten
% Seite. \ZweiteSeite
% Hallo Hexe!\\
% Ich bin’s, der Fritz. Freue mich, dich wieder zu sehen! Die Einladung für
% meinen Geburtstag habe ich beigelegt.
%
% \Gruß{Lieben Gruß\\ Fritz}
% \PS{ps: Auch von der großen Hexe}
% \Anlage{Einladung zu Fritz’ Geburtstag}
% \end{document}
% \end{verbatim}
% \Finale
% \endinput