-
Notifications
You must be signed in to change notification settings - Fork 566
/
moderncvbodyv.sty
210 lines (182 loc) · 8.75 KB
/
moderncvbodyv.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
%% start of file `moderncvbodyv.sty'.
%% Copyright 2015-2015 Xavier Danaux ([email protected]).
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License version 1.3c,
% available at http://www.latex-project.org/lppl/.
%-------------------------------------------------------------------------------
% identification
%-------------------------------------------------------------------------------
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{moderncvbodyv}[2015/07/28 v2.0.0 modern curriculum vitae and letter body variant: 5]
%-------------------------------------------------------------------------------
% required packages
%-------------------------------------------------------------------------------
%-------------------------------------------------------------------------------
% overall style definition
%-------------------------------------------------------------------------------
%-------------------------------------------------------------------------------
% resume style definition
%-------------------------------------------------------------------------------
% fonts
\renewcommand*{\sectionfont}{\Large\mdseries\upshape}
\renewcommand*{\subsectionfont}{\large\mdseries\slshape}
\renewcommand*{\hintfont}{\bfseries}
% styles
\renewcommand*{\sectionstyle}[1]{{\sectionfont\textcolor{color1}{#1}}}
\renewcommand*{\subsectionstyle}[1]{{\subsectionfont\textcolor{color1}{#1}}}
\renewcommand*{\hintstyle}[1]{{\hintfont\textcolor{color0}{#1}}}
% lengths
% used by \cvitem (and all children command)
\@initializelength{\hintscolumnwidth} \setlength{\hintscolumnwidth}{0.25\textwidth}
\@initializelength{\separatorcolumnwidth} \setlength{\separatorcolumnwidth}{0.025\textwidth}
\@initializelength{\separatorrulewidth} \setlength{\separatorrulewidth}{1.2\p@}%
\@initializelength{\maincolumnwidth}
% used by \cvdoubleitem
\@initializelength{\doubleitemcolumnwidth}
% used by \cvlistitem
\@initializelength{\listitemsymbolwidth} \settowidth{\listitemsymbolwidth}{\listitemsymbol}
\@initializelength{\listitemcolumnwidth}
%\@initializelength{\listitemmaincolumnwidth}
% used by \cvlistdoubleitem
\@initializelength{\listdoubleitemcolumnwidth}
%\@initializelength{\listdoubleitemmaincolumnwidth}
% commands
\@initializecommand{\recomputecvbodylengths}{%
% body lengths
\setlength{\maincolumnwidth}{\textwidth-\leftskip-\rightskip-\separatorcolumnwidth-\separatorcolumnwidth-\hintscolumnwidth-\separatorrulewidth}%
\setlength{\listitemcolumnwidth}{\maincolumnwidth-\listitemsymbolwidth}%
\setlength{\doubleitemcolumnwidth}{\maincolumnwidth-\separatorcolumnwidth}%
\setlength{\doubleitemcolumnwidth}{0.5\doubleitemcolumnwidth}%
\setlength{\listdoubleitemcolumnwidth}{\maincolumnwidth-\listitemsymbolwidth-\separatorcolumnwidth-\listitemsymbolwidth}%
\setlength{\listdoubleitemcolumnwidth}{0.5\listdoubleitemcolumnwidth}%
% regular lengths
\setlength{\parskip}{0\p@}}
\@initializeif{\if@aftersection}\@aftersectionfalse%
\RenewDocumentCommand{\section}{sm}{%
\addvspace{2.5ex}%
\phantomsection{}% reset the anchor for hyperrefs
\addcontentsline{toc}{section}{#2}%
\noindent\rlap{\@cvitem{\raggedleft\sectionstyle{#2}}{}}%
\nobreak\@afterheading\@aftersectiontrue\ignorespaces}
%\@initializeif{\if@aftersubsection}\@aftersubsectionfalse%
\RenewDocumentCommand{\subsection}{sm}{%
%\addvspace{1ex}%
\vspace*{-\arrayrulewidth}% HACK; I don't understand where the space is coming from, nor what it's exact value is :(
\if@aftersection%
\par\ignorespaces\fi%
\phantomsection{}% reset the anchor for hyperrefs
\addcontentsline{toc}{subsection}{#2}%
\noindent\rlap{\@cvitem{\if@aftersection\else\@moderncvstrut{4pt}{24pt}\fi\raggedleft\subsectionstyle{#2}}{}}%
\nobreak\@afterheading\@aftersectiontrue\ignorespaces}
\renewcommand*{\cvitem}[3][.5ex]{%
\@cvitem[#1]{}{\ifthenelse{\equal{#2}{}}{}{\hintstyle{#2}: }{#3}}}
% underlying command to implement \cvitem, \subsection and \section
\newcommand*{\@cvitem}[3][.5ex]{%
\arrayrulecolor{color1}%
\setlength\arrayrulewidth{\separatorrulewidth}%
\if@aftersection\else%
\vspace*{-\separatorrulewidth}\fi% HACK; I don't understand where the space is coming from, nor what it's exact value is :(
\noindent%
% \setlength{\fboxsep}{0pt}\framebox{% start of debuging
\begin{tabular}[t]{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}|@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}%
\@moderncvstrut{4pt}{16pt}#2 \\[#1]% the spacing needs to be inside the cell for the vertical rule to extend correctly
\end{tabular}%
% }% end of debuging
\par\@aftersectionfalse\ignorespaces}
\renewcommand*{\cvdoubleitem}[5][.5ex]{%
\@cvitem[#1]{}{%
\begin{minipage}[t]{\doubleitemcolumnwidth}\hintstyle{#2}: #3\end{minipage}%
\hfill% fill of \separatorcolumnwidth
\begin{minipage}[t]{\doubleitemcolumnwidth}\ifthenelse{\equal{#4}{}}{}{\hintstyle{#4}: }#5\end{minipage}}}
\renewcommand*{\cvlistitem}[2][.5ex]{%
\@cvitem[#1]{}{\listitemsymbol\begin{minipage}[t]{\listitemcolumnwidth}#2\end{minipage}}}
\renewcommand*{\cvlistdoubleitem}[3][.5ex]{%
\@cvitem[#1]{}{\listitemsymbol\begin{minipage}[t]{\listdoubleitemcolumnwidth}#2\end{minipage}%
\hfill% fill of \separatorcolumnwidth
\ifthenelse{\equal{#3}{}}%
{}%
{\listitemsymbol\begin{minipage}[t]{\listdoubleitemcolumnwidth}#3\end{minipage}}}}
\@initializebox{\cventryyearbox}
\@initializelength{\cventrytitleboxwidth}
\renewcommand*{\cventry}[7][.5ex]{%
\savebox{\cventryyearbox}{%
\hspace*{2\separatorcolumnwidth}%
\hintstyle{#2}}%
\setlength{\cventrytitleboxwidth}{\widthof{\usebox{\cventryyearbox}}}%
\setlength{\cventrytitleboxwidth}{\maincolumnwidth-\cventrytitleboxwidth}%
\cvitem[#1]{}{%
\parbox[t]{\cventrytitleboxwidth}{%
\strut%
{\bfseries#3}%
\ifthenelse{\equal{#4}{}}{}{, {\slshape#4}}%
\ifthenelse{\equal{#5}{}}{}{, #5}%
\ifthenelse{\equal{#6}{}}{}{, #6}%
.\strut}%
\usebox{\cventryyearbox}}%
\ifx&%
\else%
\vspace*{-4pt}%
\cvitem[#1]{}{\small#7}\fi}
\@initializebox{\cvitemwithcommentmainbox}
\@initializelength{\cvitemwithcommentmainlength}
\@initializelength{\cvitemwithcommentcommentlength}
\renewcommand*{\cvitemwithcomment}[4][.5ex]{%
\savebox{\cvitemwithcommentmainbox}{\ifthenelse{\equal{#2}{}}{}{\hintstyle{#2}: }#3}%
\setlength{\cvitemwithcommentmainlength}{\widthof{\usebox{\cvitemwithcommentmainbox}}}%
\setlength{\cvitemwithcommentcommentlength}{\maincolumnwidth-\separatorcolumnwidth-\cvitemwithcommentmainlength}%
\@cvitem[#1]{}{%
\begin{minipage}[t]{\cvitemwithcommentmainlength}\usebox{\cvitemwithcommentmainbox}\end{minipage}%
\hfill% fill of \separatorcolumnwidth
\begin{minipage}[t]{\cvitemwithcommentcommentlength}\raggedleft\small\itshape#4\end{minipage}}}
\renewenvironment{thebibliography}[1]% BUG/TODO: remove extra space between heading and first bibliography entry, as well as after last one
{%
\bibliographyhead{\refname}%
% \small%
\arrayrulecolor{color1}%
\setlength\arrayrulewidth{\separatorrulewidth}%
\noindent%
\begin{tabular}[t]{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}|@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}%
\@moderncvstrut{4pt}{16pt} &%
\begin{list}{\bibliographyitemlabel}{%
\setlength{\topsep}{0pt}%
\setlength{\partopsep}{0pt}%
\setlength{\labelwidth}{0pt}%
\setlength{\itemsep}{0pt}%
\setlength{\parskip}{0pt}%
\ifthenelse{\equal{\bibliographyitemlabel}{}}%
{\setlength{\labelsep}{0pt}}%
{\setlength{\labelsep}{\separatorcolumnwidth}}%
\leftmargin\labelwidth%
\advance\leftmargin\labelsep%
\@openbib@code%
\usecounter{enumiv}%
\let\p@enumiv\@empty%
\renewcommand\theenumiv{\@arabic\c@enumiv}}%
\sloppy%
\clubpenalty4000%\@clubpenalty \clubpenalty%
\widowpenalty4000%
\sfcode`\.\@m%
\sfcode `\=1000\relax}%
{%
\def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}%
\end{list}%
\\[.5ex]%
\end{tabular}%
\par\@aftersectionfalse\ignorespaces}
%-------------------------------------------------------------------------------
% letter style definition
%-------------------------------------------------------------------------------
% commands
\renewcommand*{\recomputeletterbodylengths}{%
\recomputecvbodylengths%
\setlength{\parskip}{6\p@}}
\renewcommand*{\makeletterclosing}{
\@closing\\[3em]%
{\bfseries \@firstname~\@lastname}%
\ifthenelse{\isundefined{\@enclosure}}{}{%
\\%
\vfill%
{\color{color2}\itshape\enclname: \@enclosure}}}
\endinput
%% end of file `moderncvbodyv.sty'.