moderncvfooti.sty 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. %% start of file `moderncvfooti.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{moderncvfooti}[2015/07/28 v2.0.0 modern curriculum vitae and letter footer variant: 1]
  12. %-------------------------------------------------------------------------------
  13. % required packages
  14. %-------------------------------------------------------------------------------
  15. %-------------------------------------------------------------------------------
  16. % overall foot definition
  17. %-------------------------------------------------------------------------------
  18. % fonts
  19. \renewcommand*{\addressfont}{\normalsize\mdseries\slshape}
  20. % symbols
  21. % footer symbol used to separate footer elements
  22. \newcommand*{\footsymbol}{%
  23. {~~~{\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
  24. % lengths
  25. \@initializelength{\footwidth}%
  26. \renewcommand*{\recomputefootlengths}{%
  27. \setlength{\footwidth}{0.8\textwidth}}
  28. % commands
  29. % internal command to add an element to the footer
  30. % it collects the elements in a temporary box, and checks when to flush the box
  31. \@initializebox{\footbox}%
  32. \@initializebox{\foottempbox}%
  33. \@initializelength{\footboxwidth}%
  34. \@initializeif{\if@firstfootelement}\@firstfootelementtrue%
  35. % adds an element to the footer, separated by footsymbol
  36. % usage: \addtofoot[footsymbol]{element}
  37. \newcommand*{\addtofoot}[2][\footsymbol]{%
  38. \if@firstfootelement%
  39. \savebox{\foottempbox}{\usebox{\footbox}#2}%
  40. \else%
  41. \savebox{\foottempbox}{\usebox{\footbox}#1#2}\fi%
  42. \settowidth{\footboxwidth}{\usebox{\foottempbox}}%
  43. \ifnum\footboxwidth<\footwidth%
  44. \savebox{\footbox}{\usebox{\foottempbox}}%
  45. \@firstfootelementfalse%
  46. \else%
  47. \flushfoot\\%
  48. \savebox{\footbox}{#2}%
  49. \savebox{\foottempbox}{#2}%
  50. \settowidth{\footboxwidth}{\usebox{\footbox}}%
  51. \@firstfootelementfalse\fi}
  52. % internal command to flush the foot
  53. \newcommand*{\flushfoot}{%
  54. \strut\usebox{\footbox}%
  55. \savebox{\footbox}{}%
  56. \savebox{\foottempbox}{}%
  57. \setlength{\footboxwidth}{0pt}}
  58. %-------------------------------------------------------------------------------
  59. % resume foot definition
  60. %-------------------------------------------------------------------------------
  61. % lenghts
  62. \renewcommand*{\recomputecvfootlengths}{\recomputefootlengths}
  63. % commands
  64. \renewcommand*{\makecvfoot}{%
  65. \recomputecvfootlengths{}%
  66. \fancypagestyle{plain}{%
  67. \fancyfoot[c]{%
  68. \parbox[b]{\footwidth}{%
  69. \centering%
  70. \color{color2}\addressfont%
  71. \vspace{\baselineskip}% forces a white line to ensure space between main text and footer (as footer height can't be known in advance)
  72. \ifthenelse{\isundefined{\@addressstreet}}{}{\addtofoot[]{\addresssymbol\@addressstreet}%
  73. \ifthenelse{\equal{\@addresscity}{}}{}{\addtofoot[~--~]{\@addresscity}}% if \addresstreet is defined, \addresscity and \addresscountry will always be defined but could be empty
  74. \ifthenelse{\equal{\@addresscountry}{}}{}{\addtofoot[~--~]{\@addresscountry}}%
  75. \flushfoot\@firstfootelementtrue\\}%
  76. \collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
  77. \addtofoot{\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}}%
  78. \ifthenelse{\isundefined{\@email}}{}{\addtofoot{\emailsymbol\emaillink{\@email}}}%
  79. \ifthenelse{\isundefined{\@homepage}}{}{\addtofoot{\homepagesymbol\httplink{\@homepage}}}%
  80. \collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
  81. \addtofoot{\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem}}%
  82. \ifthenelse{\isundefined{\@extrainfo}}{}{\addtofoot{\@extrainfo}}%
  83. \ifthenelse{\lengthtest{\footboxwidth=0pt}}{}{\flushfoot}% the lengthtest is required to avoid flushing an empty footer, which could cause a blank line due to the \\ after the address, if no other personal info is used
  84. }}}%
  85. \pagestyle{plain}}
  86. %-------------------------------------------------------------------------------
  87. % letter foot definition
  88. %-------------------------------------------------------------------------------
  89. % commands
  90. \renewcommand*{\recomputeletterfootlengths}{\recomputefootlengths}
  91. \renewcommand*{\makeletterfoot}{%
  92. \recomputeletterfootlengths{}%
  93. \fancypagestyle{plain}{%
  94. \fancyfoot[c]{%
  95. \parbox[b]{\footwidth}{%
  96. \centering%
  97. \addressfont\color{color2}%
  98. \vspace{\baselineskip}% forces a white line to ensure space between main text and footer (as footer height can't be known in advance)
  99. \vspace{-\baselineskip}% to cancel out the extra vertical space taken by the name (below) and ensure perfect alignment of letter and cv footers
  100. \strut{\bfseries\upshape\@firstname~\@lastname}\\% the \strut is required to ensure the line is exactly \baselineskip tall
  101. \ifthenelse{\isundefined{\@addressstreet}}{}{\addtofoot[]{\addresssymbol\@addressstreet}%
  102. \ifthenelse{\equal{\@addresscity}{}}{}{\addtofoot[~--~]{\@addresscity}}% if \addresstreet is defined, \addresscity and addresscountry will always be defined but could be empty
  103. \ifthenelse{\equal{\@addresscountry}{}}{}{\addtofoot[~--~]{\@addresscountry}}%
  104. \flushfoot\@firstfootelementtrue\\}%
  105. \collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
  106. \addtofoot{\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}}%
  107. \ifthenelse{\isundefined{\@email}}{}{\addtofoot{\emailsymbol\emaillink{\@email}}}%
  108. \ifthenelse{\isundefined{\@homepage}}{}{\addtofoot{\homepagesymbol\httplink{\@homepage}}}%
  109. \collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
  110. \addtofoot{\csname\collectionloopkey socialsymbol\endcsname\collectionloopitem}}%
  111. \ifthenelse{\isundefined{\@extrainfo}}{}{\addtofoot{\@extrainfo}}%
  112. \ifthenelse{\lengthtest{\footboxwidth=0pt}}{}{\flushfoot}% the lengthtest is required to avoid flushing an empty footer, which could cause a blank line due to the \\ after the address, if no other personal info is used
  113. }}}%
  114. \pagestyle{plain}}
  115. \endinput
  116. %% end of file `moderncvfooti.sty'.