Simplified the \section and \subsection code of the classic style variant

This commit is contained in:
Xavier Danaux
2014-02-17 16:05:52 -05:00
parent 9eec87b85d
commit e5a190efd9

View File

@ -57,17 +57,17 @@
\renewcommand*{\hintstyle}[1]{{\hintfont\textcolor{color0}{#1}}} \renewcommand*{\hintstyle}[1]{{\hintfont\textcolor{color0}{#1}}}
% lengths % lengths
\newlength{\quotewidth} \@initializelength{\quotewidth}
\newlength{\hintscolumnwidth} \@initializelength{\hintscolumnwidth}
\setlength{\hintscolumnwidth}{0.175\textwidth} \setlength{\hintscolumnwidth}{0.175\textwidth}
\newlength{\separatorcolumnwidth} \@initializelength{\separatorcolumnwidth}
\setlength{\separatorcolumnwidth}{0.025\textwidth} \setlength{\separatorcolumnwidth}{0.025\textwidth}
\newlength{\maincolumnwidth} \@initializelength{\maincolumnwidth}
\newlength{\doubleitemmaincolumnwidth} \@initializelength{\doubleitemmaincolumnwidth}
\newlength{\listitemsymbolwidth} \@initializelength{\listitemsymbolwidth}
\settowidth{\listitemsymbolwidth}{\listitemsymbol} \settowidth{\listitemsymbolwidth}{\listitemsymbol}
\newlength{\listitemmaincolumnwidth} \@initializelength{\listitemmaincolumnwidth}
\newlength{\listdoubleitemmaincolumnwidth} \@initializelength{\listdoubleitemmaincolumnwidth}
% commands % commands
\renewcommand*{\recomputecvlengths}{% \renewcommand*{\recomputecvlengths}{%
@ -147,26 +147,22 @@
{{\centering\begin{minipage}{\quotewidth}\centering\quotestyle{\@quote}\end{minipage}\\[2.5em]}}% {{\centering\begin{minipage}{\quotewidth}\centering\quotestyle{\@quote}\end{minipage}\\[2.5em]}}%
\par}% to avoid weird spacing bug at the first section if no blank line is left after \makecvtitle \par}% to avoid weird spacing bug at the first section if no blank line is left after \makecvtitle
\newlength{\baseletterheight} \@initializelength{\baseletterheight}
\settoheight{\baseletterheight}{\sectionstyle{o}} \settoheight{\baseletterheight}{\sectionstyle{o}}
\setlength{\baseletterheight}{\baseletterheight-0.95ex} \setlength{\baseletterheight}{\baseletterheight-0.95ex}
\RenewDocumentCommand{\section}{sm}{% \RenewDocumentCommand{\section}{sm}{%
\par\addvspace{2.5ex}% \par\addvspace{2.5ex}%
\phantomsection{}% reset the anchor for hyperrefs \phantomsection{}% reset the anchor for hyperrefs
\addcontentsline{toc}{section}{#2}% \addcontentsline{toc}{section}{#2}%
\parbox[t]{\hintscolumnwidth}{\strut\raggedleft\raisebox{\baseletterheight}{\color{color1}\rule{\hintscolumnwidth}{0.95ex}}}% \cvitem[0ex]{\strut\raggedleft\raisebox{\baseletterheight}{\color{color1}\rule{\hintscolumnwidth}{0.95ex}}}{\strut\sectionstyle{#2}}%
\hspace{\separatorcolumnwidth}%
\parbox[t]{\maincolumnwidth}{\strut\sectionstyle{#2}}%
\par\nobreak\addvspace{1ex}\@afterheading}% to avoid a pagebreak after the heading \par\nobreak\addvspace{1ex}\@afterheading}% to avoid a pagebreak after the heading
\RenewDocumentCommand{\subsection}{sm}{% \RenewDocumentCommand{\subsection}{sm}{%
\par\addvspace{1ex}% \par\addvspace{1ex}%
\phantomsection{}% reset the anchor for hyperrefs \phantomsection{}% reset the anchor for hyperrefs
\addcontentsline{toc}{subsection}{#2}% \addcontentsline{toc}{subsection}{#2}%
\begin{tabular}{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}% \cvitem[0ex]{}{\strut\subsectionstyle{#2}}%
\raggedleft\hintstyle{} &{\strut\subsectionstyle{#2}}% \par\nobreak\addvspace{.5ex}\@afterheading}% to avoid a pagebreak after the heading
\end{tabular}%
\par\nobreak\addvspace{0.5ex}\@afterheading}% to avoid a pagebreak after the heading
\renewcommand*{\cvitem}[3][.25em]{% \renewcommand*{\cvitem}[3][.25em]{%
\begin{tabular}{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}% \begin{tabular}{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}%
@ -202,9 +198,9 @@
\ifx&#7&% \ifx&#7&%
\else{\newline{}\begin{minipage}[t]{\linewidth}\small#7\end{minipage}}\fi}} \else{\newline{}\begin{minipage}[t]{\linewidth}\small#7\end{minipage}}\fi}}
\newbox{\cvitemwithcommentmainbox} \@initializebox{\cvitemwithcommentmainbox}
\newlength{\cvitemwithcommentmainlength} \@initializelength{\cvitemwithcommentmainlength}
\newlength{\cvitemwithcommentcommentlength} \@initializelength{\cvitemwithcommentcommentlength}
\renewcommand*{\cvitemwithcomment}[4][.25em]{% \renewcommand*{\cvitemwithcomment}[4][.25em]{%
\savebox{\cvitemwithcommentmainbox}{{\bfseries#3}}% \savebox{\cvitemwithcommentmainbox}{{\bfseries#3}}%
\setlength{\cvitemwithcommentmainlength}{\widthof{\usebox{\cvitemwithcommentmainbox}}}% \setlength{\cvitemwithcommentmainlength}{\widthof{\usebox{\cvitemwithcommentmainbox}}}%