diff --git a/CHANGELOG b/CHANGELOG index 0a5265f..e48f833 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,9 @@ version 1.3.0 (xx xxx 2013) + - added a new environment to create multiple columns: cvcolumns. Each column + is then created by \cvcolumn[width]{header}{content}, where the optional width + is given as a fraction of the total width (between 0 and 1). The header and + content are robust and can contain any paragraph command (e.g., a nest itemize + environment). - added a macro (\pdfpagemode) to control what is visible upon opening compiled pdfs (assuming pdf reader support), as suggested by U. Stöhr. Possible values include: "UseNone" (only the document), "UseThumbs" (show diff --git a/examples/template-es.pdf b/examples/template-es.pdf index 9dd6a72..3c83697 100644 Binary files a/examples/template-es.pdf and b/examples/template-es.pdf differ diff --git a/examples/template-zh.pdf b/examples/template-zh.pdf index 1eae249..5d7081f 100644 Binary files a/examples/template-zh.pdf and b/examples/template-zh.pdf differ diff --git a/examples/template.pdf b/examples/template.pdf index 041b30b..5a36356 100644 Binary files a/examples/template.pdf and b/examples/template.pdf differ diff --git a/examples/template.tex b/examples/template.tex index 480eb94..f799b53 100644 --- a/examples/template.tex +++ b/examples/template.tex @@ -41,7 +41,7 @@ %\makeatletter %\renewcommand*{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}} %\makeatother -%\renewcommand*{\bibliographyitemlabel}{[\arabic{enumiv}]% CONSIDER REPLACING THE ABOVE BY THIS +%\renewcommand*{\bibliographyitemlabel}{[\arabic{enumiv}]}% CONSIDER REPLACING THE ABOVE BY THIS % bibliography with mutiple entries %\usepackage{multibib} @@ -106,15 +106,20 @@ Detailed achievements:% \cvlistitem{Item 2} \cvlistitem{Item 3. This item is particularly long and therefore normally spans over several lines. Did you notice the indentation when the line wraps?} -\renewcommand{\listitemsymbol}{-~} % change the symbol for lists - \section{Extra 2} \cvlistdoubleitem{Item 1}{Item 4} \cvlistdoubleitem{Item 2}{Item 5\cite{book1}} \cvlistdoubleitem{Item 3}{Item 6. Like item 3 in the single column list before, this item is particularly long to wrap over several lines.} +\section{References} +\begin{cvcolumns} + \cvcolumn{Category 1}{\begin{itemize}\item Person 1\item Person 2\item Person 3\end{itemize}} + \cvcolumn{Category 2}{Amongst others:\begin{itemize}\item Person 1, and\item Person 2\end{itemize}(more upon request)} + \cvcolumn[0.5]{All the rest \& some more}{\textit{That} person, and \textbf{those} also (all available upon request).} +\end{cvcolumns} + % Publications from a BibTeX file without multibib -% for numerical labels: \renewcommand{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}} +% for numerical labels: \renewcommand{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}% CONSIDER MERGING WITH PREAMBLE PART % to redefine the heading string ("Publications"): \renewcommand{\refname}{Articles} \nocite{*} \bibliographystyle{plain} diff --git a/examples/template_banking_red.pdf b/examples/template_banking_red.pdf index 85225d3..4a432f6 100644 Binary files a/examples/template_banking_red.pdf and b/examples/template_banking_red.pdf differ diff --git a/examples/template_casual_orange.pdf b/examples/template_casual_orange.pdf index 3e4627e..c4f0c3e 100644 Binary files a/examples/template_casual_orange.pdf and b/examples/template_casual_orange.pdf differ diff --git a/examples/template_classic_green.pdf b/examples/template_classic_green.pdf index 31992e5..07ae629 100644 Binary files a/examples/template_classic_green.pdf and b/examples/template_classic_green.pdf differ diff --git a/examples/template_multibib.pdf b/examples/template_multibib.pdf index 57b6786..b9ca938 100644 Binary files a/examples/template_multibib.pdf and b/examples/template_multibib.pdf differ diff --git a/examples/template_oldstyle_grey.pdf b/examples/template_oldstyle_grey.pdf index 3aa29a9..88b8a99 100644 Binary files a/examples/template_oldstyle_grey.pdf and b/examples/template_oldstyle_grey.pdf differ diff --git a/moderncv.cls b/moderncv.cls index 1b2269c..32d01d5 100644 --- a/moderncv.cls +++ b/moderncv.cls @@ -415,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@def" (by default "p{\cvcolumnautowidth}"), separated by "@{\hspace*{\separatorcolumnwidth}}" + % - the tabular heading is the aggregation of the different "\cvcolumn@head", separated by "&" + % - the tabular content is the aggregation of the different "\cvcolumn@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}