forked from xdanaux/moderncv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
moderncvbodyi.sty
189 lines (162 loc) · 7.99 KB
/
moderncvbodyi.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
%% start of file `moderncvbodyi.sty'.
%% Copyright 2006-2015 Xavier Danaux ([email protected]), 2020-2021 moderncv maintainers (github.com/moderncv).
%
% 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{moderncvbodyi}[2021/01/21 v2.1.0 modern curriculum vitae and letter body variant: 1]
%-------------------------------------------------------------------------------
% required packages
%-------------------------------------------------------------------------------
% provides the commands for the skillmatrix as well as the command
% \recompute@cvskillmatrix@lengths
\RequirePackage[moderncvbodyi]{moderncvskillmatrix}
%-------------------------------------------------------------------------------
% overall body definition
%-------------------------------------------------------------------------------
% fonts
\renewcommand*{\sectionfont}{\Large\mdseries\upshape}
\renewcommand*{\subsectionfont}{\large\mdseries\upshape}
\renewcommand*{\hintfont}{}
% styles
\renewcommand*{\sectionstyle}[1]{{\sectionfont\textcolor{sectioncolor}{#1}}}
\renewcommand*{\subsectionstyle}[1]{{\subsectionfont\textcolor{subsectioncolor}{#1}}}
\renewcommand*{\hintstyle}[1]{{\hintfont\textcolor{hintstylecolor}{#1}}}
%-------------------------------------------------------------------------------
% resume body definition
%-------------------------------------------------------------------------------
% lengths
% used by \cvitem (and all children command)
\@initializelength{\hintscolumnwidth} \setlength{\hintscolumnwidth}{0.175\textwidth}
\@initializelength{\separatorcolumnwidth} \setlength{\separatorcolumnwidth}{0.025\textwidth}
\@initializelength{\maincolumnwidth}
% used by \cvdoubleitem
\@initializelength{\doubleitemcolumnwidth}
% used by \cvlistitem
\@initializelength{\listitemsymbolwidth} \settowidth{\listitemsymbolwidth}{\listitemsymbol}
\@initializelength{\listitemcolumnwidth}
% used by \cvlistdoubleitem
\@initializelength{\listdoubleitemcolumnwidth}
% default moderncv \photo (change the definition such that by default the photo and its box align with the section bars
\RenewDocumentCommand{\photo}{O{\hintscolumnwidth-0.8pt-2\fboxsep}O{0.4pt}m}{\def\@photowidth{#1}\def\@photoframewidth{#2}\def\@photo{#3}}%
% commands
\renewcommand*{\recomputecvbodylengths}{%
% body lengths
\setlength{\maincolumnwidth}{\textwidth-\leftskip-\rightskip-\separatorcolumnwidth-\hintscolumnwidth}%
\setlength{\listitemcolumnwidth}{\maincolumnwidth-\listitemsymbolwidth}%
\setlength{\doubleitemcolumnwidth}{\maincolumnwidth-\hintscolumnwidth-\separatorcolumnwidth-\separatorcolumnwidth}%
\setlength{\doubleitemcolumnwidth}{0.5\doubleitemcolumnwidth}%
\setlength{\listdoubleitemcolumnwidth}{\maincolumnwidth-\listitemsymbolwidth-\separatorcolumnwidth-\listitemsymbolwidth}%
\setlength{\listdoubleitemcolumnwidth}{0.5\listdoubleitemcolumnwidth}%
\recompute@cvskillmatrix@lengths
% regular lengths
\setlength{\parskip}{0\p@}}
\@initializelength{\baseletterheight}
\settoheight{\baseletterheight}{\sectionstyle{o}}
\setlength{\baseletterheight}{\baseletterheight-0.95ex}
% leave the stretchability zero by default
% \setlength{\cvsectionstretchability}{0.0pt}
% \setlength{\cvsubsectionstretchability}{0.0pt}
% must be between -100 and 9999. The higher the less likely a page break will occur.
% This is where the page break should occur, so this number should not bee too high
% \RenewDocumentCommand\withinstretchpenalty{}{0}
% must be between -100 and 9999. The higher the less likely a page break will occur.
% \RenewDocumentCommand\poststretchpenalty{}{9999}
\RenewDocumentCommand{\section}{sm}{%
\@cvneedspace{\cvsectionstretchability}% avoid orphaned sections
\par\addvspace{2.5ex}%
\phantomsection{}% reset the anchor for hyperrefs
\addcontentsline{toc}{section}{#2}%
\cvitem[0ex]{\strut\raggedleft\raisebox{\baseletterheight}{\color{bodyrulecolor}\rule{\hintscolumnwidth}{0.95ex}}}{\strut\sectionstyle{#2}}%
\par\nobreak\addvspace{1ex}\@afterheading}% to avoid a pagebreak after the heading
\RenewDocumentCommand{\subsection}{sm}{%
\@cvneedspace{\cvsubsectionstretchability}% avoid orphaned sections
\par\addvspace{1ex}%
\phantomsection{}% reset the anchor for hyperrefs
\addcontentsline{toc}{subsection}{#2}%
\cvitem[0ex]{}{\strut\subsectionstyle{#2}}%
\par\nobreak\addvspace{.5ex}\@afterheading}% to avoid a pagebreak after the heading
\renewcommand*{\cvitem}[3][.25em]{%
\begin{tabular}{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}%
\raggedleft\hintstyle{#2} &{#3}%
\end{tabular}%
\par\addvspace{#1}}
\renewcommand*{\cvdoubleitem}[5][.25em]{%
\cvitem[#1]{#2}{%
\begin{minipage}[t]{\doubleitemcolumnwidth}#3\end{minipage}%
\hfill% fill of \separatorcolumnwidth
\begin{minipage}[t]{\hintscolumnwidth}\raggedleft\hintstyle{#4}\end{minipage}%
\hspace*{\separatorcolumnwidth}%
\begin{minipage}[t]{\doubleitemcolumnwidth}#5\end{minipage}}}
\renewcommand*{\cvlistitem}[2][.25em]{%
\cvitem[#1]{}{\listitemsymbol\begin{minipage}[t]{\listitemcolumnwidth}#2\end{minipage}}}
\renewcommand*{\cvlistdoubleitem}[3][.25em]{%
\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}}}}
\renewcommand*{\cventry}[7][.25em]{%
\cvitem[#1]{#2}{%
{\bfseries#3}%
\ifthenelse{\equal{#4}{}}{}{, {\slshape#4}}%
\ifthenelse{\equal{#5}{}}{}{, #5}%
\ifthenelse{\equal{#6}{}}{}{, #6}%
.\strut%
\ifx&%
\else{\newline{}\begin{minipage}[t]{\linewidth}\small#7\end{minipage}}\fi}}
\@initializebox{\cvitemwithcommentbox}
\@initializelength{\cvitemwithcommentskilllength}
\@initializelength{\cvitemwithcommentcommentlength}
\renewcommand*{\cvitemwithcomment}[4][.25em]{%
\savebox{\cvitemwithcommentbox}{{#3}}%
\setlength{\cvitemwithcommentskilllength}{\widthof{\usebox{\cvitemwithcommentbox}}}%
\setlength{\cvitemwithcommentcommentlength}{\maincolumnwidth-\separatorcolumnwidth-\cvitemwithcommentskilllength}%
\cvitem[#1]{#2}{%
\begin{minipage}[t]{\cvitemwithcommentskilllength}\usebox{\cvitemwithcommentbox}\end{minipage}%
\hfill% fill of \separatorcolumnwidth
\begin{minipage}[t]{\cvitemwithcommentcommentlength}\raggedleft\small\itshape#4\end{minipage}}}
\renewenvironment{thebibliography}[1]%
{%
\bibliographyhead{\refname}%
% \small%
\begin{list}{\bibliographyitemlabel}%
{%
\setlength{\topsep}{0pt}%
\setlength{\labelwidth}{\hintscolumnwidth}%
\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}}
%-------------------------------------------------------------------------------
% letter style definition
%-------------------------------------------------------------------------------
% commands
\renewcommand*{\recomputeletterbodylengths}{%
\recomputecvlengths%
\setlength{\parskip}{6\p@}}
\renewcommand*{\makeletterclosing}{
\@closing\\[3em]%
{\bfseries\@firstname~\@lastname}%
\ifthenelse{\isundefined{\@enclosure}}{}{%
\\%
\vfil%
{\color{letterclosingcolor}\itshape\enclname: \@enclosure}}%
\vfil}
\endinput
%% end of file `moderncvbodyi.sty'.