source: cv/moderncv.cls@ 120

Last change on this file since 120 was 2, checked in by Rick van der Zwet, 15 years ago

Initial import of data of old repository ('data') worth keeping (e.g. tracking
means of URL access statistics)

File size: 15.2 KB
Line 
1%% start of file `moderncv.cls'.
2%% Copyright 2007 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}[2007/05/28 v0.6 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% execute default options
72\ExecuteOptions{a4paper,11pt,color,final}
73
74% process given options
75\ProcessOptions\relax
76\input{size1\@ptsize.clo}
77
78
79%-------------------------------------------------------------------------------
80% required packages
81%-------------------------------------------------------------------------------
82% ifthen package
83\RequirePackage{ifthen}
84
85% ifpdf package
86\RequirePackage{ifpdf}
87
88% color package
89\ifpdf
90 \RequirePackage[pdftex]{color}
91\else
92 \RequirePackage[dvips]{color}
93\fi
94
95% fontenc package
96\RequirePackage[T1]{fontenc}
97
98% scalable Computer Modern fonts
99%\usepackage{type1cm}
100
101% latin modern fonts
102\AtEndOfClass{%
103 \if@lmodern
104 \RequirePackage{lmodern}\fi}
105
106% symbols like \Telefon, \Mobilefone, \Letter and \Email
107\RequirePackage{marvosym}
108
109% extended characters of T1 in .ps + other guillemets
110%\RequirePackage{ae,aecompl,aeguill}
111
112% page geometry
113\addtolength{\oddsidemargin}{-54pt}
114\addtolength{\textwidth}{109pt}
115\addtolength{\topmargin}{-70pt}
116\addtolength{\textheight}{122pt}
117\addtolength{\marginparsep}{-5pt}
118\addtolength{\marginparwidth}{-10pt}
119
120% hyperrefs
121\RequirePackage{url}
122\ifpdf
123 \RequirePackage[pdftex]{hyperref}
124\else
125 \RequirePackage[dvips]{hyperref}\fi
126\AtEndOfClass{%
127 \AtBeginDocument{%
128 \hypersetup{%
129 breaklinks,
130 baseurl = http://,
131 pdfborder = 0 0 0,
132 pdfpagemode = None,
133 pdfstartview = XYZ,
134 pdfstartpage = 1,
135 pdfauthor = \@firstname~\@familyname,%
136 pdftitle = \@title,%
137 pdfsubject = \@firstname~\@familyname,%
138 pdfkeywords = \@firstname~\@familyname{} curriculum vit\ae{},%
139 pdfcreator = \LaTeX{} with `moderncv' package,%
140 pdfproducer = \LaTeX}}}
141\urlstyle{tt}
142
143% tables that split across multiple pages
144\RequirePackage[]{longtable}
145% spacing between sections
146\setlength{\LTpre}{\smallskipamount}
147\setlength{\LTpost}{\smallskipamount}
148\setlength{\LTleft}{0pt}
149\setlength{\LTright}{0pt}
150
151% graphics
152\ifpdf
153 \RequirePackage[pdftex]{graphicx}
154\else
155 \RequirePackage[dvips]{graphicx}\fi
156
157% headers and footers
158\usepackage{fancyhdr}
159\fancypagestyle{plain}{%
160 \renewcommand{\headrulewidth}{0pt}
161 \renewcommand{\footrulewidth}{0pt}
162 \fancyhf{}}
163\pagestyle{plain}
164
165% compatibility package with older versions of moderncv
166\RequirePackageWithOptions{moderncvcompatibility}
167
168
169%-------------------------------------------------------------------------------
170% class definition
171%-------------------------------------------------------------------------------
172% minimal base settings
173\setlength\lineskip{1\p@}
174\setlength\normallineskip{1\p@}
175\renewcommand\baselinestretch{}
176\setlength{\parindent}{0pt}
177\setlength{\parskip}{0pt}
178\setlength\columnsep{10\p@}
179\setlength\columnseprule{0\p@}
180\pagestyle{empty}
181\pagenumbering{arabic}
182\raggedbottom
183\onecolumn
184
185
186%-------------------------------------------------------------------------------
187% style commands definitions
188%-------------------------------------------------------------------------------
189% symbols used
190\providecommand*{\listitemsymbol}{\textbullet}
191\providecommand*{\addresssymbol}{}
192\providecommand*{\mobilesymbol}{\Mobilefone}
193\providecommand*{\phonesymbol}{\Telefon}
194\providecommand*{\faxsymbol}{\FAX}
195\providecommand*{\emailsymbol}{\Letter}
196
197% colors
198\definecolor{firstnamecolor}{rgb}{0,0,0}
199\definecolor{familynamecolor}{rgb}{0,0,0}
200\definecolor{titlecolor}{rgb}{0,0,0}
201\definecolor{addresscolor}{rgb}{0,0,0}
202\definecolor{quotecolor}{rgb}{0,0,0}
203\definecolor{sectionrectanglecolor}{rgb}{0,0,0}
204\definecolor{sectiontitlecolor}{rgb}{0,0,0}
205\definecolor{subsectioncolor}{rgb}{0,0,0}
206\definecolor{hintcolor}{rgb}{0,0,0}
207
208% fonts
209\providecommand*{\firstnamefont}{}
210\providecommand*{\familynamefont}{}
211\providecommand*{\titlefont}{}
212\providecommand*{\addressfont}{}
213\providecommand*{\quotefont}{}
214\providecommand*{\sectionfont}{}
215\providecommand*{\subsectionfont}{}
216\providecommand*{\hintfont}{\small\sffamily}
217
218% styles
219\providecommand*{\firstnamestyle}[1]{{\firstnamefont\color{firstnamecolor}#1}}
220\providecommand*{\familynamestyle}[1]{{\familynamefont\color{familynamecolor}#1}}
221\providecommand*{\titlestyle}[1]{{\titlefont\color{titlecolor}#1}}
222\providecommand*{\addresstyle}[1]{{\addressfont\color{addresscolor}#1}}
223\providecommand*{\quotestyle}[1]{{\quotefont\color{quotecolor}#1}}
224\providecommand*{\sectionstyle}[1]{{\sectionfont\color{sectiontitlecolor}#1}}
225\providecommand*{\subsectionstyle}[1]{{\subsectionfont\color{subsectioncolor}#1}}
226\providecommand*{\hintstyle}[1]{{\hintfont\color{hintcolor}#1}}
227
228% themes: casual (default), classic, ...
229\newcommand*{\moderncvtheme}[2][]{
230 \def\@moderncvtheme{#2}
231 \def\@moderncvthemeoptions{#1}}
232\moderncvtheme{casual} % default theme
233\AtBeginDocument{\RequirePackage[\@moderncvthemeoptions]{moderncvtheme\@moderncvtheme}}
234
235
236%-------------------------------------------------------------------------------
237% structure commands definitions
238%-------------------------------------------------------------------------------
239\newcommand*{\firstname}[1]{\def\@firstname{#1}}
240\newcommand*{\familyname}[1]{\def\@familyname{#1}}
241\renewcommand*{\title}[1]{\def\@title{#1}}
242\newcommand*{\address}[2]{\def\@addressstreet{#1}\def\@addresscity{#2}}
243\newcommand*{\mobile}[1]{\def\@mobile{#1}}
244\newcommand*{\phone}[1]{\def\@phone{#1}}
245\renewcommand*{\fax}[1]{\def\@fax{#1}}
246\newcommand*{\email}[1]{\def\@email{#1}}
247\newcommand*{\extrainfo}[1]{\def\@extrainfo{#1}}
248\newcommand*{\photo}[2][64pt]{\def\@photoheight{#1}\def\@photo{#2}}
249\newcommand*{\quote}[1]{\def\@quote{#1}}
250
251% length used by the moderncv layout
252% quote length
253\newlength{\quotewidth}
254% section lengths
255\newlength{\hintscolumnwidth}
256\newlength{\separatorcolumnwidth}
257\setlength{\separatorcolumnwidth}{0.025\textwidth}
258\newlength{\maincolumnwidth}
259\newcommand*{\sethintscolumnlength}[1]{
260 \setlength{\hintscolumnwidth}{#1}%
261 \setlength{\maincolumnwidth}{\textwidth}%
262 \addtolength{\maincolumnwidth}{-\separatorcolumnwidth}%
263 \addtolength{\maincolumnwidth}{-\hintscolumnwidth}}
264\newcommand*{\sethintscolumntowidth}[1]{
265 \settowidth{\hintscolumnwidth}{#1}%
266 \setlength{\maincolumnwidth}{\textwidth}%
267 \addtolength{\maincolumnwidth}{-\separatorcolumnwidth}%
268 \addtolength{\maincolumnwidth}{-\hintscolumnwidth}}
269% doubleitem lengths
270\newlength{\doubleitemmaincolumnwidth}
271% listitem lengths
272\newlength{\listitemsymbolwidth}
273\settowidth{\listitemsymbolwidth}{\listitemsymbol{}~}
274% listdoubleitem lengths
275\newlength{\listdoubleitemmaincolumnwidth}
276% recompute all the lengths that depends on the text width
277\newcommand*{\recomputelengths}{%
278 \setlength{\quotewidth}{0.65\textwidth}%
279 \sethintscolumnlength{\hintscolumnwidth}%
280 % doubleitem lengths
281 \setlength{\doubleitemmaincolumnwidth}{\maincolumnwidth}%
282 \addtolength{\doubleitemmaincolumnwidth}{-\hintscolumnwidth}%
283 \addtolength{\doubleitemmaincolumnwidth}{-\separatorcolumnwidth}%
284 \setlength{\doubleitemmaincolumnwidth}{0.5\doubleitemmaincolumnwidth}%
285 % listdoubleitem lengths
286 \setlength{\listdoubleitemmaincolumnwidth}{\maincolumnwidth}%
287 \addtolength{\listdoubleitemmaincolumnwidth}{-\listitemsymbolwidth}%
288 \setlength{\listdoubleitemmaincolumnwidth}{0.475\listdoubleitemmaincolumnwidth}%
289 % fancyhdr lengths
290 \renewcommand{\headwidth}{\textwidth}}
291\sethintscolumnlength{0.15\textwidth}
292\recomputelengths
293
294% makes the cv title
295\renewcommand*{\maketitle}{}%
296
297% draws a colored rectangle
298% usage: \colorrule[optional height]{width}
299%\newcommand*{\colorrule}[2][1ex]{{\color{sectionrectanglecolor}{\rule{#2}{#1}}}}
300
301\newif\if@sectionopen\@sectionopenfalse
302\newif\if@firstcvlineofsection\@firstcvlineofsectionfalse % bug if initially set to true...
303% usage: \closesection{} to force a section to be closed (and the tabular layout it generates)
304\newcommand*{\closesection}{%
305 \if@sectionopen%
306 \end{longtable}%
307% \phantomsection% reset the anchor for hyperrefs
308% \par\null%
309 \@sectionopenfalse\fi}
310\AtEndDocument{\closesection{}}
311% usage: \section{<title>}, or \emptysection{}
312\newcommand*{\section}[1]{%
313 \closesection{}%
314 \@sectionopentrue%
315 \phantomsection{}% reset the anchor for hyperrefs
316 \addcontentsline{toc}{part}{#1}%
317 \begin{longtable}[l]{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}%
318 {\color{sectionrectanglecolor}\rule{\hintscolumnwidth}{1ex}} &\sectionstyle{#1}\\[1ex]%
319 \@firstcvlineofsectiontrue%
320 }
321\newcommand*{\emptysection}{%
322 \closesection{}%
323 \@sectionopentrue%
324 \begin{longtable}[l]{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}%
325 \@firstcvlineofsectiontrue%
326 }
327
328% usage (inside section): \subsection{title}
329\newcommand*{\subsection}[1]{%
330 \cvline[0.65em]{}{\subsectionstyle{#1}}}
331
332% usage (inside section): \cvline{leftmark}{text}
333\newcommand*{\cvline}[3][.25em]{%
334 \if@firstcvlineofsection%
335 \@firstcvlineofsectionfalse%
336 \else%
337 \\[#1]\fi%
338 \raggedleft\hintfont{#2} &#3}
339
340% usage (inside section}: \cvdoubleitem{subtitle}{text}{subtitle}{text}
341\newcommand*{\cvdoubleitem}[4]{%
342 \cvline{#1}{\begin{minipage}[t]{\doubleitemmaincolumnwidth}#2\end{minipage}%
343 \hfill%
344 \begin{minipage}[t]{\hintscolumnwidth}\raggedleft\hintfont{#3}\end{minipage}\hspace*{\separatorcolumnwidth}\begin{minipage}[t]{\doubleitemmaincolumnwidth}#4\end{minipage}}}
345
346% usage (inside section): \cvlistitem{point1}
347\newcommand*{\cvlistitem}[2][\listitemsymbol{}]{%
348 \cvline[0pt]{}{#1~#2}}
349
350% usage (inside section): \cvlistdoubleitem{point1}{point2}
351\newcommand*{\cvlistdoubleitem}[3][\listitemsymbol{}]{%
352 \cvline[0pt]{}{#1~\begin{minipage}[t]{\listdoubleitemmaincolumnwidth}#2\end{minipage}%
353 \hfill%
354 \ifthenelse{\equal{#3}{}}%
355 {}%
356 {#1~\begin{minipage}[t]{\listdoubleitemmaincolumnwidth}#3\end{minipage}}}}
357
358% usage : \cventry{years}{degree/job title}{institution/employer}{localization}{optionnal: grade/...}{optional: comment/job description}
359\newcommand*{\cventry}[6]{%
360 \cvline{#1}{%
361 {\bfseries#2}%
362 \ifthenelse{\equal{#3}{}}{}{, {\slshape#3}}%
363 \ifthenelse{\equal{#4}{}}{}{, #4}%
364 \ifthenelse{\equal{#5}{}}{}{, #5}%
365 .%
366 \ifthenelse{\equal{#6}{}}{}{\newline{}\small#6}
367 }}%
368% \ifthenelse{\equal{#6}{}}{}{\cvline[0pt]{}{\small#6}}}
369
370% usage (inside 'language' cvsection environment): \cvlanguage{name}{level}{comment}
371\newcommand*{\cvlanguage}[3]{%
372 \cvline{#1}{\begin{minipage}[t]{.225\maincolumnwidth}\textbf{#2}\end{minipage}\hfill\begin{minipage}[t]{0.725\maincolumnwidth}\raggedleft\footnotesize\itshape #3\end{minipage}}}
373
374% usage (inside 'computer skills' cvsection environment): \cvcomputer{category}{programs}{category}{programs}
375\newcommand*{\cvcomputer}[4]{%
376 \cvdoubleitem{#1}{\small#2}{#3}{\small#4}}
377
378% usage: \weblink[optional text]{link}
379\newcommand*{\weblink}[2][]{%
380 \ifthenelse{\equal{#1}{}}%
381 {\def\@linktext{#2}}%
382 {\def\@linktext{#1}}%
383 \href{#2}{\@linktext{}}}
384
385% usage: \httplink[optional text]{link}
386\newcommand*{\httplink}[2][]{%
387 \ifthenelse{\equal{#1}{}}%
388 {\def\@linktext{#2}}%
389 {\def\@linktext{#1}}%
390 \href{http://#2}{\@linktext{}}}
391
392% usage: \emaillink[optional text]{link}
393\newcommand*{\emaillink}[2][]{%
394 \ifthenelse{\equal{#1}{}}%
395 {\def\@linktext{#2}}%
396 {\def\@linktext{#1}}%
397 \href{mailto:#2}{\@linktext{}}}
398
399% usage: \nopagenumbers{}
400\newif\if@displaypagenumbers\@displaypagenumberstrue
401\newcommand*{\nopagenumbers}{\@displaypagenumbersfalse}
402\AtBeginDocument{%
403 \if@displaypagenumbers%
404 \@ifundefined{r@lastpage}{}{%
405 \ifthenelse{\pageref{lastpage} > 1}{%
406 \fancypagestyle{plain}{%
407 \fancyfoot[r]{\addressfont\color{quotecolor}\footnotesize\thepage/\pageref{lastpage}}}%
408 \pagestyle{plain}}{}}%
409 \AtEndDocument{\label{lastpage}}%
410 \fi}
411
412% thebibliography environment, for use with BibTeX
413\newcommand{\refname}{Publications}
414\newlength{\bibindent}
415\setlength{\bibindent}{1.5em}
416% trick to force the previous section to close before the thebibliography environment
417\let\oldbibliography\bibliography
418\renewcommand*{\bibliography}[1]{%
419 \closesection{}%
420 \oldbibliography{#1}}
421% bibliography item label
422\newcommand*{\bibliographyitemlabel}{}% use \@biblabel{\arabic{enumiv}} for BibTeX labels
423\newenvironment{thebibliography}[1]%
424 {%
425 \section{\refname}%
426 \closesection{}%
427 \vspace*{-1.65em}%
428 \small%
429 \begin{list}{\bibliographyitemlabel}%
430 {%
431 \setlength{\topsep}{0pt}%
432 \setlength{\labelwidth}{\hintscolumnwidth}%
433 \setlength{\labelsep}{\separatorcolumnwidth}%
434 \leftmargin\labelwidth%
435 \advance\leftmargin\labelsep%
436 \@openbib@code%
437 \usecounter{enumiv}%
438 \let\p@enumiv\@empty%
439 \renewcommand\theenumiv{\@arabic\c@enumiv}}%
440 \sloppy\clubpenalty4000\widowpenalty4000%
441% \sfcode`\.\@m%
442% \sfcode `\=1000\relax%
443 }%
444 {%
445 \def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}%
446 \end{list}%
447 }
448\newcommand\newblock{\hskip .11em\@plus.33em\@minus.07em}
449\let\@openbib@code\@empty
450
451% the classical \today definition
452\def\today{\ifcase\month\or
453 January\or February\or March\or April\or May\or June\or
454 July\or August\or September\or October\or November\or December\fi
455 \space\number\day, \number\year}
456
457
458\endinput
459
460
461%% end of file `moderncv.cls'.
Note: See TracBrowser for help on using the repository browser.