~xdanaux/moderncv/trunk

« back to all changes in this revision

Viewing changes to moderncvstyleclassic.sty

  • Committer: Xavier Danaux
  • Date: 2014-02-17 21:05:52 UTC
  • Revision ID: xdanaux@gmail.com-20140217210552-0eji2783qqzh0c8n
Simplified the \section and \subsection code of the classic style variant

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
\renewcommand*{\hintstyle}[1]{{\hintfont\textcolor{color0}{#1}}}
58
58
 
59
59
% lengths
60
 
\newlength{\quotewidth}
61
 
\newlength{\hintscolumnwidth}
 
60
\@initializelength{\quotewidth}
 
61
\@initializelength{\hintscolumnwidth}
62
62
\setlength{\hintscolumnwidth}{0.175\textwidth}
63
 
\newlength{\separatorcolumnwidth}
 
63
\@initializelength{\separatorcolumnwidth}
64
64
\setlength{\separatorcolumnwidth}{0.025\textwidth}
65
 
\newlength{\maincolumnwidth}
66
 
\newlength{\doubleitemmaincolumnwidth}
67
 
\newlength{\listitemsymbolwidth}
 
65
\@initializelength{\maincolumnwidth}
 
66
\@initializelength{\doubleitemmaincolumnwidth}
 
67
\@initializelength{\listitemsymbolwidth}
68
68
\settowidth{\listitemsymbolwidth}{\listitemsymbol}
69
 
\newlength{\listitemmaincolumnwidth}
70
 
\newlength{\listdoubleitemmaincolumnwidth}
 
69
\@initializelength{\listitemmaincolumnwidth}
 
70
\@initializelength{\listdoubleitemmaincolumnwidth}
71
71
 
72
72
% commands
73
73
\renewcommand*{\recomputecvlengths}{%
147
147
    {{\centering\begin{minipage}{\quotewidth}\centering\quotestyle{\@quote}\end{minipage}\\[2.5em]}}%
148
148
  \par}% to avoid weird spacing bug at the first section if no blank line is left after \makecvtitle
149
149
 
150
 
\newlength{\baseletterheight}
 
150
\@initializelength{\baseletterheight}
151
151
\settoheight{\baseletterheight}{\sectionstyle{o}}
152
152
\setlength{\baseletterheight}{\baseletterheight-0.95ex}
153
153
\RenewDocumentCommand{\section}{sm}{%
154
154
  \par\addvspace{2.5ex}%
155
155
  \phantomsection{}% reset the anchor for hyperrefs
156
156
  \addcontentsline{toc}{section}{#2}%
157
 
  \parbox[t]{\hintscolumnwidth}{\strut\raggedleft\raisebox{\baseletterheight}{\color{color1}\rule{\hintscolumnwidth}{0.95ex}}}%
158
 
  \hspace{\separatorcolumnwidth}%
159
 
  \parbox[t]{\maincolumnwidth}{\strut\sectionstyle{#2}}%
 
157
  \cvitem[0ex]{\strut\raggedleft\raisebox{\baseletterheight}{\color{color1}\rule{\hintscolumnwidth}{0.95ex}}}{\strut\sectionstyle{#2}}%
160
158
  \par\nobreak\addvspace{1ex}\@afterheading}% to avoid a pagebreak after the heading
161
159
 
162
160
\RenewDocumentCommand{\subsection}{sm}{%
163
161
  \par\addvspace{1ex}%
164
162
  \phantomsection{}% reset the anchor for hyperrefs
165
163
  \addcontentsline{toc}{subsection}{#2}%
166
 
  \begin{tabular}{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}%
167
 
    \raggedleft\hintstyle{} &{\strut\subsectionstyle{#2}}%
168
 
  \end{tabular}%
169
 
  \par\nobreak\addvspace{0.5ex}\@afterheading}% to avoid a pagebreak after the heading
 
164
  \cvitem[0ex]{}{\strut\subsectionstyle{#2}}%
 
165
  \par\nobreak\addvspace{.5ex}\@afterheading}% to avoid a pagebreak after the heading
170
166
 
171
167
\renewcommand*{\cvitem}[3][.25em]{%
172
168
  \begin{tabular}{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}%
175
171
  \par\addvspace{#1}}
176
172
 
177
173
\renewcommand*{\cvdoubleitem}[5][.25em]{%
178
 
 \cvitem[#1]{#2}{%
179
 
   \begin{minipage}[t]{\doubleitemmaincolumnwidth}#3\end{minipage}%
180
 
   \hfill% fill of \separatorcolumnwidth
181
 
   \begin{minipage}[t]{\hintscolumnwidth}\raggedleft\hintstyle{#4}\end{minipage}%
182
 
   \hspace*{\separatorcolumnwidth}%
183
 
   \begin{minipage}[t]{\doubleitemmaincolumnwidth}#5\end{minipage}}}
 
174
  \cvitem[#1]{#2}{%
 
175
    \begin{minipage}[t]{\doubleitemmaincolumnwidth}#3\end{minipage}%
 
176
    \hfill% fill of \separatorcolumnwidth
 
177
    \begin{minipage}[t]{\hintscolumnwidth}\raggedleft\hintstyle{#4}\end{minipage}%
 
178
    \hspace*{\separatorcolumnwidth}%
 
179
    \begin{minipage}[t]{\doubleitemmaincolumnwidth}#5\end{minipage}}}
184
180
 
185
181
\renewcommand*{\cvlistitem}[2][.25em]{%
186
182
  \cvitem[#1]{}{\listitemsymbol\begin{minipage}[t]{\listitemmaincolumnwidth}#2\end{minipage}}}
202
198
    \ifx&#7&%
203
199
      \else{\newline{}\begin{minipage}[t]{\linewidth}\small#7\end{minipage}}\fi}}
204
200
 
205
 
\newbox{\cvitemwithcommentmainbox}
206
 
\newlength{\cvitemwithcommentmainlength}
207
 
\newlength{\cvitemwithcommentcommentlength}
 
201
\@initializebox{\cvitemwithcommentmainbox}
 
202
\@initializelength{\cvitemwithcommentmainlength}
 
203
\@initializelength{\cvitemwithcommentcommentlength}
208
204
\renewcommand*{\cvitemwithcomment}[4][.25em]{%
209
205
  \savebox{\cvitemwithcommentmainbox}{{\bfseries#3}}%
210
206
  \setlength{\cvitemwithcommentmainlength}{\widthof{\usebox{\cvitemwithcommentmainbox}}}%