diff options
author | Karl Berry <karl@freefriends.org> | 2013-02-10 23:12:46 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-02-10 23:12:46 +0000 |
commit | 4bce3b94bd04b49c445367eb9d2428d691d41adb (patch) | |
tree | 28a0aba9ea6d18b8bb9e3ffd452d4a22debbe5f0 /Master/texmf-dist/tex/latex/moderncv/moderncv.cls | |
parent | 02c193f4bbd220bc6a44c64c3115effc739a7450 (diff) |
moderncv (10feb13)
git-svn-id: svn://tug.org/texlive/trunk@29074 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/moderncv/moderncv.cls')
-rw-r--r-- | Master/texmf-dist/tex/latex/moderncv/moderncv.cls | 157 |
1 files changed, 140 insertions, 17 deletions
diff --git a/Master/texmf-dist/tex/latex/moderncv/moderncv.cls b/Master/texmf-dist/tex/latex/moderncv/moderncv.cls index d6b8f63fe75..08b24c9a1ae 100644 --- a/Master/texmf-dist/tex/latex/moderncv/moderncv.cls +++ b/Master/texmf-dist/tex/latex/moderncv/moderncv.cls @@ -1,5 +1,5 @@ %% start of file `moderncv.cls'. -%% Copyright 2006-2012 Xavier Danaux (xdanaux@gmail.com). +%% Copyright 2006-2013 Xavier Danaux (xdanaux@gmail.com). % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License version 1.3c, @@ -10,7 +10,7 @@ % identification %------------------------------------------------------------------------------- \NeedsTeXFormat{LaTeX2e} -\ProvidesClass{moderncv}[2012/12/04 v1.2.1 modern curriculum vitae and letter document class] +\ProvidesClass{moderncv}[2013/02/09 v1.3.0 modern curriculum vitae and letter document class] %------------------------------------------------------------------------------- @@ -120,6 +120,7 @@ %\fi % hyper links (hyperref is loaded at the end of the preamble to pass options required by loaded packages such as CJK) +\newcommand*\pdfpagemode{UseNone}% do not show thumbnails or bookmarks on opening (on supporting browsers); set \pdfpagemode to "UseOutlines" to show bookmarks \RequirePackage{url} \urlstyle{tt} \AtEndPreamble{ @@ -129,7 +130,7 @@ breaklinks, baseurl = http://, pdfborder = 0 0 0, - pdfpagemode = UseNone,% do not show thumbnails or bookmarks on opening + pdfpagemode = \pdfpagemode, pdfstartpage = 1, pdfcreator = {\LaTeX{} with 'moderncv' package}, % pdfproducer = {\LaTeX{}},% will/should be set automatically to the correct TeX engine used @@ -165,11 +166,27 @@ \AtEndDocument{\label{lastpage}}\else\fi}} \pagestyle{plain} +% reduced list spacing +% package providing hooks into lists +% originally developped by Jakob Schiøtz (see http://dcwww.camd.dtu.dk/~schiotz/comp/LatexTips/tweaklist.sty) +% modified and distributed with moderncv(not available otherwise on ctan) +\RequirePackage{tweaklist} +\renewcommand*{\itemhook}{% + \@minipagetrue% removes spacing before lists as they use \addvspace, which doesn't add vertical space inside minipages + \@noparlisttrue% removes spacing at end of lists, caused by \par + \setlength{\topsep}{0pt}% normally not required thanks to \@minipagetrue + \setlength{\partopsep}{0pt}% normally not required thanks to \@minipagetrue + \setlength{\parsep}{0pt}% not required when \itemsep and \parskip are set to 0pt (?) + \setlength{\parskip}{0pt}% + \setlength{\itemsep}{0pt}} +\renewcommand*{\enumhook}{\itemhook{}} +\renewcommand*{\deschook}{\itemhook{}} + % lengths calculations \RequirePackage{calc} % advanced command arguments (LaTeX 3) -\RequirePackage{xargs} +\RequirePackage{xparse} % TODO (?): replace all \newcommand by \NewDocumentCommand % micro-typography (e.g., character protrusion, font expansion, hyphenatable letterspacing) @@ -208,15 +225,37 @@ % overall design commands definitions %------------------------------------------------------------------------------- % elements +% defines one's first name +% usage: \firstname{<firstname>} \newcommand*{\firstname}[1]{\def\@firstname{#1}} +% defines one's family name +% usage: \familyname{<familyname>} \newcommand*{\familyname}[1]{\def\@familyname{#1}} +% defines one's title (optional) +% usage: \title{<title>} \renewcommand*{\title}[1]{\def\@title{#1}} -\newcommand*{\address}[2]{\def\@addressstreet{#1}\def\@addresscity{#2}} +% defines one's address (optional) +% usage: \address{<street>}{<city>}{<country>} +% where the <city> and <country> arguments can be omitted or provided empty +\NewDocumentCommand{\address}{mG{}G{}}{\def\@addressstreet{#1}\def\@addresscity{#2}\def\@addresscountry{#3}} +% defines one's mobile phone number (optional) +% usage: \mobile{<number>} \newcommand*{\mobile}[1]{\def\@mobile{#1}} +% defines one's fixed phone number (optional) +% usage: \phone{<number>} \newcommand*{\phone}[1]{\def\@phone{#1}} +% defines one's fax number (optional) +% usage: \fax{<number>} \newcommand*{\fax}[1]{\def\@fax{#1}} +% defines one's email address (optional) +% usage: \email{<email>} \newcommand*{\email}[1]{\def\@email{#1}} +% defines one's home page (optional) +% usage: \homepage{<url>} \newcommand*{\homepage}[1]{\def\@homepage{#1}} +% defines additional personal information (optional) +% usage: \extrainfo{<text>} +\newcommand*{\extrainfo}[1]{\def\@extrainfo{#1}} % colors \definecolor{color0}{rgb}{0,0,0}% main default color, normally left to black @@ -276,8 +315,9 @@ % resume design commands definitions %------------------------------------------------------------------------------- % elements -\newcommand*{\extrainfo}[1]{\def\@extrainfo{#1}} -\newcommandx*{\photo}[3][1=64pt,2=0.4pt,usedefault]{\def\@photowidth{#1}\def\@photoframewidth{#2}\def\@photo{#3}}% the 1st (optional) argument is the width of the photo, the 2nd (optional) argument is the thickness of the frame around it. +% defines one's picture (optional) +% usage: photo[<picture width>][<picture frame thickness>]{<picture filename>} +\NewDocumentCommand{\photo}{O{64pt}O{0.4pt}m}{\def\@photowidth{#1}\def\@photoframewidth{#2}\def\@photo{#3}} \newcommand*{\quote}[1]{\def\@quote{#1}} % fonts @@ -375,6 +415,98 @@ {\href{mailto:#2}{#2}}% {\href{mailto:#2}{#1}}} +% cvcolumns environment, where every column is created through \cvcolumn +% usage: \begin{cvcolumns} +% \cvcolumn[width]{head}{content} +% \cvcolumn[width]{head}{content} +% ... +% \end{cvcolumns} +% where "width" is the width as a fraction of the line length (between 0 and 1), "head" is the column header and "content" its content +\newcounter{cvcolumnscounter}% counter for the number of columns +\newcounter{cvcolumnsautowidthcounter}% counter for the number of columns with no column width provided, and which will then be equally distributed +\newcounter{tmpiteratorcounter}% counter for any temporary purpose (e.g., iterating loops) +\newlength{\cvcolumnsdummywidth}\setlength{\cvcolumnsdummywidth}{1000pt}% dummy width for total width, in order to enable arithmetics (TeX has no float variables, only integer counters or lengths) +\newlength{\cvcolumnswidth}% total width available for head / content +\newlength{\cvcolumnsautowidth}% total width of columns with no explicit width provided +\newlength{\cvcolumnautowidth}% width of one of the columns with no explicit width provided (based on equal distribution of remaining space) +\newif\if@cvcolumns@head@empty% whether or not at least one of the columns has a header +\newenvironment*{cvcolumns}% + {% at environment opening: reset counters, lengths and ifs + \setcounter{cvcolumnscounter}{0}% + \setcounter{cvcolumnsautowidthcounter}{0}% + \setlength{\cvcolumnsautowidth}{\cvcolumnsdummywidth}% + \setlength{\cvcolumnautowidth}{0pt}% + \@cvcolumns@head@emptytrue}% + {% at environment closing: typeset environment + % compute the width of each cvcolumn, considering a spacing of \separatorcolumnwidth and the columns with set width + \ifnum\thecvcolumnscounter>0% + \setlength{\cvcolumnswidth}{\maincolumnwidth-\value{cvcolumnscounter}\separatorcolumnwidth+\separatorcolumnwidth}% + \setlength{\cvcolumnautowidth}{\cvcolumnswidth*\ratio{\cvcolumnsautowidth}{\cvcolumnsdummywidth}/\value{cvcolumnsautowidthcounter}}\fi% + % pre-aggregate the tabular definition, heading and content (required before creating the tabular, as the tabular environment doesn't like loops --- probably because "&" generates a \endgroup) + % - the tabular definition is the aggregation of the different "\cvcolumn<i>@def" (by default "p{\cvcolumnautowidth}"), separated by "@{\hspace*{\separatorcolumnwidth}}" + % - the tabular heading is the aggregation of the different "\cvcolumn<i>@head", separated by "&" + % - the tabular content is the aggregation of the different "\cvcolumn<i>@content", separated by "&" + % to aggregate the different elements, \protected@edef or \g@addto@macro is required to avoid that \cvcolumns@def, -@head and -@content get expanded in subsequent redefinitions, which would cause errors due to the expansions of \hspace, of \subsectionstyle and possibly of user content/argument such as font commands + \def\cvcolumns@def{}% + \def\cvcolumns@head{}% + \def\cvcolumns@content{}% + \setcounter{tmpiteratorcounter}{0}% + % loop based on \g@addto@macro + \loop\ifnum\thetmpiteratorcounter<\thecvcolumnscounter% + \ifnum\thetmpiteratorcounter=0\else% + \g@addto@macro\cvcolumns@def{@{\hspace*{\separatorcolumnwidth}}}% + \g@addto@macro\cvcolumns@head{&}% + \g@addto@macro\cvcolumns@content{&}\fi% + \expandafter\g@addto@macro\expandafter\cvcolumns@def\expandafter{\csname cvcolumn\roman{tmpiteratorcounter}@def\endcsname}% + \expandafter\g@addto@macro\expandafter\cvcolumns@head\expandafter{\csname cvcolumn\roman{tmpiteratorcounter}@head\endcsname}% + \expandafter\g@addto@macro\expandafter\cvcolumns@content\expandafter{\csname cvcolumn\roman{tmpiteratorcounter}@content\endcsname}% + \stepcounter{tmpiteratorcounter}% + \repeat% +% % same loop based on \protected@edef +% \loop\ifnum\thetmpiteratorcounter<\thecvcolumnscounter% +% \ifnum\thetmpiteratorcounter=0\else% +% \protected@edef\cvcolumns@def{\cvcolumns@def @{\hspace*{\separatorcolumnwidth}}}% +% \protected@edef\cvcolumns@head{\cvcolumns@head &}% +% \protected@edef\cvcolumns@content{\cvcolumns@content &}\fi% +% \expandafter\protected@edef\expandafter\cvcolumns@def\expandafter{\expandafter\cvcolumns@def\expandafter\protect\csname cvcolumn\roman{tmpiteratorcounter}@def\endcsname}% +% \expandafter\protected@edef\expandafter\cvcolumns@head\expandafter{\expandafter\cvcolumns@head\expandafter\protect\csname cvcolumn\roman{tmpiteratorcounter}@head\endcsname}% +% \expandafter\protected@edef\expandafter\cvcolumns@content\expandafter{\expandafter\cvcolumns@content\expandafter\protect\csname cvcolumn\roman{tmpiteratorcounter}@content\endcsname}% +% \stepcounter{tmpiteratorcounter}% +% \repeat% + % create the tabular + \cvitem{}{% + \begin{tabular}{\cvcolumns@def}% + \if@cvcolumns@head@empty\else% + \cvcolumns@head\\[-.8em]% + {\color{color1}\rule{\maincolumnwidth}{.25pt}}\\\fi% + \cvcolumns@content% + \end{tabular}}} + +% cvcolumn command, to create a column inside a cvcolumns environment +% usage: \cvcolumn[width]{head}{content} +% where "width" is the width as a fraction of the line length (between 0 and 1), "head" is the column header and "content" its content ("head" and "content" can contain "\\", "\newline" or any other paragraph command such as "itemize") +\newcommand*{\cvcolumn}[3][\cvcolumnautowidth]{% +% \def\cvcolumn@width{}% + \ifthenelse{\equal{#1}{\cvcolumnautowidth}}% + {% if no width fraction is provided, count this column as auto-adjusted and set its width to \cvcolumnsautowidth + \stepcounter{cvcolumnsautowidthcounter}% + \expandafter\expandafter\expandafter\def\expandafter\csname cvcolumn\roman{cvcolumnscounter}@def\endcsname{p{\cvcolumnautowidth}}% + \expandafter\expandafter\expandafter\def\expandafter\csname cvcolumn\roman{cvcolumnscounter}@head\endcsname{\protect\parbox[b]{\cvcolumnautowidth}{\protect\subsectionstyle{#2}}}}% + {% if a width is provided, set the width of the column to it and decrease the available space for auto-adjusted columns + \addtolength{\cvcolumnsautowidth}{-#1\cvcolumnsdummywidth}% + \expandafter\expandafter\expandafter\def\expandafter\csname cvcolumn\roman{cvcolumnscounter}@def\endcsname{p{#1\cvcolumnswidth}}% + \expandafter\expandafter\expandafter\def\expandafter\csname cvcolumn\roman{cvcolumnscounter}@head\endcsname{\protect\parbox[b]{#1\cvcolumnswidth}{\protect\subsectionstyle{#2}}}}% + \ifthenelse{\equal{#2}{}}{}{\@cvcolumns@head@emptyfalse}% + \expandafter\expandafter\expandafter\def\expandafter\csname cvcolumn\roman{cvcolumnscounter}@content\endcsname{\protect\cvcolumncell{#3}}% + \stepcounter{cvcolumnscounter}} + +% internal cvcolumncell command, that enables a cvcolumn cell to contain paragraph commands (lists, newlines, etc) +\newcommand*{\cvcolumncell}[1]{{% put cell inside a group, so that command redefinitions are only local + % roughly restore \\ to its regular definition (outside of tabular) + \renewcommand*{\\}{\newline}% + % enclose the contents of the cell inside a vertical box, to allow paragraph commands + \protect\vtop{#1}}} + % thebibliography environment, for use with BibTeX and possibly multibib \newlength{\bibindent} \setlength{\bibindent}{1.5em} @@ -412,15 +544,6 @@ \renewcommand\p@enumiv{\p@enumiii\theenumiii} % description label \newcommand*\descriptionlabel[1]{\hspace\labelsep\normalfont\bfseries#1} -% hooks to adjust spacing (idea by Jakob Schiøtz; see http://dcwww.camd.dtu.dk/~schiotz/comp/LatexTips/tweaklist.sty) -\RequirePackage{tweaklist}% distributed with moderncv, not found on ctan and slightly modified -\renewcommand*{\itemhook}{ - \setlength{\topsep}{0pt}% - \setlength{\parsep}{0pt}% - \setlength{\parskip}{0pt}% - \setlength{\itemsep}{0pt}} -\renewcommand*{\enumhook}{\itemhook{}} -\renewcommand*{\deschook}{\itemhook{}} % classical \today definition \def\today{\ifcase\month\or @@ -467,4 +590,4 @@ \endinput -%% end of file `moderncv.cls'.
\ No newline at end of file +%% end of file `moderncv.cls'. |