about summary refs log tree commit diff
path: root/users/grfn/resume/moderncvstylebanking.sty
blob: fb0b70fdcd10b2ea0b356d9a25484ed04cc26634 (plain) (blame)
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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
%% start of file `moderncvstylebanking.sty'.
%% Copyright 2006-2013 Xavier Danaux (xdanaux@gmail.com).
%
% 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{moderncvstylebanking}[2013/02/09 v1.3.0 modern curriculum vitae and letter style scheme: banking]


%-------------------------------------------------------------------------------
%                required packages
%-------------------------------------------------------------------------------


%-------------------------------------------------------------------------------
%                overall style definition
%-------------------------------------------------------------------------------
% fonts
%\ifxetexorluatex
%  \setmainfont{Tex-Gyre Pagella}
%  \setsansfont{Tex-Gyre Pagella}
%  \setmathfont{Tex-Gyre Pagella}
%  \setmathfont[range=\mathit,\mathsfit]{Tex-Gyre Pagella Italic}
%  \setmathfont[range=\mathbfup,\mathbfsfup]{Tex-Gyre Pagella Bold}
%  \setmathfont[range=\mathbfit,\mathbfsfit]{Tex-Gyre Pagella Bold Italic}
%\else
  \IfFileExists{tgpagella.sty}%
    {%
      \RequirePackage{tgpagella}%
      \renewcommand*{\familydefault}{\rmdefault}}%
    {}
%\fi

% symbols
\moderncvicons{marvosym}

% commands
\newcommand*{\maketitlesymbol}{%
    {~~~{\rmfamily\textbullet}~~~}}% the \rmfamily is required to force Latin Modern fonts when using sans serif, as OMS/lmss/m/n is not defined and gets substituted by OMS/cmsy/m/n
%   internal command to add an element to the footer
%   it collects the elements in a temporary box, and checks when to flush the box
\newsavebox{\maketitlebox}%
\newsavebox{\maketitletempbox}%
\newlength{\maketitlewidth}%
\newlength{\maketitleboxwidth}%
\newif\if@firstmaketitleelement\@firstmaketitleelementtrue%
%   adds an element to the maketitle, separated by maketitlesymbol
%   usage: \addtomaketitle[maketitlesymbol]{element}
\newcommand*{\addtomaketitle}[2][\maketitlesymbol]{%
  \if@firstmaketitleelement%
    \savebox{\maketitletempbox}{\usebox{\maketitlebox}#2}%
  \else%
    \savebox{\maketitletempbox}{\usebox{\maketitlebox}#1#2}\fi%
  \settowidth{\maketitleboxwidth}{\usebox{\maketitletempbox}}%
  \ifnum\maketitleboxwidth<\maketitlewidth%
    \savebox{\maketitlebox}{\usebox{\maketitletempbox}}%
    \@firstmaketitleelementfalse%
  \else%
    \flushmaketitle{}\\%
    \savebox{\maketitlebox}{#2}%
    \savebox{\maketitletempbox}{#2}%
    \settowidth{\maketitleboxwidth}{\usebox{\maketitlebox}}%
    \@firstmaketitleelementfalse\fi}
%   internal command to flush the maketitle
\newcommand*{\flushmaketitle}{%
  \strut\usebox{\maketitlebox}%
  \savebox{\maketitlebox}{}%
  \savebox{\maketitletempbox}{}%
  \setlength{\maketitleboxwidth}{0pt}}
\renewcommand*{\maketitle}{%
  \setlength{\maketitlewidth}{0.8\textwidth}%
  \hfil%
  \parbox{\maketitlewidth}{%
    \centering%
    % name and title
    \namestyle{\@firstname~\@lastname}%
    \ifthenelse{\equal{\@title}{}}{}{\titlestyle{~|~\@title}}\\% \isundefined doesn't work on \@title, as LaTeX itself defines \@title (before it possibly gets redefined by \title) 
    % detailed information
    \addressfont\color{color2}%
    \ifthenelse{\isundefined{\@addressstreet}}{}{\addtomaketitle{\addresssymbol\@addressstreet}%
      \ifthenelse{\equal{\@addresscity}{}}{}{\addtomaketitle[~--~]{\@addresscity}}% if \addresstreet is defined, \addresscity and \addresscountry will always be defined but could be empty
      \ifthenelse{\equal{\@addresscountry}{}}{}{\addtomaketitle[~--~]{\@addresscountry}}%
      \flushmaketitle\@firstmaketitleelementtrue\\}%
    \collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
      \addtomaketitle{\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}}%
    \ifthenelse{\isundefined{\@email}}{}{\addtomaketitle{\emailsymbol\emaillink{\@email}}}%
    \ifthenelse{\isundefined{\@homepage}}{}{\addtomaketitle{\homepagesymbol\httplink{\@homepage}}}%
    \ifthenelse{\isundefined{\@extrainfo}}{}{\addtomaketitle{\@extrainfo}}%
    \flushmaketitle}\\[2.5em]}% need to force a \par after this to avoid weird spacing bug at the first section if no blank line is left after \maketitle


%-------------------------------------------------------------------------------
%                resume style definition
%-------------------------------------------------------------------------------
% fonts
\renewcommand*{\namefont}{\Huge\bfseries\upshape}
\renewcommand*{\titlefont}{\Huge\mdseries\upshape}
\renewcommand*{\addressfont}{\normalsize\mdseries\upshape}
\renewcommand*{\quotefont}{\large\slshape}
\renewcommand*{\sectionfont}{\Large\bfseries\upshape}
\renewcommand*{\subsectionfont}{\large\upshape\fontseries{sb}\selectfont}
\renewcommand*{\hintfont}{\bfseries}

% styles
\renewcommand*{\namestyle}[1]{{\namefont\textcolor{color1}{#1}}}
\renewcommand*{\titlestyle}[1]{{\titlefont\textcolor{color2!85}{#1}}}
\renewcommand*{\addressstyle}[1]{{\addressfont\textcolor{color1}{#1}}}
\renewcommand*{\quotestyle}[1]{{\quotefont\textcolor{color1}{#1}}}
\renewcommand*{\sectionstyle}[1]{{\sectionfont\textcolor{color1}{#1}}}
\renewcommand*{\subsectionstyle}[1]{{\subsectionfont\textcolor{color1}{#1}}}
\renewcommand*{\hintstyle}[1]{{\hintfont\textcolor{color0}{#1}}}

% lengths
\newlength{\quotewidth}
\newlength{\hintscolumnwidth}
\setlength{\hintscolumnwidth}{0.3\textwidth}%
\newlength{\separatorcolumnwidth}
\setlength{\separatorcolumnwidth}{0.025\textwidth}%
\newlength{\maincolumnwidth}
\newlength{\doubleitemcolumnwidth}
\newlength{\listitemsymbolwidth}
\settowidth{\listitemsymbolwidth}{\listitemsymbol}
\newlength{\listitemmaincolumnwidth}
\newlength{\listdoubleitemmaincolumnwidth}

% commands
\renewcommand*{\recomputecvlengths}{%
  \setlength{\quotewidth}{0.65\textwidth}%
  % main lenghts
  \setlength{\maincolumnwidth}{\textwidth}%
  % listitem lengths
  \setlength{\listitemmaincolumnwidth}{\maincolumnwidth-\listitemsymbolwidth}%
  % doubleitem lengths
  \setlength{\doubleitemcolumnwidth}{\maincolumnwidth-\separatorcolumnwidth}%
  \setlength{\doubleitemcolumnwidth}{0.5\doubleitemcolumnwidth}%
  % listdoubleitem lengths
  \setlength{\listdoubleitemmaincolumnwidth}{\maincolumnwidth-\listitemsymbolwidth-\separatorcolumnwidth-\listitemsymbolwidth}%
  \setlength{\listdoubleitemmaincolumnwidth}{0.5\listdoubleitemmaincolumnwidth}%
  % fancyhdr lengths
  \renewcommand{\headwidth}{\textwidth}%
  % regular lengths
  \setlength{\parskip}{0\p@}}

\renewcommand*{\makecvtitle}{%
  % recompute lengths (in case we are switching from letter to resume, or vice versa)
  \recomputecvlengths%
  \maketitle%
  % optional quote
  \ifthenelse{\isundefined{\@quote}}%
    {}%
    {{\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 \maketitle}

\RenewDocumentCommand{\section}{sm}{%
  \par\addvspace{2.5ex}%
  \phantomsection{}% reset the anchor for hyperrefs
  \addcontentsline{toc}{section}{#2}%
  \strut\sectionstyle{#2}%
  {\color{color1}\hrule}%
  \par\nobreak\addvspace{1ex}\@afterheading}

\newcommand{\subsectionfill}{\xleaders\hbox to 0.35em{\scriptsize.}\hfill}% different subsectionfills will not be perfectly aligned, but remaining space at the end of the fill will be distributed evenly between leaders, so it will be barely visible
\RenewDocumentCommand{\subsection}{sm}{%
  \par\addvspace{1ex}%
  \phantomsection{}%
  \addcontentsline{toc}{subsection}{#2}%
  \strut\subsectionstyle{#2}{\color{color1}{\subsectionfill}}%
  \par\nobreak\addvspace{0.5ex}\@afterheading}

\renewcommand*{\cvitem}[3][.25em]{%
  \ifthenelse{\equal{#2}{}}{}{\hintstyle{#2}: }{#3}%
  \par\addvspace{#1}}

\renewcommand*{\cvdoubleitem}[5][.25em]{%
  \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}%
  \par\addvspace{#1}}

\renewcommand*{\cvlistitem}[2][.25em]{%
  \listitemsymbol\begin{minipage}[t]{\listitemmaincolumnwidth}#2\end{minipage}%
  \par\addvspace{#1}}

\renewcommand*{\cvlistdoubleitem}[3][.25em]{%
  \cvitem[#1]{}{\listitemsymbol\begin{minipage}[t]{\listdoubleitemmaincolumnwidth}#2\end{minipage}%
  \hfill% fill of \separatorcolumnwidth
  \ifthenelse{\equal{#3}{}}%
    {}%
    {\listitemsymbol\begin{minipage}[t]{\listdoubleitemmaincolumnwidth}#3\end{minipage}}}}

\renewcommand*{\cventry}[7][.25em]{
  \begin{tabular*}{\textwidth}{l@{\extracolsep{\fill}}r}%
	  {\bfseries #4} & {\bfseries #5} \\%
	  {\itshape #3\ifthenelse{\equal{#6}{}}{}{, #6}} & {\itshape #2}\\%
  \end{tabular*}%
  \ifx&#7&%
    \else{\\\vbox{\small#7}}\fi%
  \par\addvspace{#1}}

\newbox{\cvitemwithcommentmainbox}
\newlength{\cvitemwithcommentmainlength}
\newlength{\cvitemwithcommentcommentlength}
\renewcommand*{\cvitemwithcomment}[4][.25em]{%
  \savebox{\cvitemwithcommentmainbox}{\ifthenelse{\equal{#2}{}}{}{\hintstyle{#2}: }#3}%
  \setlength{\cvitemwithcommentmainlength}{\widthof{\usebox{\cvitemwithcommentmainbox}}}%
  \setlength{\cvitemwithcommentcommentlength}{\maincolumnwidth-\separatorcolumnwidth-\cvitemwithcommentmainlength}%
  \begin{minipage}[t]{\cvitemwithcommentmainlength}\ifthenelse{\equal{#2}{}}{}{\hintstyle{#2}: }#3\end{minipage}%
  \hfill% fill of \separatorcolumnwidth
  \begin{minipage}[t]{\cvitemwithcommentcommentlength}\raggedleft\small\itshape#4\end{minipage}%
  \par\addvspace{#1}}

\renewenvironment{thebibliography}[1]%
  {%
    \bibliographyhead{\refname}%
%    \small%
    \begin{list}{\bibliographyitemlabel}%
      {%
        \setlength{\topsep}{0pt}%
        \setlength{\labelwidth}{0pt}%
        \setlength{\labelsep}{0pt}%
        \leftmargin\labelwidth%
        \advance\leftmargin\labelsep%
        \@openbib@code%
        \usecounter{enumiv}%
        \let\p@enumiv\@empty%
        \renewcommand\theenumiv{\@arabic\c@enumiv}}%
        \sloppy\clubpenalty4000\widowpenalty4000%
%        \sfcode`\.\@m%
%        \sfcode `\=1000\relax%
  }%
  {%
    \def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}%
    \end{list}%
  }


%-------------------------------------------------------------------------------
%                letter style definition
%-------------------------------------------------------------------------------
% commands
\renewcommand*{\recomputeletterlengths}{
  \recomputecvlengths%
  \setlength{\parskip}{6\p@}}

\renewcommand*{\makelettertitle}{%
  % recompute lengths (in case we are switching from letter to resume, or vice versa)
  \recomputeletterlengths%
  % sender block
  \maketitle%
  \par%
   % recipient block
  \begin{minipage}[t]{.5\textwidth}
    \raggedright%
    \addressfont%
    {\bfseries\upshape\@recipientname}\\%
    \@recipientaddress%
  \end{minipage}
  % date
  \hfill % US style
%  \\[1em] % UK style
  \@date\\[2em]% US informal style: "April 6, 2006"; UK formal style: "05/04/2006"
  % opening
  \raggedright%
  \@opening\\[1.5em]%
  % ensure no extra spacing after \makelettertitle due to a possible blank line
%  \ignorespacesafterend% not working
  \hspace{0pt}\par\vspace{-\baselineskip}\vspace{-\parskip}}

\renewcommand*{\makeletterclosing}{
  \@closing\\[3em]%
  {\bfseries \@firstname~\@lastname}%
  \ifthenelse{\isundefined{\@enclosure}}{}{%
    \\%
    \vfill%
    {\color{color2}\itshape\enclname: \@enclosure}}}


\endinput


%% end of file `moderncvstylebanking.sty'.