summaryrefslogtreecommitdiffstats
path: root/lisp/bbdb/tex/bbdb.sty
blob: eec763ec8637d8dbe24006de64c3d3991fa1bd24 (plain) (blame)
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
% bbdb.sty --- basic LaTeX style for TeXing BBDB
%
% Copyright (C) 2017  Free Software Foundation, Inc.
%
% This file is part of the Insidious Big Brother Database (aka BBDB),
%
% BBDB 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 3 of the License, or
% (at your option) any later version.
%
% BBDB 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 BBDB.  If not, see <http://www.gnu.org/licenses/>.

%% Commentary:
%
% This file defines a basic LaTeX style for TeXing BBDB.

\def\bbdb@name#1#2{\textbf{#2, #1}}
\def\bbdb@organization#1{#1}
\def\bbdb@affix#1{\emph{affix:} #1}
\def\bbdb@aka#1{\emph{aka:} #1}
\def\bbdb@phone#1#2{\emph{#1:} #2}
\def\bbdb@mail#1#2{\ifx\href\undefined
    \texttt{#2}%
  \else
    \href{mailto:#1}{\texttt{#2}}%
  \fi}
\def\bbdb@address#1#2{\emph{#1:} #2}
\def\bbdb@xfield#1#2{\emph{#1:} #2}

% \def\bbdb@separator#1{\hline}
\def\bbdb@separator#1{\\\hline
\multicolumn{\LT@cols}{@{}c@{}}{\hrulefill\ #1\rule{0pt}{2.2ex}\ \hrulefill}\\}

\RequirePackage{longtable}
\newenvironment{bbdb}[1]{%
\let\name\bbdb@name
\let\organization\bbdb@organization
\let\affix\bbdb@affix
\let\aka\bbdb@aka
\let\phone\bbdb@phone
\let\mail\bbdb@mail
\let\address\bbdb@address
\let\xfield\bbdb@xfield
\let\bbdbseparator\bbdb@separator
\begin{longtable}[l]{@{}#1@{}}}%
{\\ \hline \multicolumn{\LT@cols}{c}{Printed \today}\\ \hline\end{longtable}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def\bbdbrecord@name#1#2{{\raggedright\textbf{#2, #1}\dotfill\par}}
\def\bbdbrecord@organization#1{#1\par}
\def\bbdbrecord@affix#1{\bbdbrecord@par{\emph{affix:} #1}}
\def\bbdbrecord@aka#1{\bbdbrecord@par{\emph{aka:} #1}}
\def\bbdbrecord@phone#1#2{\hspace*{\fill}\emph{#1:} #2\par}
\def\bbdbrecord@mail#1#2{\ifx\href\undefined
    \texttt{#2}%
  \else
    \href{mailto:#1}{\texttt{#2}}%
  \fi\par}
\def\bbdbrecord@par#1{{\leftskip 1em\parindent -\leftskip#1\par}}
\def\bbdbrecord@address#1#2{\bbdbrecord@par{\emph{#1:} #2}}
\def\bbdbrecord@xfield#1#2{\bbdbrecord@par{\emph{#1:} #2}}

\newenvironment{bbdbrecord}{%
\smallbreak
\parskip 0pt
\parindent 0pt
\let\name\bbdbrecord@name
\let\organization\bbdbrecord@organization
\let\affix\bbdbrecord@affix
\let\aka\bbdbrecord@aka
\let\phone\bbdbrecord@phone
\let\mail\bbdbrecord@mail
\let\address\bbdbrecord@address
\let\xfield\bbdbrecord@xfield}{\medbreak}

\newcommand*{\bbdbseparator}[1]{\vspace{3ex}\noindent
  \fbox{\parbox{\dimexpr\linewidth-2\fboxrule-2\fboxsep}%
               {\centering\textbf{#1}}}%
  \vspace{1ex}}

% \endinput % Fails when inlining this file.