]> git.lyx.org Git - lyx.git/blob - lib/tex/cv.cls
fix typo that put too many include paths for most people
[lyx.git] / lib / tex / cv.cls
1 %%%% This is the cv document class, intended to provide a simple way
2 %%%% to write your curriculum vitaes (resume)
3 %%%% Author: Jean-Marc Lasgouttes (Jean-Marc.Lasgouttes@inria.fr) 
4 %%%%   (with lot of help from Amir Karger <karger@bead.aecom.yu.edu>,
5 %%%%                      Reuben Thomas <rrt@dcs.gla.ac.uk>
6 %%%%                      and Dekel Tsur <dekelts@tau.ac.il>)
7 %%%% WARNING: this document class is really simple. Don't expect too much.
8 %%%% You can do what you want with this code.
9 %%
10 %%% Basic usage:
11 %% \leftheader{text} : defines what should appear in the upper
12 %%      left of the first page. `Text' may contain \\ to break lines.
13 %% \rightheader{text} : like \leftheader, but for the upper right of
14 %%      the first page
15 %% \title{text} : defines a title, will will appear centered below the
16 %%                headers (or above, if the `titleabove' option is used)
17 %% \maketitle: actually typesets the header. 
18 %%
19 %% \section{text} : gives a title for a new topic of the CV. 
20 %%
21 %% `topic' environment: begins an itemize-like environment where the
22 %%   argument of \item[] is typeset in font \itemfont. A line break is
23 %%   automatically inserted if the label is too long to fit in the
24 %%   margin (this can be controlled by option `notopicbreak'). 
25 %%
26 %% The cv document class also has some support for bibliography. 
27 %% You can use the `thebibliography' environment as usual, in
28 %% particular wih BibTeX . The output is similar to the `topic' 
29 %% environment. If you separate your bibliography into several
30 %% sections, you may want to use the `contbibnum' document class
31 %% option. 
32 %%
33 %% Note that this class also has support for right-to-left languages,
34 %% such as hebrew (courtesy Dekel Tsur).
35 %%
36 %% The document class accepts some options (along with the usual
37 %% article.cls options): 
38 %%   sf            (default) produce title and headers in sans serif fonts
39 %%   plain         produce all output in roman fonts. 
40 %%   notopicbreak  do not add a line break after longtopic labels.
41 %%   contbibnum    let the numbering of bibliography items be
42 %%                 continuous when there are several thebibliography
43 %%                 environments 
44 %%   titleabove    output the title above the left and right headers,
45 %%                 not below
46 %%
47 %% You can also modify directly the fonts used in the document be
48 %% using the following macros. They take one parameter which is the font
49 %% changing command.
50 %% \headerfont: the font used in both headers.
51 %%              Defaults to sans serif.
52 %% \titlefont:  the font used for the title.
53 %%              Defaults to \LARGE sans-serif semi bold condensed.
54 %% \sectionfont: the font used by \section when beginning a new topic.
55 %%              Defaults to sans-serif semi bold condensed.
56 %% \subsectionfont: the font used by \subsection when beginning a new
57 %%              topic. 
58 %%              Defaults to sans-serif semi bold condensed.
59 %% \itemfont:   the font used in descriptions of items.
60 %%              Defaults to sans-serif slanted.
61 %%
62 %% You can modify the following parameters using \renewcommand:
63 %% \topicmargin: the left margin inside topics.
64 %%               Defaults to 20% of the text width (0.20\textwidth).
65
66 %%% CHANGES:
67 %% - 1.0 1998/03/23: First public release.
68 %% - 1.1 1998/11/06: Better documentation, in order to release it for
69 %%   LyX ,added \refname, disabled all sectionning commands other that
70 %%   \section, disabled numbering of sections.
71 %% - 1.2 1998/12/01: 
72 %%      * Refined the algorithm to display the headers. In
73 %%        particular, \leftheader and \rightheader do not exist
74 %%        anymore. 
75 %%      * Changed the justification of items labels 
76 %%   [Thanks to Amir Karger <karger@bead.aecom.yu.edu> for the two
77 %%    changes above]
78 %%      * Added command \title
79 %%      * Changed the semantics of \topicfont and \itemfont, and added
80 %%        \titlefont and \headerfont
81 %%
82 %% - 1.3 1999/02/09:
83 %%      * The thebibliography environment does not add a section by
84 %%        itself anymore. This means that you can/should add your own
85 %%        and that \refname does not exist anymore.
86 %%        [Thanks to Reuben Thomas for the idea]
87 %%      * Added support for subsections (with associated font command
88 %%        \subsectionfont).
89 %%      * Added class options `sf' and `plain'. 
90 %% - 1.4 2001/05/04
91 %%      * Added `notopicbreak' class option.
92 %% - 1.5 2001/06/18
93 %%      * Added hebrew support (from Dekel Tsur).
94 %%      * \topicmargin is now a macro and defaults to 20% of text width.
95 %%      * Added `contbibnum' class option.
96 %%      * Added `titleabove' class option.
97 %%      * some variables renaming and cleanups.
98
99
100 %% Basic definition to have a real LaTeX document class
101 \NeedsTeXFormat{LaTeX2e} 
102 \ProvidesClass{cv}[2001/06/18 Curriculum vitae version 1.5] 
103
104 %% The fonts used in the layout
105 \newcommand{\sectionfont}[1]{\def\cv@sec@fnt{#1}}
106 \newcommand{\subsectionfont}[1]{\def\cv@ssec@fnt{#1}}
107 \newcommand{\itemfont}[1]{\def\cv@it@fnt{#1}}
108 \newcommand{\headerfont}[1]{\def\cv@hd@fnt{#1}}
109 \newcommand{\titlefont}[1]{\def\cv@tit@fnt{#1}}
110
111 % Some document class options.
112 \DeclareOption{sf}{
113   \sectionfont{\sffamily\fontseries{sbc}\selectfont}
114   \subsectionfont{\sffamily\fontseries{sbc}\selectfont}
115   \itemfont{\sffamily\slshape}
116   \headerfont{\sffamily}
117   \titlefont{\sffamily\fontseries{sbc}\selectfont\LARGE}
118 }
119 \DeclareOption{plain}{
120   \sectionfont{\bfseries}
121   \subsectionfont{\bfseries}
122   \itemfont{\itshape}
123   \headerfont{}
124   \titlefont{\bfseries\LARGE}
125 }
126 \newif\if@cv@topic@break \@cv@topic@breaktrue
127 \DeclareOption{notopicbreak}{
128   \@cv@topic@breakfalse
129 }
130 \newif\if@cv@cont@bib@num \@cv@cont@bib@numfalse
131 \DeclareOption{contbibnum}{
132   \@cv@cont@bib@numtrue
133   \newcounter{cv@save@bib@num}
134 }
135 \newif\if@cv@title@above \@cv@title@abovefalse
136 \DeclareOption{titleabove}{
137   \@cv@title@abovetrue
138 }
139 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
140 \ExecuteOptions{sf,letterpaper,10pt,oneside,onecolumn,final}
141 \ProcessOptions
142 \LoadClass{article}
143
144 % Support for RTL (Hebrew). This will be defined and set by babel for
145 % RtL languages, but we define it here for the benefit of others.
146 \newif\if@rl
147
148 %% stuff needed for the header
149 \newcommand{\leftheader}[1]{\def\cv@lh{#1}}
150 \newcommand{\rightheader}[1]{\def\cv@rh{#1}}
151 \renewcommand{\title}[1]{\def\cv@tit{#1}}
152 % Default to empty.
153 \leftheader{}\rightheader{}\title{}
154 % And now a command to actually show the headers
155 \newcommand{\cv@header}[1]{%
156           \if@rl%
157             \begin{tabular}[t]{@{\cv@hd@fnt\beginR}l@{\endR}}%
158           \else%
159             \begin{tabular}[t]{@{\cv@hd@fnt}l@{}}%
160           \fi%
161               #1%
162           \end{tabular}}
163 \newcommand{\cv@do@title}{\par\bigskip
164         \begin{center} \cv@tit@fnt\cv@tit\end{center}}
165 \renewcommand{\maketitle}{%
166         \if@cv@title@above\cv@do@title\fi
167         \par\noindent%
168         \begin{tabular*}{\textwidth}{@{}l@{\extracolsep{\fill}}l@{}}
169         \cv@header{\cv@lh}&\cv@header{\cv@rh}
170         \end{tabular*}
171         \par
172         \if@cv@title@above\else\cv@do@title\fi
173         \bigskip\par}
174
175 %% Redefine \section to use \cv@sec@fnt
176 \renewcommand{\section}{
177   \@startsection{section}{1}{\z@}
178        {-3.5ex \@plus -1ex \@minus -.2ex}
179        {2.3ex \@plus .2ex}{\cv@sec@fnt}}
180 \renewcommand{\subsection}{
181   \@startsection{subsection}{1}{3em}
182        {-3.5ex \@plus -1ex \@minus -.2ex}
183        {2.3ex \@plus .2ex}{\cv@ssec@fnt}}
184 % the other ones do not exist.
185 \let\subsubsection=\relax 
186 \let\paragraph=\relax  \let\subparagraph=\relax
187 % we do not want any numbering
188 \setcounter{secnumdepth}{0}
189
190 %% Define the topic environment
191 % The left margin for topics
192 \newcommand{\topicmargin}{0.20\textwidth}
193 \newlength{\t@picmargin}
194 % The label stuff
195 \newcommand{\@topic@makelabel}[1]{\cv@it@fnt #1\hfill}
196 \let\@topic@old@item=\@item
197 \newlength{\topic@label@length}
198 \def\@topic@item[#1]{%
199         \if@cv@topic@break%
200                 \settowidth{\topic@label@length}{#1}%
201                 \@topic@old@item[#1]%
202                 \ifdim\topic@label@length>\labelwidth\mbox{}\\*\fi%
203         \else%
204                 \@topic@old@item[#1]%
205         \fi}
206 \newcommand{\@topic@setup}{%
207         \setlength{\t@picmargin}{\topicmargin}
208         \if@rl%
209           \setlength{\leftmargin}{0cm}%
210           \setlength{\rightmargin}{\t@picmargin}%
211         \else%
212           \setlength{\leftmargin}{\t@picmargin}%
213           \setlength{\rightmargin}{0cm}%
214         \fi%
215         \setlength{\labelwidth}{0.8\t@picmargin}%
216         \let\makelabel=\@topic@makelabel}
217 \newenvironment{topic}
218         {\list{}
219               { \@topic@setup%
220                 \let\@item=\@topic@item}}
221         {\endlist}
222
223 %% Redefine the thebibliography environment to look like the topic
224 %% environment. The argument of thebibliography is ignored
225 \renewenvironment{thebibliography}[1]
226  {\list{\@biblabel{\theenumiv}}{%
227         \@topic@setup%
228         \@openbib@code%
229         \usecounter{enumiv}%
230         \let\p@enumiv\@empty%
231         \renewcommand\theenumiv{\@arabic\c@enumiv}}%
232         \if@cv@cont@bib@num%
233           \setcounter{enumiv}{\value{cv@save@bib@num}}%
234         \fi%
235   \sloppy \clubpenalty 4000 \widowpenalty 4000 \sfcode`\.=\@m}%
236  {\endlist%
237   \if@cv@cont@bib@num%
238     \setcounter{cv@save@bib@num}{\value{enumiv}}%
239   \fi}