moderncvheadv.sty 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. %% start of file `moderncvheadv.sty'.
  2. %% Copyright 2015-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{moderncvheadv}[2015/07/28 v2.0.0 modern curriculum vitae and letter header variant: 5]
  12. % details options: "details" (default) or "nodetails"
  13. \@initializeif{\if@details}\@detailsfalse
  14. \DeclareOption{details} {\@detailstrue}
  15. \DeclareOption{nodetails} {\@detailsfalse}
  16. \DeclareOption*{}% avoid choking on unknown options
  17. \ExecuteOptions{details}
  18. \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
  19. %-------------------------------------------------------------------------------
  20. % required packages
  21. %-------------------------------------------------------------------------------
  22. %-------------------------------------------------------------------------------
  23. % overall head definition
  24. %-------------------------------------------------------------------------------
  25. % fonts
  26. \renewcommand*{\namefont}{\fontsize{34}{36}\mdseries\upshape}
  27. \renewcommand*{\titlefont}{\LARGE\mdseries\slshape}
  28. \renewcommand*{\addressfont}{\small\mdseries\slshape}
  29. \renewcommand*{\quotefont}{\large\slshape}
  30. % styles
  31. \renewcommand*{\namestyle}[1]{{\namefont\textcolor{color0}{#1}}}
  32. \renewcommand*{\titlestyle}[1]{{\titlefont\textcolor{color2}{#1}}}
  33. \renewcommand*{\addressstyle}[1]{{\addressfont\textcolor{color2}{#1}}}
  34. \renewcommand*{\quotestyle}[1]{{\quotefont\textcolor{color1}{#1}}}
  35. %-------------------------------------------------------------------------------
  36. % resume head definition
  37. %-------------------------------------------------------------------------------
  38. % lengths
  39. \@initializelength{\quotewidth}
  40. % optional makecvheadname width to force a certain width (if set/remains to 0pt, the width is calculated automatically)
  41. \@initializelength{\makecvheadnamewidth}
  42. \renewcommand*{\recomputecvheadlengths}{%
  43. \setlength{\quotewidth}{0.65\textwidth}}
  44. % commands
  45. \renewcommand*{\makecvhead}{%
  46. % recompute lengths (in case we are switching from letter to resume, or vice versa)
  47. \recomputecvlengths%
  48. % optional photo (pre-rendering)
  49. \@initializebox{\makecvheadpicturebox}%
  50. \savebox{\makecvheadpicturebox}{%
  51. \ifthenelse{\isundefined{\@photo}}%
  52. {}%
  53. {%
  54. \color{color1}%
  55. \setlength{\fboxrule}{\@photoframewidth}%
  56. \ifdim\@photoframewidth=0pt%
  57. \setlength{\fboxsep}{0pt}\fi%
  58. \framebox{\includegraphics[width=\@photowidth]{\@photo}}}}%
  59. % rendering
  60. \@makecvtitle%
  61. {%
  62. \raggedleft%
  63. % optional photo
  64. \usebox{\makecvheadpicturebox}%
  65. % optional details
  66. \if@details%
  67. \ifthenelse{\isundefined{\@photo}}{}{\\[0.5em]}%
  68. \addressfont\color{color2}%
  69. \ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\addresssymbol\@addressstreet%
  70. \ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}% if \addresstreet is defined, \addresscity and \addresscountry will always be defined but could be empty
  71. \ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}}%
  72. \collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
  73. \makenewline\csname\collectionloopkey phonesymbol\endcsname~\collectionloopitem}%
  74. \ifthenelse{\isundefined{\@email}}{}{\makenewline\emailsymbol~\emaillink{\@email}}%
  75. \ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol~\httplink{\@homepage}}%
  76. \collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
  77. \makenewline\csname\collectionloopkey socialsymbol\endcsname~\collectionloopitem}%
  78. \ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}\fi}%
  79. {%
  80. % name and optional title
  81. \newlength{\makecvheadpictureboxskip}%
  82. \setlength{\makecvheadpictureboxskip}{\totalheightof{\usebox{\makecvheadpicturebox}}}%
  83. \namestyle{\@firstname\ \@lastname}%
  84. \ifthenelse{\equal{\@title}{}}{}{\\[1.25em]\titlestyle{\@title}}\\[2.5em]%
  85. % optional quote
  86. \ifthenelse{\isundefined{\@quote}}%
  87. {}%
  88. {\begin{minipage}{\quotewidth}\quotestyle{\@quote}\end{minipage}\\[2.5em]}}%
  89. \par}% to avoid weird spacing bug at the first section if no blank line is left after \makecvhead
  90. % underlying command to implement \makecvtitle, identical to \@cvitem from moderncvbodyv
  91. \let\standarddoublebackslash\\%
  92. \newcommand*{\@makecvtitle}[3][.5ex]{%
  93. \arrayrulecolor{color1}%
  94. \setlength\arrayrulewidth{1.2\p@}%
  95. \if@aftersection\else%
  96. \vspace*{-\arrayrulewidth}\fi% HACK; I don't understand where the space is coming from, nor what it's exact value is :(
  97. \noindent%
  98. \begin{tabular}[t]{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}|@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}%
  99. \@moderncvstrut{4pt}{16pt}%
  100. \begin{minipage}[t]{\hintscolumnwidth}#2\end{minipage}
  101. &\begin{minipage}[t]{\maincolumnwidth}#3\end{minipage}%
  102. \\[#1]% the spacing needs to be inside the cell for the vertical rule to extend correctly
  103. \end{tabular}%
  104. \par\@aftersectionfalse\ignorespaces}
  105. %-------------------------------------------------------------------------------
  106. % letter head definition
  107. %-------------------------------------------------------------------------------
  108. % lengths
  109. %\renewcommand*{\recomputeletterheadlengths}{}
  110. % commands
  111. \renewcommand*{\makeletterhead}{%
  112. % recompute lengths (in case we are switching from letter to resume, or vice versa)
  113. \recomputeletterlengths%
  114. % sender contact info
  115. \hfill%
  116. \begin{minipage}{.5\textwidth}%
  117. % optional detailed information
  118. \if@details%
  119. \raggedleft%
  120. \addressfont\textcolor{color2}{%
  121. {\bfseries\upshape\@firstname~\@lastname}\@firstdetailselementfalse%
  122. % optional detailed information
  123. \ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\addresssymbol\@addressstreet%
  124. \ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}% if \addresstreet is defined, \addresscity and addresscountry will always be defined but could be empty
  125. \ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}}%
  126. \collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
  127. \makenewline\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}%
  128. \ifthenelse{\isundefined{\@email}}{}{\makenewline\emailsymbol\emaillink{\@email}}%
  129. \ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol\httplink{\@homepage}}%
  130. \ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}}\fi%
  131. \end{minipage}\\[1em]
  132. % recipient block
  133. \begin{minipage}[t]{.5\textwidth}
  134. \raggedright%
  135. \addressfont%
  136. {\bfseries\upshape\@recipientname}\\%
  137. \@recipientaddress%
  138. \end{minipage}
  139. % date
  140. \hfill% US style
  141. % \\[1em]% UK style
  142. \@date\\[2em]% US informal style: "January 1, 1900"; UK formal style: "01/01/1900"
  143. % opening
  144. \raggedright%
  145. \@opening\\[1.5em]%
  146. % ensure no extra spacing after \makelettertitle due to a possible blank line
  147. % \ignorespacesafterend% not working
  148. \hspace{0pt}\par\vspace{-\baselineskip}\vspace{-\parskip}}
  149. \endinput
  150. %% end of file `moderncvheadv.sty'.