source: cv/moderncv.cls@ 361

Last change on this file since 361 was 222, checked in by Rick van der Zwet, 14 years ago

Update of CV latex package

File size: 17.8 KB
Line 
1%% start of file `moderncv.cls'.
2%% Copyright 2006-2010 Xavier Danaux (xdanaux@gmail.com).
3%
4% This work may be distributed and/or modified under the
5% conditions of the LaTeX Project Public License version 1.3c,
6% available at http://www.latex-project.org/lppl/.
7
8
9%-------------------------------------------------------------------------------
10% identification
11%-------------------------------------------------------------------------------
12\NeedsTeXFormat{LaTeX2e}
13\ProvidesClass{moderncv}[2010/08/03 v0.12 modern curriculum vitae document class]
14
15
16%-------------------------------------------------------------------------------
17% debugging
18%-------------------------------------------------------------------------------
19\newif\if@DEBUG\@DEBUGfalse
20
21
22%-------------------------------------------------------------------------------
23% class options
24%
25% (need to be done before the external package loading, for example because
26% we need \paperwidth, \paperheight and \@ptsize to be defined before loading
27% geometry and fancyhdr)
28%-------------------------------------------------------------------------------
29% paper size option
30\DeclareOption{a4paper}{
31 \setlength\paperheight{297mm}
32 \setlength\paperwidth{210mm}}
33\DeclareOption{a5paper}{
34 \setlength\paperheight{210mm}
35 \setlength\paperwidth{148mm}}
36\DeclareOption{b5paper}{
37 \setlength\paperheight{250mm}
38 \setlength\paperwidth{176mm}}
39\DeclareOption{letterpaper}{
40 \setlength\paperheight{11in}
41 \setlength\paperwidth{8.5in}}
42\DeclareOption{legalpaper}{
43 \setlength\paperheight{14in}
44 \setlength\paperwidth{8.5in}}
45\DeclareOption{executivepaper}{
46 \setlength\paperheight{10.5in}
47 \setlength\paperwidth{7.25in}}
48\DeclareOption{landscape}{
49 \setlength\@tempdima{\paperheight}
50 \setlength\paperheight{\paperwidth}
51 \setlength\paperwidth{\@tempdima}}
52
53% font size options
54\newcommand\@ptsize{}
55\DeclareOption{10pt}{\renewcommand\@ptsize{0}}
56\DeclareOption{11pt}{\renewcommand\@ptsize{1}}
57\DeclareOption{12pt}{\renewcommand\@ptsize{2}}
58
59% draft/final option
60\DeclareOption{draft}{\setlength\overfullrule{5pt}}
61\DeclareOption{final}{\setlength\overfullrule{0pt}}
62
63% nolmodern option
64\newif\if@lmodern\@lmoderntrue
65\DeclareOption{nolmodern}{\@lmodernfalse}
66
67% nocolor option
68\newif\if@color\@colortrue
69\DeclareOption{nocolor}{\@colorfalse}
70
71% CJK option
72%\newif\if@CJK\@CJKfalse
73%\DeclareOption{CJK}{\@CJKtrue}
74
75% execute default options
76\ExecuteOptions{a4paper,11pt,color,final}
77
78% process given options
79\ProcessOptions\relax
80\input{size1\@ptsize.clo}
81
82
83%-------------------------------------------------------------------------------
84% required packages
85%-------------------------------------------------------------------------------
86% \AtEndPreamble hook (loading tetoolbox instead of defining the macro, as to avoid incompatibilities with etoolbox (and packages relying on it) defining the macro too)
87\RequirePackage{etoolbox}
88%\let\@endpreamblehook\@empty
89%\def\AtEndPreamble{\g@addto@macro\@endpreamblehook}
90%\let\moderncv@document\document
91%\def\document{\endgroup\@endpreamblehook\begingroup\moderncv@document}
92
93% if... then... else... constructs
94\RequirePackage{ifthen}
95
96% latex vs pdflatex vs xelatex vs luatex compilation
97%\RequirePackage{ifpdf}
98
99% color
100\RequirePackage{color}
101
102% font encoding
103\RequirePackage[T1]{fontenc}
104
105% scalable Computer Modern fonts
106%\usepackage{type1cm}
107
108% latin modern fonts
109\if@lmodern
110 \RequirePackage{lmodern}\fi
111
112% symbols like \Telefon, \Mobilefone, \Letter and \Email
113\RequirePackage{marvosym}
114
115% extended characters of T1 in .ps + other guillemets
116%\RequirePackage{ae,aecompl,aeguill}
117
118% page geometry
119\addtolength{\oddsidemargin}{-54pt}
120\addtolength{\textwidth}{109pt}
121\addtolength{\topmargin}{-70pt}
122\addtolength{\textheight}{122pt}
123\addtolength{\marginparsep}{-5pt}
124\addtolength{\marginparwidth}{-10pt}
125
126% hyperrefs
127\RequirePackage{url}
128\urlstyle{tt}
129% load hyperred at the end of the preamble to pass options required by loaded packages (like CJK)
130\AtEndPreamble{
131 \@ifpackageloaded{CJK}
132 {\RequirePackage[CJKbookmarks]{hyperref}}
133 {\RequirePackage[pdftex]{hyperref}}
134 \AtBeginDocument{
135 \hypersetup{
136 breaklinks,
137 baseurl = http://,
138 pdfborder = 0 0 0,
139 pdfpagemode = UseNone,% do not show thumbnails or bookmarks on opening
140% pdfstartview = FitH,
141 pdfstartpage = 1,
142 pdfcreator = \LaTeX{} with `moderncv' package,
143 pdfproducer = \LaTeX{},
144 bookmarksopen = true,
145 pdfauthor = \@firstname~\@familyname,
146 pdftitle = \@title,
147 pdfsubject = \@firstname~\@familyname,
148 pdfkeywords = \@firstname~\@familyname{} curriculum vit\ae{}}}
149 \pagenumbering{arabic}% has to be issued after loading hyperref
150}
151
152% graphics
153\RequirePackage{graphicx}
154
155% headers and footers
156\RequirePackage{fancyhdr}
157\fancypagestyle{plain}{
158 \renewcommand{\headrulewidth}{0pt}
159 \renewcommand{\footrulewidth}{0pt}
160 \fancyhf{}}
161\pagestyle{plain}
162
163% compatibility package with older versions of moderncv
164\RequirePackageWithOptions{moderncvcompatibility}
165
166
167%-------------------------------------------------------------------------------
168% class definition
169%-------------------------------------------------------------------------------
170% minimal base settings
171\setlength\lineskip{1\p@}
172\setlength\normallineskip{1\p@}
173\renewcommand\baselinestretch{}
174\setlength{\parindent}{0pt}
175\setlength{\parskip}{0pt}
176\setlength\columnsep{10\p@}
177\setlength\columnseprule{0\p@}
178
179% TO BE TESTED
180%\setlength\arraycolsep{5\p@}
181%\setlength\tabcolsep{6\p@}
182%\setlength\arrayrulewidth{.4\p@}
183%\setlength\doublerulesep{2\p@}
184%\setlength\tabbingsep{\labelsep}
185%\setlength\fboxsep{3\p@}
186%\setlength\fboxrule{.4\p@}
187
188\pagestyle{empty}
189\raggedbottom
190\onecolumn
191
192
193%-------------------------------------------------------------------------------
194% style commands definitions
195%-------------------------------------------------------------------------------
196% symbols used
197\providecommand*{\listitemsymbol}{\Neutral}%{{\fontencoding{U}\fontfamily{ding}\selectfont\tiny\symbol{'102}}}
198\providecommand*{\addresssymbol}{}
199\providecommand*{\mobilesymbol}{\Mobilefone}
200\providecommand*{\phonesymbol}{\Telefon}
201\providecommand*{\faxsymbol}{\FAX}
202\providecommand*{\emailsymbol}{\Letter}
203\providecommand*{\homepagesymbol}{{\Large\ComputerMouse}}
204
205% colors
206\definecolor{firstnamecolor}{rgb}{0,0,0}
207\definecolor{familynamecolor}{rgb}{0,0,0}
208\definecolor{titlecolor}{rgb}{0,0,0}
209\definecolor{addresscolor}{rgb}{0,0,0}
210\definecolor{quotecolor}{rgb}{0,0,0}
211\definecolor{sectionrectanglecolor}{rgb}{0,0,0}
212\definecolor{sectiontitlecolor}{rgb}{0,0,0}
213\definecolor{subsectioncolor}{rgb}{0,0,0}
214\definecolor{hintcolor}{rgb}{0,0,0}
215
216% fonts
217\providecommand*{\firstnamefont}{}
218\providecommand*{\familynamefont}{}
219\providecommand*{\titlefont}{}
220\providecommand*{\addressfont}{}
221\providecommand*{\quotefont}{}
222\providecommand*{\sectionfont}{}
223\providecommand*{\subsectionfont}{}
224\providecommand*{\hintfont}{\small\sffamily}
225
226% styles
227\providecommand*{\firstnamestyle}[1]{{\firstnamefont\color{firstnamecolor}#1}}
228\providecommand*{\familynamestyle}[1]{{\familynamefont\color{familynamecolor}#1}}
229\providecommand*{\titlestyle}[1]{{\titlefont\color{titlecolor}#1}}
230\providecommand*{\addresstyle}[1]{{\addressfont\color{addresscolor}#1}}
231\providecommand*{\quotestyle}[1]{{\quotefont\color{quotecolor}#1}}
232\providecommand*{\sectionstyle}[1]{{\sectionfont\color{sectiontitlecolor}#1}}
233\providecommand*{\subsectionstyle}[1]{{\subsectionfont\color{subsectioncolor}#1}}
234\providecommand*{\hintstyle}[1]{{\hintfont\color{hintcolor}#1}}
235
236% themes: casual (default), classic, ...
237\newcommand*{\moderncvtheme}[2][]{
238 \def\@moderncvtheme{#2}
239 \def\@moderncvthemeoptions{#1}}
240\moderncvtheme{casual}% default theme
241\AtEndPreamble{\RequirePackage[\@moderncvthemeoptions]{moderncvtheme\@moderncvtheme}}
242
243
244%-------------------------------------------------------------------------------
245% structure commands definitions
246%-------------------------------------------------------------------------------
247\newcommand*{\firstname}[1]{\def\@firstname{#1}}
248\newcommand*{\familyname}[1]{\def\@familyname{#1}}
249\renewcommand*{\title}[1]{\def\@title{#1}}
250\newcommand*{\address}[2]{\def\@addressstreet{#1}\def\@addresscity{#2}}
251\newcommand*{\mobile}[1]{\def\@mobile{#1}}
252\newcommand*{\phone}[1]{\def\@phone{#1}}
253\renewcommand*{\fax}[1]{\def\@fax{#1}}
254\newcommand*{\email}[1]{\def\@email{#1}}
255\newcommand*{\homepage}[1]{\def\@homepage{#1}}
256\newcommand*{\extrainfo}[1]{\def\@extrainfo{#1}}
257\def\@photowidth{0pt}
258\newcommand*{\photo}[2][64pt]{\def\@photowidth{#1}\def\@photo{#2}}
259\newcommand*{\quote}[1]{\def\@quote{#1}}
260
261% length used by the moderncv layout
262% quote length
263\newlength{\quotewidth}
264% section lengths
265\newlength{\hintscolumnwidth}
266\newlength{\separatorcolumnwidth}
267\setlength{\separatorcolumnwidth}{0.025\textwidth}
268\newlength{\maincolumnwidth}
269% doubleitem lengths
270\newlength{\doubleitemmaincolumnwidth}
271% listitem lengths
272\newlength{\listitemsymbolwidth}
273\settowidth{\listitemsymbolwidth}{\listitemsymbol{}~}
274\newlength{\listitemmaincolumnwidth}
275% listdoubleitem lengths
276\newlength{\listdoubleitemmaincolumnwidth}
277% recompute all the lengths that depends on the text width
278\newcommand*{\recomputethemelengths}{}
279\newcommand*{\recomputelengths}{%
280 \setlength{\quotewidth}{0.65\textwidth}%
281 % main lenghts
282 \setlength{\maincolumnwidth}{\textwidth}%
283 \addtolength{\maincolumnwidth}{-\separatorcolumnwidth}%
284 \addtolength{\maincolumnwidth}{-\hintscolumnwidth}%
285 % listitem lengths
286 \setlength{\listitemmaincolumnwidth}{\maincolumnwidth}%
287 \addtolength{\listitemmaincolumnwidth}{-\listitemsymbolwidth}%
288 % doubleitem lengths
289 \setlength{\doubleitemmaincolumnwidth}{\maincolumnwidth}%
290 \addtolength{\doubleitemmaincolumnwidth}{-\hintscolumnwidth}%
291 \addtolength{\doubleitemmaincolumnwidth}{-\separatorcolumnwidth}%
292 \setlength{\doubleitemmaincolumnwidth}{0.5\doubleitemmaincolumnwidth}%
293 % listdoubleitem lengths
294 \setlength{\listdoubleitemmaincolumnwidth}{\maincolumnwidth}%
295 \addtolength{\listdoubleitemmaincolumnwidth}{-\listitemsymbolwidth}%
296 \setlength{\listdoubleitemmaincolumnwidth}{0.475\listdoubleitemmaincolumnwidth}%
297 % fancyhdr lengths
298 \renewcommand{\headwidth}{\textwidth}%
299 \recomputethemelengths}
300\setlength{\hintscolumnwidth}{0.15\textwidth}
301\recomputelengths
302
303% makes the cv title
304%\newcommand*{\maketitle}{}%
305\title{}% to avoid LaTeX complaining that \maketitle is a called without first a call to \title
306
307% draws a colored rectangle
308% usage: \colorrule[optional height]{width}
309%\newcommand*{\colorrule}[2][1ex]{{\color{sectionrectanglecolor}{\rule{#2}{#1}}}}
310
311% usage: \section{<title>}
312\newcommand*{\section}[1]{%
313 \vspace*{2.5ex}%
314 \parbox[m]{\hintscolumnwidth}{\raggedleft\hintfont{\color{sectionrectanglecolor}\rule{\hintscolumnwidth}{1ex}}}%
315 \phantomsection{}% reset the anchor for hyperrefs
316 \addcontentsline{toc}{part}{#1}%
317 \hspace{\separatorcolumnwidth}%
318 \parbox[m]{\maincolumnwidth}{\sectionstyle{#1}}%
319 \par\nobreak\vskip 1ex\@afterheading}% to avoid a pagebreak after the heading
320% starred variant, which is identical but defined to allow its use (e.g. for natbib compatibility, who uses \section*{} for the bibliography header)
321\AtEndPreamble{%
322 \@ifpackageloaded{natbib}
323 {
324 \RequirePackage{suffix}
325 \WithSuffix\newcommand\section*{\section}
326 }{}
327}
328
329% usage: \subsection{title}
330\newcommand*{\subsection}[1]{%
331 \begin{tabular}{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}%
332 \raggedleft\hintfont{} &{\subsectionstyle{#1}}%
333 \end{tabular}%
334 \par\nobreak\vskip 0.5ex\@afterheading}% to avoid a pagebreak after the heading
335% \phantomsection{}% reset the anchor for hyperrefs
336% \addcontentsline{toc}{chapter}{#1}% does not work, the bookmark is placed at the same level as sections (placed themselves at part level to be visible, as hyperref does not allow sections without parents...)
337
338% usage: \cvline{margintext}{linetext}
339\newcommand*{\cvline}[3][.25em]{%
340 \begin{tabular}{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}%
341 \raggedleft\hintfont{#2} &{#3}%
342 \end{tabular}\\[#1]}
343
344% usage: \cvdoubleitem{subtitle}{text}{subtitle}{text}
345\newcommand*{\cvdoubleitem}[4]{%
346 \cvline{#1}{\begin{minipage}[t]{\doubleitemmaincolumnwidth}#2\end{minipage}%
347 \hfill%
348 \begin{minipage}[t]{\hintscolumnwidth}\raggedleft\hintfont{#3}\end{minipage}\hspace*{\separatorcolumnwidth}\begin{minipage}[t]{\doubleitemmaincolumnwidth}#4\end{minipage}}}
349
350% usage: \cvlistitem[symbol]{point1}
351\newcommand*{\cvlistitem}[2][\listitemsymbol{}]{%
352 \cvline[0pt]{}{#1~\begin{minipage}[t]{\listitemmaincolumnwidth}#2\end{minipage}}}
353
354% usage: \cvlistdoubleitem[symbol]{point1}{point2}
355\newcommand*{\cvlistdoubleitem}[3][\listitemsymbol{}]{%
356 \cvline[0pt]{}{#1~\begin{minipage}[t]{\listdoubleitemmaincolumnwidth}#2\end{minipage}%
357 \hfill%
358 \ifthenelse{\equal{#3}{}}%
359 {}%
360 {#1~\begin{minipage}[t]{\listdoubleitemmaincolumnwidth}#3\end{minipage}}}}
361
362% usage: \cventry{years}{degree/job title}{institution/employer}{localization}{optionnal: grade/...}{optional: comment/job description}
363\newcommand*{\cventry}[6]{%
364 \cvline{#1}{%
365 {\bfseries#2}%
366 \ifthenelse{\equal{#3}{}}{}{, {\slshape#3}}%
367 \ifthenelse{\equal{#4}{}}{}{, #4}%
368 \ifthenelse{\equal{#5}{}}{}{, #5}%
369 .%
370 \ifx&#6&%
371 \else{\newline{}\begin{minipage}[t]{\linewidth}\small#6\end{minipage}}\fi%
372 }}%
373
374% usage (inside 'language' cvsection environment): \cvlanguage{name}{level}{comment}
375\newcommand*{\cvlanguage}[3]{%
376 \cvline{#1}{\begin{minipage}[t]{.225\maincolumnwidth}\textbf{#2}\end{minipage}\hfill\begin{minipage}[t]{0.725\maincolumnwidth}\raggedleft\footnotesize\itshape #3\end{minipage}}}
377
378% usage (inside 'computer skills' cvsection environment): \cvcomputer{category}{programs}{category}{programs}
379\newcommand*{\cvcomputer}[4]{%
380 \cvdoubleitem{#1}{\small#2}{#3}{\small#4}}
381
382% usage: \link[optional text]{link}
383\newcommand*{\link}[2][]{%
384 \ifthenelse{\equal{#1}{}}%
385 {\href{#2}{#2}}%
386 {\href{#2}{#1}}}
387
388% usage: \httplink[optional text]{link}
389\newcommand*{\httplink}[2][]{%
390 \ifthenelse{\equal{#1}{}}%
391 {\href{http://#2}{#2}}%
392 {\href{http://#2}{#1}}}
393
394% usage: \emaillink[optional text]{link}
395\newcommand*{\emaillink}[2][]{%
396 \ifthenelse{\equal{#1}{}}%
397 {\href{mailto:#2}{#2}}%
398 {\href{mailto:#2}{#1}}}
399
400% usage: \nopagenumbers{}
401\newif\if@displaypagenumbers\@displaypagenumberstrue
402\newcommand*{\nopagenumbers}{\@displaypagenumbersfalse}
403\AtEndPreamble{%
404\AtBeginDocument{%
405 \if@displaypagenumbers%
406 \@ifundefined{r@lastpage}{}{%
407 \ifthenelse{\pageref{lastpage} > 1}{%
408 \fancypagestyle{plain}{%
409 \fancyfoot[r]{\addressfont\color{quotecolor}\footnotesize\thepage/\pageref{lastpage}}}%
410 \pagestyle{plain}}{}}%
411 \AtEndDocument{\label{lastpage}}\else\fi}}
412
413% thebibliography environment, for use with BibTeX and possibly multibib
414\newcommand{\refname}{Publications}
415\newlength{\bibindent}
416\setlength{\bibindent}{1.5em}
417% bibliography item label
418\newcommand*{\bibliographyitemlabel}{}% use \@biblabel{\arabic{enumiv}} for BibTeX labels
419%\newif\if@multibibfirstbib\@multibibfirstbibfalse
420% bibliography head (section, etc}, depending on whether multibib is used
421\newcommand*{\bibliographyhead}[1]{\section{#1}}
422\AtEndPreamble{\@ifpackageloaded{multibib}{\renewcommand*{\bibliographyhead}[1]{\subsection{#1}}}{}}
423% thebibliography environment definition
424\newenvironment{thebibliography}[1]%
425 {%
426 \bibliographyhead{\refname}%
427 \small%
428 \begin{list}{\bibliographyitemlabel}%
429 {%
430 \setlength{\topsep}{0pt}%
431 \setlength{\labelwidth}{\hintscolumnwidth}%
432 \setlength{\labelsep}{\separatorcolumnwidth}%
433 \leftmargin\labelwidth%
434 \advance\leftmargin\labelsep%
435 \@openbib@code%
436 \usecounter{enumiv}%
437 \let\p@enumiv\@empty%
438 \renewcommand\theenumiv{\@arabic\c@enumiv}}%
439 \sloppy\clubpenalty4000\widowpenalty4000%
440% \sfcode`\.\@m%
441% \sfcode `\=1000\relax%
442 }%
443 {%
444 \def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}%
445 \end{list}%
446 }
447\newcommand\newblock{\hskip .11em\@plus.33em\@minus.07em}
448\let\@openbib@code\@empty
449
450% itemize, enumerate and description environment
451\setlength{\leftmargini} {1.2em}
452\leftmargin\leftmargini
453\setlength{\leftmarginii} {1em}
454\setlength{\leftmarginiii} {1.87em}
455\setlength{\leftmarginiv} {1.7em}
456\setlength{\leftmarginv} {1em}
457\setlength{\leftmarginvi} {1em}
458\setlength{\labelsep} {.5em}
459\setlength{\labelwidth} {\leftmargini}
460\addtolength{\labelwidth} {-\labelsep}
461\@beginparpenalty -\@lowpenalty
462\@endparpenalty -\@lowpenalty
463\@itempenalty -\@lowpenalty
464% itemize labels
465\newcommand\labelitemi{\listitemsymbol{}}
466\newcommand\labelitemii{{\large\bfseries-}}
467\newcommand\labelitemiii{\textperiodcentered}%{\textasteriskcentered}
468\newcommand\labelitemiv{\textperiodcentered}
469% enumerate labels
470\renewcommand\theenumi{\@arabic\c@enumi}
471\renewcommand\theenumii{\@alph\c@enumii}
472\renewcommand\theenumiii{\@roman\c@enumiii}
473\renewcommand\theenumiv{\@Alph\c@enumiv}
474\newcommand\labelenumi{\theenumi.}
475\newcommand\labelenumii{(\theenumii)}
476\newcommand\labelenumiii{\theenumiii.}
477\newcommand\labelenumiv{\theenumiv.}
478\renewcommand\p@enumii{\theenumi}
479\renewcommand\p@enumiii{\p@enumii(\theenumii)}
480\renewcommand\p@enumiv{\p@enumiii\theenumiii}
481% description label
482\newcommand*\descriptionlabel[1]{\hspace\labelsep\normalfont\bfseries#1}
483% hooks to adjust spacing (idea by Jakob SchiÞtz; see http://dcwww.camd.dtu.dk/~schiotz/comp/LatexTips/tweaklist.sty)
484\RequirePackage{tweaklist}% distributed with moderncv, not found on ctan and slightly modified
485\renewcommand*{\itemhook}{
486 \setlength{\topsep}{0pt}%
487 \setlength{\itemsep}{0pt}}
488\renewcommand*{\enumhook}{\itemhook{}}
489\renewcommand*{\deschook}{\itemhook{}}
490
491% classical \today definition
492\def\today{\ifcase\month\or
493 January\or February\or March\or April\or May\or June\or
494 July\or August\or September\or October\or November\or December\fi
495 \space\number\day, \number\year}
496
497
498\endinput
499
500
501%% end of file `moderncv.cls'.
Note: See TracBrowser for help on using the repository browser.