Changeset 222 for cv/moderncv.cls
- Timestamp:
- Nov 10, 2010, 8:26:26 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cv/moderncv.cls
r2 r222 1 1 %% start of file `moderncv.cls'. 2 %% Copyright 200 7Xavier Danaux (xdanaux@gmail.com).2 %% Copyright 2006-2010 Xavier Danaux (xdanaux@gmail.com). 3 3 % 4 4 % This work may be distributed and/or modified under the … … 11 11 %------------------------------------------------------------------------------- 12 12 \NeedsTeXFormat{LaTeX2e} 13 \ProvidesClass{moderncv}[20 07/05/28 v0.6modern curriculum vitae document class]13 \ProvidesClass{moderncv}[2010/08/03 v0.12 modern curriculum vitae document class] 14 14 15 15 … … 69 69 \DeclareOption{nocolor}{\@colorfalse} 70 70 71 % CJK option 72 %\newif\if@CJK\@CJKfalse 73 %\DeclareOption{CJK}{\@CJKtrue} 74 71 75 % execute default options 72 76 \ExecuteOptions{a4paper,11pt,color,final} … … 80 84 % required packages 81 85 %------------------------------------------------------------------------------- 82 % ifthen package 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 83 94 \RequirePackage{ifthen} 84 95 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 % latex vs pdflatex vs xelatex vs luatex compilation 97 %\RequirePackage{ifpdf} 98 99 % color 100 \RequirePackage{color} 101 102 % font encoding 96 103 \RequirePackage[T1]{fontenc} 97 104 … … 100 107 101 108 % latin modern fonts 102 \AtEndOfClass{% 103 \if@lmodern 104 \RequirePackage{lmodern}\fi} 109 \if@lmodern 110 \RequirePackage{lmodern}\fi 105 111 106 112 % symbols like \Telefon, \Mobilefone, \Letter and \Email … … 120 126 % hyperrefs 121 127 \RequirePackage{url} 122 \ifpdf 123 \RequirePackage[pdftex]{hyperref} 124 \else 125 \RequirePackage[dvips]{hyperref}\fi 126 \AtEndOfClass{% 127 \AtBeginDocument{% 128 \hypersetup{% 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{ 129 136 breaklinks, 130 137 baseurl = http://, 131 138 pdfborder = 0 0 0, 132 pdfpagemode = None,133 pdfstartview = XYZ,139 pdfpagemode = UseNone,% do not show thumbnails or bookmarks on opening 140 % pdfstartview = FitH, 134 141 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} 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 } 150 151 151 152 % graphics 152 \ifpdf 153 \RequirePackage[pdftex]{graphicx} 154 \else 155 \RequirePackage[dvips]{graphicx}\fi 153 \RequirePackage{graphicx} 156 154 157 155 % headers and footers 158 \ usepackage{fancyhdr}159 \fancypagestyle{plain}{ %156 \RequirePackage{fancyhdr} 157 \fancypagestyle{plain}{ 160 158 \renewcommand{\headrulewidth}{0pt} 161 159 \renewcommand{\footrulewidth}{0pt} … … 178 176 \setlength\columnsep{10\p@} 179 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 180 188 \pagestyle{empty} 181 \pagenumbering{arabic}182 189 \raggedbottom 183 190 \onecolumn … … 188 195 %------------------------------------------------------------------------------- 189 196 % symbols used 190 \providecommand*{\listitemsymbol}{\ textbullet}197 \providecommand*{\listitemsymbol}{\Neutral}%{{\fontencoding{U}\fontfamily{ding}\selectfont\tiny\symbol{'102}}} 191 198 \providecommand*{\addresssymbol}{} 192 199 \providecommand*{\mobilesymbol}{\Mobilefone} … … 194 201 \providecommand*{\faxsymbol}{\FAX} 195 202 \providecommand*{\emailsymbol}{\Letter} 203 \providecommand*{\homepagesymbol}{{\Large\ComputerMouse}} 196 204 197 205 % colors … … 230 238 \def\@moderncvtheme{#2} 231 239 \def\@moderncvthemeoptions{#1}} 232 \moderncvtheme{casual} 233 \At BeginDocument{\RequirePackage[\@moderncvthemeoptions]{moderncvtheme\@moderncvtheme}}240 \moderncvtheme{casual}% default theme 241 \AtEndPreamble{\RequirePackage[\@moderncvthemeoptions]{moderncvtheme\@moderncvtheme}} 234 242 235 243 … … 245 253 \renewcommand*{\fax}[1]{\def\@fax{#1}} 246 254 \newcommand*{\email}[1]{\def\@email{#1}} 255 \newcommand*{\homepage}[1]{\def\@homepage{#1}} 247 256 \newcommand*{\extrainfo}[1]{\def\@extrainfo{#1}} 248 \newcommand*{\photo}[2][64pt]{\def\@photoheight{#1}\def\@photo{#2}} 257 \def\@photowidth{0pt} 258 \newcommand*{\photo}[2][64pt]{\def\@photowidth{#1}\def\@photo{#2}} 249 259 \newcommand*{\quote}[1]{\def\@quote{#1}} 250 260 … … 257 267 \setlength{\separatorcolumnwidth}{0.025\textwidth} 258 268 \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 269 % doubleitem lengths 270 270 \newlength{\doubleitemmaincolumnwidth} … … 272 272 \newlength{\listitemsymbolwidth} 273 273 \settowidth{\listitemsymbolwidth}{\listitemsymbol{}~} 274 \newlength{\listitemmaincolumnwidth} 274 275 % listdoubleitem lengths 275 276 \newlength{\listdoubleitemmaincolumnwidth} 276 277 % recompute all the lengths that depends on the text width 278 \newcommand*{\recomputethemelengths}{} 277 279 \newcommand*{\recomputelengths}{% 278 280 \setlength{\quotewidth}{0.65\textwidth}% 279 \sethintscolumnlength{\hintscolumnwidth}% 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}% 280 288 % doubleitem lengths 281 289 \setlength{\doubleitemmaincolumnwidth}{\maincolumnwidth}% … … 288 296 \setlength{\listdoubleitemmaincolumnwidth}{0.475\listdoubleitemmaincolumnwidth}% 289 297 % fancyhdr lengths 290 \renewcommand{\headwidth}{\textwidth}} 291 \sethintscolumnlength{0.15\textwidth} 298 \renewcommand{\headwidth}{\textwidth}% 299 \recomputethemelengths} 300 \setlength{\hintscolumnwidth}{0.15\textwidth} 292 301 \recomputelengths 293 302 294 303 % makes the cv title 295 \renewcommand*{\maketitle}{}% 304 %\newcommand*{\maketitle}{}% 305 \title{}% to avoid LaTeX complaining that \maketitle is a called without first a call to \title 296 306 297 307 % draws a colored rectangle … … 299 309 %\newcommand*{\colorrule}[2][1ex]{{\color{sectionrectanglecolor}{\rule{#2}{#1}}}} 300 310 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{} 311 % usage: \section{<title>} 312 312 \newcommand*{\section}[1]{% 313 \ closesection{}%314 \ @sectionopentrue%313 \vspace*{2.5ex}% 314 \parbox[m]{\hintscolumnwidth}{\raggedleft\hintfont{\color{sectionrectanglecolor}\rule{\hintscolumnwidth}{1ex}}}% 315 315 \phantomsection{}% reset the anchor for hyperrefs 316 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} 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} 329 330 \newcommand*{\subsection}[1]{% 330 \cvline[0.65em]{}{\subsectionstyle{#1}}} 331 332 % usage (inside section): \cvline{leftmark}{text} 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} 333 339 \newcommand*{\cvline}[3][.25em]{% 334 \if@firstcvlineofsection% 335 \@firstcvlineofsectionfalse% 336 \else% 337 \\[#1]\fi% 338 \raggedleft\hintfont{#2} } 339 340 % usage (inside section}: \cvdoubleitem{subtitle}{text}{subtitle}{text} 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} 341 345 \newcommand*{\cvdoubleitem}[4]{% 342 346 \cvline{#1}{\begin{minipage}[t]{\doubleitemmaincolumnwidth}#2\end{minipage}% … … 344 348 \begin{minipage}[t]{\hintscolumnwidth}\raggedleft\hintfont{#3}\end{minipage}\hspace*{\separatorcolumnwidth}\begin{minipage}[t]{\doubleitemmaincolumnwidth}#4\end{minipage}}} 345 349 346 % usage (inside section): \cvlistitem{point1}350 % usage: \cvlistitem[symbol]{point1} 347 351 \newcommand*{\cvlistitem}[2][\listitemsymbol{}]{% 348 \cvline[0pt]{}{#1~ #2}}349 350 % usage (inside section): \cvlistdoubleitem{point1}{point2}352 \cvline[0pt]{}{#1~\begin{minipage}[t]{\listitemmaincolumnwidth}#2\end{minipage}}} 353 354 % usage: \cvlistdoubleitem[symbol]{point1}{point2} 351 355 \newcommand*{\cvlistdoubleitem}[3][\listitemsymbol{}]{% 352 356 \cvline[0pt]{}{#1~\begin{minipage}[t]{\listdoubleitemmaincolumnwidth}#2\end{minipage}% … … 356 360 {#1~\begin{minipage}[t]{\listdoubleitemmaincolumnwidth}#3\end{minipage}}}} 357 361 358 % usage 362 % usage: \cventry{years}{degree/job title}{institution/employer}{localization}{optionnal: grade/...}{optional: comment/job description} 359 363 \newcommand*{\cventry}[6]{% 360 364 \cvline{#1}{% … … 364 368 \ifthenelse{\equal{#5}{}}{}{, #5}% 365 369 .% 366 \if thenelse{\equal{#6}{}}{}{\newline{}\small#6}367 }}%368 % \ifthenelse{\equal{#6}{}}{}{\cvline[0pt]{}{\small#6}}} 370 \ifx&% 371 \else{\newline{}\begin{minipage}[t]{\linewidth}\small#6\end{minipage}}\fi% 372 }}% 369 373 370 374 % usage (inside 'language' cvsection environment): \cvlanguage{name}{level}{comment} … … 376 380 \cvdoubleitem{#1}{\small#2}{#3}{\small#4}} 377 381 378 % usage: \ weblink[optional text]{link}379 \newcommand*{\ weblink}[2][]{%382 % usage: \link[optional text]{link} 383 \newcommand*{\link}[2][]{% 380 384 \ifthenelse{\equal{#1}{}}% 381 {\def\@linktext{#2}}% 382 {\def\@linktext{#1}}% 383 \href{#2}{\@linktext{}}} 385 {\href{#2}{#2}}% 386 {\href{#2}{#1}}} 384 387 385 388 % usage: \httplink[optional text]{link} 386 389 \newcommand*{\httplink}[2][]{% 387 390 \ifthenelse{\equal{#1}{}}% 388 {\def\@linktext{#2}}% 389 {\def\@linktext{#1}}% 390 \href{http://#2}{\@linktext{}}} 391 {\href{http://#2}{#2}}% 392 {\href{http://#2}{#1}}} 391 393 392 394 % usage: \emaillink[optional text]{link} 393 395 \newcommand*{\emaillink}[2][]{% 394 396 \ifthenelse{\equal{#1}{}}% 395 {\def\@linktext{#2}}% 396 {\def\@linktext{#1}}% 397 \href{mailto:#2}{\@linktext{}}} 397 {\href{mailto:#2}{#2}}% 398 {\href{mailto:#2}{#1}}} 398 399 399 400 % usage: \nopagenumbers{} 400 401 \newif\if@displaypagenumbers\@displaypagenumberstrue 401 402 \newcommand*{\nopagenumbers}{\@displaypagenumbersfalse} 403 \AtEndPreamble{% 402 404 \AtBeginDocument{% 403 405 \if@displaypagenumbers% 404 406 \@ifundefined{r@lastpage}{}{% 405 407 \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 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 413 414 \newcommand{\refname}{Publications} 414 415 \newlength{\bibindent} 415 416 \setlength{\bibindent}{1.5em} 416 % trick to force the previous section to close before the thebibliography environment417 \let\oldbibliography\bibliography418 \renewcommand*{\bibliography}[1]{%419 \closesection{}%420 \oldbibliography{#1}}421 417 % bibliography item label 422 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 423 424 \newenvironment{thebibliography}[1]% 424 425 {% 425 \section{\refname}% 426 \closesection{}% 427 \vspace*{-1.65em}% 426 \bibliographyhead{\refname}% 428 427 \small% 429 428 \begin{list}{\bibliographyitemlabel}% … … 449 448 \let\@openbib@code\@empty 450 449 451 % the classical \today definition 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 452 492 \def\today{\ifcase\month\or 453 493 January\or February\or March\or April\or May\or June\or
Note:
See TracChangeset
for help on using the changeset viewer.