moderncvbodyi.sty 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. %% start of file `moderncvbodyi.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{moderncvbodyi}[2015/07/28 v2.0.0 modern curriculum vitae and letter body variant: 1]
  12. %-------------------------------------------------------------------------------
  13. % required packages
  14. %-------------------------------------------------------------------------------
  15. %-------------------------------------------------------------------------------
  16. % overall body definition
  17. %-------------------------------------------------------------------------------
  18. % fonts
  19. \renewcommand*{\sectionfont}{\Large\mdseries\upshape}
  20. \renewcommand*{\subsectionfont}{\large\mdseries\upshape}
  21. \renewcommand*{\hintfont}{}
  22. % styles
  23. \renewcommand*{\sectionstyle}[1]{{\sectionfont\textcolor{color1}{#1}}}
  24. \renewcommand*{\subsectionstyle}[1]{{\subsectionfont\textcolor{color1}{#1}}}
  25. \renewcommand*{\hintstyle}[1]{{\hintfont\textcolor{color0}{#1}}}
  26. %-------------------------------------------------------------------------------
  27. % resume body definition
  28. %-------------------------------------------------------------------------------
  29. % lengths
  30. % used by \cvitem (and all children command)
  31. \@initializelength{\hintscolumnwidth} \setlength{\hintscolumnwidth}{0.175\textwidth}
  32. \@initializelength{\separatorcolumnwidth} \setlength{\separatorcolumnwidth}{0.025\textwidth}
  33. \@initializelength{\maincolumnwidth}
  34. % used by \cvdoubleitem
  35. \@initializelength{\doubleitemcolumnwidth}
  36. % used by \cvlistitem
  37. \@initializelength{\listitemsymbolwidth} \settowidth{\listitemsymbolwidth}{\listitemsymbol}
  38. \@initializelength{\listitemcolumnwidth}
  39. % used by \cvlistdoubleitem
  40. \@initializelength{\listdoubleitemcolumnwidth}
  41. % default moderncv \photo (change the definition such that by default the photo and its box align with the section bars
  42. \RenewDocumentCommand{\photo}{O{\hintscolumnwidth-0.8pt-2\fboxsep}O{0.4pt}m}{\def\@photowidth{#1}\def\@photoframewidth{#2}\def\@photo{#3}}%
  43. % commands
  44. \renewcommand*{\recomputecvbodylengths}{%
  45. % body lengths
  46. \setlength{\maincolumnwidth}{\textwidth-\leftskip-\rightskip-\separatorcolumnwidth-\hintscolumnwidth}%
  47. \setlength{\listitemcolumnwidth}{\maincolumnwidth-\listitemsymbolwidth}%
  48. \setlength{\doubleitemcolumnwidth}{\maincolumnwidth-\hintscolumnwidth-\separatorcolumnwidth-\separatorcolumnwidth}%
  49. \setlength{\doubleitemcolumnwidth}{0.5\doubleitemcolumnwidth}%
  50. \setlength{\listdoubleitemcolumnwidth}{\maincolumnwidth-\listitemsymbolwidth-\separatorcolumnwidth-\listitemsymbolwidth}%
  51. \setlength{\listdoubleitemcolumnwidth}{0.5\listdoubleitemcolumnwidth}%
  52. % regular lengths
  53. \setlength{\parskip}{0\p@}}
  54. \@initializelength{\baseletterheight}
  55. \settoheight{\baseletterheight}{\sectionstyle{o}}
  56. \setlength{\baseletterheight}{\baseletterheight-0.95ex}
  57. \RenewDocumentCommand{\section}{sm}{%
  58. \par\addvspace{2.5ex}%
  59. \phantomsection{}% reset the anchor for hyperrefs
  60. \addcontentsline{toc}{section}{#2}%
  61. \cvitem[0ex]{\strut\raggedleft\raisebox{\baseletterheight}{\color{color1}\rule{\hintscolumnwidth}{0.95ex}}}{\strut\sectionstyle{#2}}%
  62. \par\nobreak\addvspace{1ex}\@afterheading}% to avoid a pagebreak after the heading
  63. \RenewDocumentCommand{\subsection}{sm}{%
  64. \par\addvspace{1ex}%
  65. \phantomsection{}% reset the anchor for hyperrefs
  66. \addcontentsline{toc}{subsection}{#2}%
  67. \cvitem[0ex]{}{\strut\subsectionstyle{#2}}%
  68. \par\nobreak\addvspace{.5ex}\@afterheading}% to avoid a pagebreak after the heading
  69. \renewcommand*{\cvitem}[3][.25em]{%
  70. \begin{tabular}{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}%
  71. \raggedleft\hintstyle{#2} &{#3}%
  72. \end{tabular}%
  73. \par\addvspace{#1}}
  74. \renewcommand*{\cvdoubleitem}[5][.25em]{%
  75. \cvitem[#1]{#2}{%
  76. \begin{minipage}[t]{\doubleitemcolumnwidth}#3\end{minipage}%
  77. \hfill% fill of \separatorcolumnwidth
  78. \begin{minipage}[t]{\hintscolumnwidth}\raggedleft\hintstyle{#4}\end{minipage}%
  79. \hspace*{\separatorcolumnwidth}%
  80. \begin{minipage}[t]{\doubleitemcolumnwidth}#5\end{minipage}}}
  81. \renewcommand*{\cvlistitem}[2][.25em]{%
  82. \cvitem[#1]{}{\listitemsymbol\begin{minipage}[t]{\listitemcolumnwidth}#2\end{minipage}}}
  83. \renewcommand*{\cvlistdoubleitem}[3][.25em]{%
  84. \cvitem[#1]{}{\listitemsymbol\begin{minipage}[t]{\listdoubleitemcolumnwidth}#2\end{minipage}%
  85. \hfill% fill of \separatorcolumnwidth
  86. \ifthenelse{\equal{#3}{}}%
  87. {}%
  88. {\listitemsymbol\begin{minipage}[t]{\listdoubleitemcolumnwidth}#3\end{minipage}}}}
  89. \renewcommand*{\cventry}[7][.25em]{%
  90. \cvitem[#1]{#2}{%
  91. {\bfseries#3}%
  92. \ifthenelse{\equal{#4}{}}{}{, {\slshape#4}}%
  93. \ifthenelse{\equal{#5}{}}{}{, #5}%
  94. \ifthenelse{\equal{#6}{}}{}{, #6}%
  95. .\strut%
  96. \ifx&#7&%
  97. \else{\newline{}\begin{minipage}[t]{\linewidth}\small#7\end{minipage}}\fi}}
  98. \@initializebox{\cvitemwithcommentbox}
  99. \@initializelength{\cvitemwithcommentskilllength}
  100. \@initializelength{\cvitemwithcommentcommentlength}
  101. \renewcommand*{\cvitemwithcomment}[4][.25em]{%
  102. \savebox{\cvitemwithcommentbox}{{#3}}%
  103. \setlength{\cvitemwithcommentskilllength}{\widthof{\usebox{\cvitemwithcommentbox}}}%
  104. \setlength{\cvitemwithcommentcommentlength}{\maincolumnwidth-\separatorcolumnwidth-\cvitemwithcommentskilllength}%
  105. \cvitem[#1]{#2}{%
  106. \begin{minipage}[t]{\cvitemwithcommentskilllength}\usebox{\cvitemwithcommentbox}\end{minipage}%
  107. \hfill% fill of \separatorcolumnwidth
  108. \begin{minipage}[t]{\cvitemwithcommentcommentlength}\raggedleft\small\itshape#4\end{minipage}}}
  109. \renewenvironment{thebibliography}[1]%
  110. {%
  111. \bibliographyhead{\refname}%
  112. % \small%
  113. \begin{list}{\bibliographyitemlabel}%
  114. {%
  115. \setlength{\topsep}{0pt}%
  116. \setlength{\labelwidth}{\hintscolumnwidth}%
  117. \setlength{\labelsep}{\separatorcolumnwidth}%
  118. \leftmargin\labelwidth%
  119. \advance\leftmargin\labelsep%
  120. \@openbib@code%
  121. \usecounter{enumiv}%
  122. \let\p@enumiv\@empty%
  123. \renewcommand\theenumiv{\@arabic\c@enumiv}}%
  124. \sloppy%
  125. \clubpenalty4000%\@clubpenalty \clubpenalty%
  126. \widowpenalty4000%
  127. \sfcode`\.\@m%
  128. \sfcode `\=1000\relax}%
  129. {%
  130. \def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}%
  131. \end{list}}
  132. %-------------------------------------------------------------------------------
  133. % letter style definition
  134. %-------------------------------------------------------------------------------
  135. % commands
  136. \renewcommand*{\recomputeletterbodylengths}{%
  137. \recomputecvlengths%
  138. \setlength{\parskip}{6\p@}}
  139. \renewcommand*{\makeletterclosing}{
  140. \@closing\\[3em]%
  141. {\bfseries\@firstname~\@lastname}%
  142. \ifthenelse{\isundefined{\@enclosure}}{}{%
  143. \\%
  144. \vfil%
  145. {\color{color2}\itshape\enclname: \@enclosure}}%
  146. \vfil}
  147. \endinput
  148. %% end of file `moderncvbodyi.sty'.