summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/fax/fax.cls
blob: 9e63f4fb9780606d2199f457a0106804b8bb461a (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
% (c) Copyright on FAX.CLS written by J.B.Rhebergen and J.H.M. de Jonge.
%
% You are allowed to make modification to this FAX.CLS and redistribute it
% under the following conditions:
%   1) You leave this top message intact.
%   2) You send me an updated version with your changes and an
%      explanation/motivation.
%   3) You ask no money for it.
%
% This document class comes with no waranty whatsoever! Comments and
% suggestion are most welcome.
%
% Mail me at: J.B.Rhebergen@ET.TUDelft.NL
%         or: rheberg@morra.et.tudelft.nl
%
% Happy Texing!
%
% Jan Rhebergen
%
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{fax}[1995/07/18 v1.0 by: J.B. Rhebergen & J.H.M. de Jonge]
\IfFileExists{lastpage.sty}{\RequirePackage{lastpage}}{%
  \typeout{Warning: I did not find lastpage.sty,
  use \string\setcounter{\string\faxpages}{..} instead!}}

\newif\if@note\@notefalse
\newif\if@topsep\@topseptrue

\newcommand*{\slsf}{\sffamily\slshape}
\newcommand*{\bsf}{\sffamily\bfseries}

\newcommand*{\@lstpgno}{%
  \@ifundefined{r@LastPage}{0}{%
    \expandafter\expandafter\expandafter
    \@cdr\csname r@LastPage\endcsname
    \@nil}%
}

\newcommand*{\@to}{\typeout{Warning: The \string{\to} command is not defined!}}
\newcommand*{\@from}{\IfFileExists{from.fax}{\input{from.fax}}{%
  \typeout{Warning: I did not find from.fax, use \string\from{..} in your document!}}}
\newcommand*{\@note}{\IfFileExists{note.fax}{\input{note.fax}}{%
  \typeout{Warning: I did not find note.fax, use \string\note{..} in your document!}}}
\newcommand*{\@fxtxt}{{\Large\sc Tele-Fax Message}}
\newcommand*{\@dtxt}{Date:}
\newcommand*{\@ntxt}{Note:}
\newcommand*{\@ptxt}{page}
\newcommand*{\@pptxt}{pages}

\newcommand*{\@nothing}{}
\newcommand*{\mymsg}[1]{\renewcommand*{\@fxtxt}{#1}}
\renewcommand*{\to}[1]{\renewcommand*{\@to}{#1}}
\newcommand*{\from}[1]{\renewcommand*{\@from}{#1}}
\newcommand*{\note}[1]{\renewcommand*{\@note}{#1}}

\DeclareOption{dutch}{
  \renewcommand*{\@from}{\IfFileExists{van.fax}{\input{van.fax}}{%
    \typeout{Warning: I did not find van.fax, use \string\from{..} in your document!}}}
  \renewcommand*{\@note}{\IfFileExists{nb.fax}{\input{nb.fax}}{%
    \typeout{Warning: I did not find nb.fax, use \string\note{..} in your document!}}}
  \renewcommand*{\@fxtxt}{{\Large\sc Fax Boodschap}}
  \renewcommand*{\@dtxt}{Datum:}
  \renewcommand*{\@ntxt}{NB:}
  \renewcommand*{\@ptxt}{pagina}
  \renewcommand*{\@pptxt}{paginas}}

\DeclareOption{note}{\@notetrue}
\DeclareOption{nosep}{\@topsepfalse}

\DeclareOption*{\IfFileExists{artikel3.cls}
                 {\PassOptionsToClass{\CurrentOption}{artikel3}}
                 {\PassOptionsToClass{\CurrentOption}{article}}}

\ProcessOptions

\IfFileExists{artikel3.cls}{\LoadClass{artikel3}}{%
\typeout{Warning: I did not find artikel3.cls, I loaded article.cls instead!}
\LoadClass{article}}

\newlength{\faxtopsep}
\setlength{\faxtopsep}{3ex}
\newcounter{faxpages}

\AtBeginDocument{
\sf
\newlength{\@framewd}
\setlength{\@framewd}{\textwidth}
\newlength{\@sep}
\setlength{\@sep}{0.5em}
\addtolength{\@framewd}{-0.5\@sep}
\newbox\@thin
\newbox\@frombx
\newbox\@tobx
\setbox\@frombx=\hbox{\@from}
\setbox\@tobx=\hbox{\@to}
\newdimen\@thinht
\newdimen\@thindp
\@thinht=\ht\@frombx
\@thindp=\dp\@frombx
\newdimen\@tmpdim
\@tmpdim=\ht\@tobx
\ifdim\@tmpdim>\@thinht
  \@thinht=\@tmpdim
\fi
\@tmpdim=\dp\@tobx
\ifdim\@tmpdim>\@thindp
  \@thindp=\@tmpdim
\fi
\setbox\@thin=\hbox{\vrule width 0mm height \@thinht depth \@thindp}
\begin{center}
\ifx\@fxtxt\@nothing\relax\else\@fxtxt\strut\\\fi
\framebox[0.5\@framewd][t]{\copy\@thin\copy\@tobx}\hfill%
\framebox[0.5\@framewd][t]{\copy\@thin\copy\@frombx}\\
\nointerlineskip
\vspace{0.5\@sep}
\framebox[0.5\@framewd]{{\bsf \@dtxt} \today\strut}\hfill
\ifcase\@lstpgno
    \framebox[0.5\@framewd]{{\bsf Fax:} \thefaxpages\ page(s)\strut}\\
  \or
    \framebox[0.5\@framewd]{{\bsf Fax:} \pageref{LastPage} \@ptxt\strut}\\
  \else
    \framebox[0.5\@framewd]{{\bsf Fax:} \pageref{LastPage} \@pptxt\strut}\\
  \fi
\if@note
    \nointerlineskip
    \vspace{0.5\@sep}
    \addtolength{\@framewd}{-1em}
    \framebox[\textwidth][c]{\hfill
    \begin{minipage}{\@framewd}\fbox{\small\bsf \@ntxt} \@note\strut\hfill
    \end{minipage}\hfill}
  \fi
\end{center}
\if@topsep\vspace{\faxtopsep}\fi
}