AUTH Report LaTeX class
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

384 líneas
10 KiB

  1. %
  2. % AUTH report class
  3. %
  4. % note: Requires compilation with XeLaTeX or LuaTeX
  5. %
  6. % author: Christos Choutouridis <cchoutou@ece.auth.gr>
  7. %
  8. \NeedsTeXFormat{LaTeX2e}
  9. \ProvidesPackage{AUTHReport}[2024-11-03 AUTH Report document class]
  10. % Options
  11. % ===============================================
  12. % Declare option for short report version
  13. \DeclareOption{short}{\def\auth@short{yes}}
  14. % Declare option for CoAuthor
  15. \DeclareOption{coauthor}{\def\auth@coauthor{yes}}
  16. % Default option values
  17. \def\auth@short{no}
  18. \def\auth@coauthor{no}
  19. % Pass all other options to article
  20. \DeclareOption*{%
  21. \PassOptionsToClass{\CurrentOption}{article}
  22. }
  23. \ProcessOptions\relax
  24. \LoadClass{article}
  25. % Requirements
  26. % ===============================================
  27. \RequirePackage{iftex}
  28. \ifPDFTeX
  29. \RequirePackage[utf8]{inputenc}
  30. \RequirePackage[T1]{fontenc}
  31. \else
  32. \RequirePackage{fontspec}
  33. \fi
  34. \RequirePackage{xargs} % Commands
  35. \RequirePackage{geometry} % Layout
  36. \RequirePackage{fancyhdr}
  37. \RequirePackage{graphicx} % Figures
  38. % Format packages
  39. \RequirePackage[hang, small,labelfont=bf,up,textfont=it,up]{caption} % Custom captions under/above floats in tables or figures
  40. \RequirePackage[nobottomtitles]{titlesec}
  41. \RequirePackage{titling}
  42. \RequirePackage[bottom]{footmisc} % Place footnotes always as much to the bottom as possible.
  43. \RequirePackage{hyperref} % Various
  44. \RequirePackage[ddmmyyyy]{datetime}
  45. \RequirePackage{enumitem}
  46. % Local Tools
  47. % ===============================================
  48. % Tool to check equality
  49. \newcommand{\isequal}[2]{ \pdf@strcmp{#1}{#2} }
  50. % syntactic suggar for horizaontal rule
  51. \newcommand{\Hrule}{ \rule{\linewidth}{0.1mm} }
  52. % Theme
  53. % ===============================================
  54. % Layout
  55. % =====================================================
  56. % Page core layout settings (include head and foot)
  57. % A4 will result to:
  58. % Top margin: 12mm
  59. % Bottom margin: 11mm
  60. % Head hight: 14mm
  61. % Foot skip: 15mm
  62. % Left margin: 15mm
  63. % Right margin: 12mm
  64. \newcommand{\authTopMargin}{12mm}
  65. \newcommand{\authBottomMargin}{12mm}
  66. \newcommand{\authHeadHeight}{10mm}
  67. \newcommand{\authFootSkip}{10mm}
  68. \newcommand{\authLeftMargin}{15mm}
  69. \newcommand{\authRightMargin}{15mm}
  70. %
  71. % Sets page layout. (include head and foot)
  72. \newcommand*{\authSetPageLayout}{%
  73. \newgeometry{%
  74. includeheadfoot,
  75. top= \authTopMargin,
  76. bottom= \authBottomMargin,
  77. headheight= \authHeadHeight,
  78. footskip= \authFootSkip,
  79. lmargin= \authLeftMargin,
  80. rmargin= \authRightMargin
  81. }
  82. }
  83. % Fonts
  84. % =====================================================
  85. % [1]: Main(Serif) body font
  86. % [5]: Sans family font
  87. % [6]: Mono family font
  88. %
  89. \newcommand{\authFontEnvSetup}[3]{%
  90. \setmainfont{#1}[SmallCapsFeatures={Letters=SmallCaps}]
  91. \setsansfont{#2}
  92. \setmonofont{#3}
  93. % \newfontface\smallcapsfont{Libertinus Serif}[Letters=SmallCaps]
  94. }
  95. % Header and Footer
  96. % =====================================================
  97. \newcommand*{\authSetFooterEmpty}{%
  98. % Clear styles
  99. \fancyfoot{}
  100. \renewcommand{\footrulewidth}{0pt}
  101. }
  102. \newcommand*{\authSetFooter}{%
  103. % Clear styles
  104. \fancyfoot{}
  105. \fancyfoot[C]{\thepage}
  106. \renewcommand{\footrulewidth}{0pt}
  107. \pagenumbering{arabic}
  108. }
  109. \newcommand{\authSetHeaderEmpty}{
  110. % Clear styles
  111. \fancyhead{}
  112. \renewcommand{\headrulewidth}{0pt}
  113. }
  114. \newcommand{\authSetHeader}{
  115. % Clear styles
  116. \fancyhead{}
  117. \fancyhead[L]{\auth@className}
  118. \fancyhead[R]{\auth@docTitle}
  119. \renewcommand{\headrulewidth}{0.5pt}
  120. }
  121. %
  122. % Page styles
  123. %
  124. \fancypagestyle{plain}{%
  125. % Style for the main document (including TOC)
  126. \authSetFooter
  127. \authSetHeader
  128. }
  129. \fancypagestyle{authTitlePageStyle}{%
  130. % Style for Title page
  131. \authSetHeaderEmpty
  132. \ifnum \isequal{\auth@short}{no}=0
  133. \authSetFooterEmpty
  134. \else
  135. \authSetFooter
  136. \fi
  137. }
  138. % Common Page style
  139. \newcommand{\authPageStyle}{%
  140. \renewcommand{\bottomtitlespace}{0.12\textheight}
  141. % Change the look of the section and subsection titles
  142. \titleformat{\section}[block]{\large\scshape}{\thesection.}{1em}{}
  143. \titleformat{\subsection}[block]{\large}{\thesubsection.}{1em}{}
  144. \titleformat{\subsubsection}[block]{\normalsize}{\thesubsubsection.}{1em}{}
  145. \setlist[itemize]{noitemsep} % Make itemize lists more compact
  146. % Set paragraph identation and skip
  147. \setlength{\parindent}{0pt}
  148. \setlength{\parskip}{0.65em}
  149. }
  150. % Setup theme
  151. % =====================================================
  152. \AtBeginDocument{%
  153. % Page layout (check above for the geometry setup)
  154. \authSetPageLayout
  155. % Fonts
  156. \authFontEnvSetup{CMU Serif}{CMU Sans Serif}{Courier New}
  157. % Header - Footer
  158. \pagestyle{plain}
  159. \thispagestyle{authTitlePageStyle}
  160. % Page styles and formating
  161. \authPageStyle
  162. \normalsize
  163. } % End \AtBeginDocument
  164. % QA document public environments/commands
  165. % =====================================================
  166. % Common fields
  167. % =====================================================
  168. \newcommand*{\AuthorName}[1]{\def\auth@authorName{#1}}
  169. \newcommand*{\AuthorMail}[1]{\def\auth@authorMail{#1}}
  170. \newcommand*{\AuthorAEM}[1]{\def\auth@authorAEM{#1}}
  171. \newcommand*{\CoAuthorName}[1]{\def\auth@coauthorName{#1}}
  172. \newcommand*{\CoAuthorMail}[1]{\def\auth@coauthorMail{#1}}
  173. \newcommand*{\CoAuthorAEM}[1]{\def\auth@coauthorAEM{#1}}
  174. \newcommand*{\WorkGroup}[1]{\def\auth@workGroup{#1}}
  175. \newcommand*{\DocTitle}[1]{\def\auth@docTitle{#1}}
  176. \newcommand*{\Department}[1]{\def\auth@department{#1}}
  177. \newcommand*{\ClassName}[1]{\def\auth@className{#1}}
  178. \newcommand*{\InstructorName}[1]{\def\auth@instructorName{#1}}
  179. \newcommand*{\InstructorMail}[1]{\def\auth@instructorMail{#1}}
  180. \newcommand*{\CurrentDate}[1]{\def\auth@date{#1}}
  181. % \FirstPage
  182. \newcommand{\authTitlePage}{%
  183. \begin{titlepage}
  184. % Logo
  185. \begin{figure}
  186. \begin{flushleft}
  187. \includegraphics[width=5cm]{img/auth_logogr.png}
  188. \end{flushleft}
  189. \end{figure}
  190. % Titles
  191. \center % Center everything on the page
  192. \textbf{} \\[3.5cm] % vertical space
  193. \textsc{\Large \auth@department} \\[0.5cm] % Department
  194. \textsc{\Large \auth@className} \\[1.5cm] % Class/Course name
  195. \Hrule \\[0.4cm] % -------
  196. {\huge \bfseries \auth@docTitle} \\[0.1cm] % Document/Assignement Title
  197. \Hrule \\[3.5cm] % -------
  198. % vertical space
  199. % Authors
  200. \begin{minipage}{0.4\textwidth}
  201. \begin{flushleft}
  202. \large
  203. \ifdefined \auth@workGroup \emph{\textsc{\auth@workGroup}} \\[2ex]\fi
  204. \ifnum \isequal{\auth@coauthor}{yes}=0
  205. \emph{Συντάκτες:}
  206. \else
  207. \emph{Συντάκτης:}
  208. \fi \\
  209. \textsc{\auth@authorName} \\
  210. \textsc{AEM:\auth@authorAEM} \\[1ex]
  211. \normalsize \href{mailto:\auth@authorMail}{\auth@authorMail} \\[2ex]
  212. \large
  213. \ifnum \isequal{\auth@coauthor}{yes}=0
  214. \textsc{\auth@coauthorName} \\
  215. \textsc{AEM:\auth@coauthorAEM} \\[1ex]
  216. \normalsize \href{mailto:\auth@coauthorMail}{\auth@coauthorMail}
  217. \fi
  218. \end{flushleft}
  219. \end{minipage}
  220. \begin{minipage}{0.4\textwidth}
  221. \begin{flushright} \large
  222. \emph{Διδάσκων:} \\ % Instructor
  223. \textsc{\auth@instructorName} \\[1ex]
  224. \normalsize
  225. \href{mailto:\auth@instructorMail}{\auth@instructorMail}
  226. \end{flushright}
  227. \end{minipage} \\
  228. \vfill
  229. {\large \auth@date} \\ % date
  230. \end{titlepage}
  231. \newpage
  232. }
  233. % \TitleHeader
  234. \newcommand{\authTitleHeader}{%
  235. \begin{center} % Center everything on the page
  236. % Logo
  237. \begin{figure}
  238. \center
  239. \includegraphics[width=5cm]{img/auth_logogr.png}
  240. \end{figure}
  241. % Titles
  242. \textsc{\Large \auth@department} \\[0.4cm] % Department
  243. \textsc{\Large \auth@className} \\[0.1cm] % Class/Course name
  244. {\Large \bfseries \auth@docTitle} \\[0.2cm] % Document/Assignement Title
  245. {\large \auth@date} \\[0.4cm] % date
  246. % Authors
  247. \begin{minipage}{0.4\textwidth}
  248. \begin{flushleft}
  249. \large
  250. \ifnum \isequal{\auth@coauthor}{yes}=0
  251. \emph{Συντάκτες:}
  252. \else
  253. \emph{Συντάκτης:}
  254. \fi \\
  255. \textsc{\auth@authorName} \\
  256. \textsc{AEM:\auth@authorAEM} \\[1ex]
  257. \normalsize \href{mailto:\auth@authorMail}{\auth@authorMail} \\[2ex]
  258. \large
  259. \ifnum \isequal{\auth@coauthor}{yes}=0
  260. \textsc{\auth@coauthorName} \\
  261. \textsc{AEM:\auth@coauthorAEM} \\[1ex]
  262. \normalsize \href{mailto:\auth@coauthorMail}{\auth@coauthorMail}
  263. \fi
  264. \end{flushleft}
  265. \end{minipage}
  266. \begin{minipage}{0.4\textwidth}
  267. \begin{flushright} \large
  268. \emph{Διδάσκων:} \\ % Instructor
  269. \textsc{\auth@instructorName} \\[1ex]
  270. \normalsize
  271. \href{mailto:\auth@instructorMail}{\auth@instructorMail}
  272. \end{flushright}
  273. \end{minipage}
  274. \end{center}
  275. }
  276. \newcommand{\Title}{%
  277. \ifnum \isequal{\auth@short}{no}=0
  278. \authTitlePage
  279. \else
  280. \authTitleHeader
  281. \fi
  282. }
  283. % \InsertFigure{}{}{}{}
  284. % [1]: scale
  285. % [2]: Label
  286. % [3]: Figure file
  287. % [4]: Caption text
  288. % example: \InsertFigure{0.8}{fig:lala}{lala.png}{\eng{Makes lala}}
  289. \newcommand{\InsertFigure}[4]{
  290. \begin{figure*}[h!]
  291. \captionsetup{format=plain}
  292. \centering
  293. \includegraphics[width=#1\textwidth]{#3}
  294. \caption{#4}
  295. \label{#2}
  296. \end{figure*}
  297. }
  298. % \WrapFigure{}{}{}{}
  299. % [1]: scale
  300. % [2]: place left or right r,l,R,L
  301. % [3]: Label
  302. % [4]: Figure file
  303. % [5]: Caption text
  304. % example: \WrapFigure{0.8}{r}{fig:lala}{lala.png}{\eng{Makes lala}}
  305. \newcommand{\WrapFigure}[5]{
  306. \begin{wrapfigure}{#2}{#1\textwidth}
  307. \vspace{-20pt}
  308. \begin{center}
  309. \captionsetup{format=plain}
  310. \includegraphics[width=#1\textwidth]{#4}
  311. \caption{#5}
  312. \label{#3}
  313. \end{center}
  314. \vspace{-20pt}
  315. \end{wrapfigure}
  316. }