moderncvbodyiii.sty 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. %% start of file `moderncvbodyiii.sty'.
  2. %% Copyright 2006-2015 Xavier Danaux (xdanaux@gmail.com).
  3. %
  4. % This work may be distributed and/or modified under the
  5. % conditions of the LaTeX Project Public License version 1.3c,
  6. % available at http://www.latex-project.org/lppl/.
  7. %-------------------------------------------------------------------------------
  8. % identification
  9. %-------------------------------------------------------------------------------
  10. \NeedsTeXFormat{LaTeX2e}
  11. \ProvidesPackage{moderncvbodyiii}[2015/07/28 v2.0.0 modern curriculum vitae and letter body variant: 3]
  12. % rules type options: "fullrules", "shortrules", "mixedrules" (default) or "norules"
  13. \@initializeif{\if@fullrules}\@fullrulesfalse
  14. \DeclareOption{fullrules} {\@fullrulestrue\@shortrulesfalse\@mixedrulesfalse\@norulesfalse}
  15. \@initializeif{\if@shortrules}\@shortrulesfalse
  16. \DeclareOption{shortrules}{\@fullrulesfalse\@shortrulestrue\@mixedrulesfalse\@norulesfalse}
  17. \@initializeif{\if@mixedrules}\@mixedrulesfalse
  18. \DeclareOption{mixedrules}{\@fullrulesfalse\@shortrulesfalse\@mixedrulestrue\@norulesfalse}
  19. \@initializeif{\if@norules}\@norulesfalse
  20. \DeclareOption{norules} {\@fullrulesfalse\@shortrulesfalse\@mixedrulesfalse\@norulestrue}
  21. % section alignment options: "left" (default), "center" or "right"
  22. \@initializeif{\if@left}\@leftfalse
  23. \DeclareOption{left} {\@lefttrue\@centerfalse\@rightfalse}
  24. \@initializeif{\if@center}\@centerfalse
  25. \DeclareOption{center} {\@leftfalse\@centertrue\@rightfalse}
  26. \@initializeif{\if@right}\@rightfalse
  27. \DeclareOption{right} {\@leftfalse\@centerfalse\@righttrue}
  28. \DeclareOption*{}% avoid choking on unknown options
  29. \ExecuteOptions{mixedrules,left}
  30. \ProcessOptions*\relax% \ProcessOptions* processes the options in the order provided (i.e., with the later ones possibly overriding the former ones), while \ProcessOptions processes them in the order of the package
  31. %-------------------------------------------------------------------------------
  32. % required packages
  33. %-------------------------------------------------------------------------------
  34. %-------------------------------------------------------------------------------
  35. % overall body definition
  36. %-------------------------------------------------------------------------------
  37. % fonts
  38. \renewcommand*{\sectionfont}{%
  39. \if@norules%
  40. \Large\bfseries\scshape%
  41. \else%
  42. \Large\bfseries\upshape\fi}
  43. \renewcommand*{\subsectionfont}{%
  44. \if@norules%
  45. \large\mdseries\itshape%
  46. \else%
  47. \large\upshape\fontseries{sb}\selectfont\fi}
  48. \renewcommand*{\hintfont}{\bfseries}
  49. % styles
  50. \renewcommand*{\sectionstyle}[1]{{%
  51. \if@center\centering\else%
  52. \if@right\raggedleft\fi\fi%
  53. \sectionfont\textcolor{color1}{#1}%
  54. \if@shortrules\else%
  55. \par\fi}}
  56. \renewcommand*{\subsectionstyle}[1]{{%
  57. \if@center\centering\else%
  58. \if@right\raggedleft\fi\fi%
  59. \subsectionfont\textcolor{color1}{#1}%
  60. \if@shortrules\else\if@mixedrules\else%
  61. \par\fi\fi}}
  62. \renewcommand*{\hintstyle}[1]{{\hintfont\textcolor{color0}{#1}}}
  63. %-------------------------------------------------------------------------------
  64. % resume body definition
  65. %-------------------------------------------------------------------------------
  66. % lengths
  67. % used by \cvitem (and all children command)
  68. \@initializelength{\hintscolumnwidth} \setlength{\hintscolumnwidth}{0.3\textwidth}
  69. \@initializelength{\separatorcolumnwidth} \setlength{\separatorcolumnwidth}{0.025\textwidth}
  70. \@initializelength{\maincolumnwidth}
  71. % used by \cvdoubleitem
  72. \@initializelength{\doubleitemcolumnwidth}
  73. % used by \cvlistitem
  74. \@initializelength{\listitemsymbolwidth} \settowidth{\listitemsymbolwidth}{\listitemsymbol}
  75. \@initializelength{\listitemcolumnwidth}
  76. % used by \cvlistdoubleitem
  77. \@initializelength{\listdoubleitemcolumnwidth}
  78. % commands
  79. \renewcommand*{\recomputecvbodylengths}{%
  80. % body lengths
  81. \setlength{\maincolumnwidth}{\textwidth-\leftskip-\rightskip}%
  82. \setlength{\listitemcolumnwidth}{\maincolumnwidth-\listitemsymbolwidth}%
  83. \setlength{\doubleitemcolumnwidth}{\maincolumnwidth-\separatorcolumnwidth}%
  84. \setlength{\doubleitemcolumnwidth}{0.5\doubleitemcolumnwidth}%
  85. \setlength{\listdoubleitemcolumnwidth}{\maincolumnwidth-\listitemsymbolwidth-\separatorcolumnwidth-\listitemsymbolwidth}%
  86. \setlength{\listdoubleitemcolumnwidth}{0.5\listdoubleitemcolumnwidth}%
  87. % regular lengths
  88. \setlength{\parskip}{0\p@}}
  89. \RenewDocumentCommand{\section}{sm}{%
  90. \par\addvspace{2.5ex}%
  91. \phantomsection{}% reset the anchor for hyperrefs
  92. \addcontentsline{toc}{section}{#2}%
  93. \if@left\else\if@fullrules\else\if@mixedrules\else%
  94. \sectionrule\fi\fi\fi%
  95. \strut\sectionstyle{#2}%
  96. \if@fullrules%
  97. \sectionrule%
  98. \else\if@mixedrules%
  99. \sectionrule%
  100. \else\if@right\else%
  101. \sectionrule\fi\fi\fi%
  102. \par\nobreak\addvspace{1ex}\@afterheading}
  103. \RenewDocumentCommand{\subsection}{sm}{%
  104. \par\addvspace{1ex}%
  105. \phantomsection{}%
  106. \addcontentsline{toc}{subsection}{#2}%
  107. \if@left\else\if@fullrules\else%
  108. \subsectionrule\fi\fi%
  109. \strut\subsectionstyle{#2}%
  110. \if@fullrules%
  111. \subsectionrule%
  112. \else\if@right\else%
  113. \subsectionrule\fi\fi%
  114. \par\nobreak\addvspace{0.5ex}\@afterheading}
  115. \newcommand*{\sectionrule}{}
  116. \newcommand*{\subsectionrule}{}
  117. \if@fullrules%
  118. \renewcommand*{\sectionrule}{\par\nobreak\vspace*{-.7\baselineskip}\leavevmode{\color{color1}\leaders\hbox{\rule{1pt}{0.4pt}}\hfill\kern0pt}}
  119. \renewcommand*{\subsectionrule}{\par\nobreak\vspace*{-.7\baselineskip}\leavevmode{\color{color1}\xleaders\hbox to 0.35em{\scriptsize.}\hfill}}\fi% different subsectionrules 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}
  120. \if@shortrules%
  121. \renewcommand*{\sectionrule}{\leavevmode{\color{color1}\leaders\hbox{\rule{1pt}{0.4pt}}\hfill\kern0pt}}
  122. \renewcommand*{\subsectionrule}{\leavevmode{\color{color1}\xleaders\hbox to 0.35em{\scriptsize.}\hfill}}\fi% different subsectionrules 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}}
  123. \if@mixedrules%
  124. \renewcommand*{\sectionrule}{\par\nobreak\vspace*{-.7\baselineskip}\leavevmode{\color{color1}\leaders\hbox{\rule{1pt}{0.4pt}}\hfill\kern0pt}}
  125. \renewcommand*{\subsectionrule}{\leavevmode{\color{color1}\xleaders\hbox to 0.35em{\scriptsize.}\hfill}}\fi% different subsectionrules 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}}
  126. \if@norules%
  127. \renewcommand*{\sectionrule}{}
  128. \renewcommand*{\subsectionrule}{}\fi
  129. \renewcommand*{\cvitem}[3][.25em]{%
  130. \ifthenelse{\equal{#2}{}}{}{\hintstyle{#2}: }{#3}%
  131. \par\addvspace{#1}}
  132. \renewcommand*{\cvdoubleitem}[5][.25em]{%
  133. \begin{minipage}[t]{\doubleitemcolumnwidth}\hintstyle{#2}: #3\end{minipage}%
  134. \hfill% fill of \separatorcolumnwidth
  135. \begin{minipage}[t]{\doubleitemcolumnwidth}\ifthenelse{\equal{#4}{}}{}{\hintstyle{#4}: }#5\end{minipage}%
  136. \par\addvspace{#1}}
  137. \renewcommand*{\cvlistitem}[2][.25em]{%
  138. \listitemsymbol\begin{minipage}[t]{\listitemcolumnwidth}#2\end{minipage}%
  139. \par\addvspace{#1}}
  140. \renewcommand*{\cvlistdoubleitem}[3][.25em]{%
  141. \cvitem[#1]{}{\listitemsymbol\begin{minipage}[t]{\listdoubleitemcolumnwidth}#2\end{minipage}%
  142. \hfill% fill of \separatorcolumnwidth
  143. \ifthenelse{\equal{#3}{}}%
  144. {}%
  145. {\listitemsymbol\begin{minipage}[t]{\listdoubleitemcolumnwidth}#3\end{minipage}}}}
  146. \renewcommand*{\cventry}[7][.25em]{
  147. \begin{tabular*}{\maincolumnwidth}{l@{\extracolsep{\fill}}r}%
  148. {\bfseries #4} & {\bfseries #5}\\%
  149. {\itshape #3\ifthenelse{\equal{#6}{}}{}{, #6}} & {\itshape #2}\\%
  150. \end{tabular*}%
  151. \ifx&#7&%
  152. \else{\\%
  153. \begin{minipage}{\maincolumnwidth}%
  154. \small#7%
  155. \end{minipage}}\fi%
  156. \par\addvspace{#1}}
  157. \@initializebox{\cvitemwithcommentmainbox}
  158. \@initializelength{\cvitemwithcommentmainlength}
  159. \@initializelength{\cvitemwithcommentcommentlength}
  160. \renewcommand*{\cvitemwithcomment}[4][.25em]{%
  161. \savebox{\cvitemwithcommentmainbox}{\ifthenelse{\equal{#2}{}}{}{\hintstyle{#2}: }#3}%
  162. \setlength{\cvitemwithcommentmainlength}{\widthof{\usebox{\cvitemwithcommentmainbox}}}%
  163. \setlength{\cvitemwithcommentcommentlength}{\maincolumnwidth-\separatorcolumnwidth-\cvitemwithcommentmainlength}%
  164. \begin{minipage}[t]{\cvitemwithcommentmainlength}\usebox{\cvitemwithcommentmainbox}\end{minipage}%
  165. \hfill% fill of \separatorcolumnwidth
  166. \begin{minipage}[t]{\cvitemwithcommentcommentlength}\raggedleft\small\itshape#4\end{minipage}%
  167. \par\addvspace{#1}}
  168. \renewenvironment{thebibliography}[1]%
  169. {%
  170. \bibliographyhead{\refname}%
  171. % \small%
  172. \begin{list}{\bibliographyitemlabel}%
  173. {%
  174. \setlength{\topsep}{0pt}%
  175. \setlength{\labelwidth}{0pt}%
  176. \ifthenelse{\equal{\bibliographyitemlabel}{}}%
  177. {\setlength{\labelsep}{0pt}}%
  178. {\setlength{\labelsep}{\separatorcolumnwidth}}%
  179. \leftmargin\labelwidth%
  180. \advance\leftmargin\labelsep%
  181. \@openbib@code%
  182. \usecounter{enumiv}%
  183. \let\p@enumiv\@empty%
  184. \renewcommand\theenumiv{\@arabic\c@enumiv}}%
  185. \sloppy%
  186. \clubpenalty4000%\@clubpenalty \clubpenalty%
  187. \widowpenalty4000%
  188. \sfcode`\.\@m%
  189. \sfcode `\=1000\relax}%
  190. {%
  191. \def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}%
  192. \end{list}}
  193. %-------------------------------------------------------------------------------
  194. % letter style definition
  195. %-------------------------------------------------------------------------------
  196. % commands
  197. \renewcommand*{\recomputeletterbodylengths}{%
  198. \recomputecvbodylengths%
  199. \setlength{\parskip}{6\p@}}
  200. \renewcommand*{\makeletterclosing}{
  201. \@closing\\[3em]%
  202. {\bfseries\@firstname~\@lastname}%
  203. \ifthenelse{\isundefined{\@enclosure}}{}{%
  204. \\%
  205. \vfil%
  206. {\color{color2}\itshape\enclname: \@enclosure}}%
  207. \vfil}
  208. \endinput
  209. %% end of file `moderncvbodyiii.sty'.