letter.latex 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. %!TEX TS-program = xelatex
  2. %!TEX encoding = UTF-8 Unicode
  3. \documentclass[$fontsize$, a4paper]{article}
  4. \usepackage{fontspec}
  5. % LAYOUT
  6. %--------------------------------
  7. \usepackage{geometry}
  8. \geometry{$geometry$}
  9. % No page numbers
  10. \pagenumbering{gobble}
  11. % Left align
  12. \usepackage[document]{ragged2e}
  13. % Trim excessive whitespace before lists
  14. \usepackage{enumitem}
  15. \setlist{nolistsep}
  16. $if(page-background)$
  17. \usepackage[pages=all]{background}
  18. $endif$
  19. $if(letterhead)$
  20. \usepackage{wallpaper}
  21. \addtolength{\wpXoffset}{-5cm}
  22. \addtolength{\wpYoffset}{11cm}
  23. % \ThisULCornerWallPaper{1}{letterhead-front.pdf} % Uncomment to include a different letterhead on the first page
  24. \CenterWallPaper{0.2}{$letterhead$}
  25. $endif$
  26. \usepackage{fontawesome5}
  27. % LANGUAGE
  28. %--------------------------------
  29. $if(lang)$
  30. \usepackage{polyglossia}
  31. \setmainlanguage{$lang$}
  32. $endif$
  33. % TYPOGRAPHY
  34. %--------------------------------
  35. \usepackage{xunicode}
  36. \usepackage{xltxtra}
  37. \usepackage[protrusion=true,final]{microtype}
  38. % converts LaTeX specials (quotes, dashes etc.) to Unicode
  39. \defaultfontfeatures{Mapping=tex-text}
  40. \setromanfont [Ligatures={Common}, Numbers={OldStyle}]{$mainfont$}
  41. \setsansfont[Scale=0.9]{$altfont$}
  42. \setmonofont[Scale=0.8]{$monofont$}
  43. % Set paragraph break
  44. \setlength{\parskip}{1em}
  45. % Custom ampersand
  46. \newcommand{\amper}{{\fontspec[Scale=.95]{$mainfont$}\selectfont\itshape\&}}
  47. $if(mainfont)$
  48. \setmainfont{$mainfont$}
  49. $endif$
  50. $if(altfont)$
  51. \setsansfont{$altfont$}
  52. $endif$
  53. % Command required by how Pandoc handles the list conversion
  54. \providecommand{\tightlist}{%
  55. \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
  56. % PDF SETUP
  57. %--------------------------------
  58. \usepackage[xetex, bookmarks, colorlinks, breaklinks]{hyperref}
  59. \hypersetup
  60. {
  61. pdfauthor={$author$},
  62. pdfsubject={$subject$},
  63. pdftitle={$subject$},
  64. colorlinks,breaklinks,
  65. filecolor=black,
  66. urlcolor=[rgb]{0.117,0.682,0.858},
  67. linkcolor=[rgb]{0.117,0.682,0.858},
  68. linkcolor=[rgb]{0.117,0.682,0.858},
  69. citecolor=[rgb]{0.117,0.682,0.858}
  70. }
  71. % To display custom date in the example
  72. $if(customdate)$
  73. \usepackage[$lang$]{datetime2}
  74. \DTMsavedate{customdate}{$customdate$}
  75. $endif$
  76. $if(page-background)$
  77. \backgroundsetup{
  78. scale=1,
  79. color=black,
  80. opacity=$if(page-background-opacity)$$page-background-opacity$$else$0.2$endif$,
  81. angle=0,
  82. contents={%
  83. \includegraphics[width=\paperwidth,height=\paperheight]{$page-background$}
  84. }%
  85. }
  86. $endif$
  87. % remove section numbering
  88. \setcounter{secnumdepth}{-\maxdimen}
  89. % DOCUMENT
  90. %--------------------------------
  91. \begin{document}
  92. \small
  93. \textsc{\textbf{$author$}\\$affiliation1$}\\ \textsc{$affiliation2$}\\
  94. $for(from)$
  95. \textsc{$from$}
  96. $endfor$
  97. %$for(contact)$
  98. %\textsc{$contact$}
  99. %$endfor$
  100. \vspace{2em}
  101. \normalsize \sffamily
  102. $for(to)$
  103. $to$\\
  104. $endfor$
  105. %\vspace{3em}
  106. \rmfamily
  107. \begin{flushright}
  108. $city$ \textbullet{} $if(customdate)$\DTMusedate{customdate}$else$\today$endif$
  109. \end{flushright}
  110. %\vspace{1em}
  111. %$if(subject)$
  112. %\textbf{$subject$}
  113. %$endif$
  114. %\vspace{1em}
  115. %$salutation$ $toname$:
  116. $body$
  117. $if(signature)$
  118. \begin{FlushRight}
  119. \IfFileExists{$signature$}
  120. {
  121. \includegraphics[height=5.5\baselineskip]{$signature$} \par
  122. }
  123. {
  124. \vspace{5.5\baselineskip}
  125. }
  126. $author$
  127. \end{FlushRight}
  128. $endif$
  129. \end{document}