AUTh Report LaTeX/XeLaTeX class
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

386 строки
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. % \FirstPage
  151. \newcommand{\authTitlePage}{%
  152. \begin{titlepage}
  153. % Logo
  154. \begin{figure}
  155. \begin{flushleft}
  156. \includegraphics[width=5cm]{img/auth_logogr.png}
  157. \end{flushleft}
  158. \end{figure}
  159. % Titles
  160. \center % Center everything on the page
  161. \textbf{} \\[3.5cm] % vertical space
  162. \textsc{\Large \auth@department} \\[0.5cm] % Department
  163. \textsc{\Large \auth@className} \\[1.5cm] % Class/Course name
  164. \Hrule \\[0.4cm] % -------
  165. {\huge \bfseries \auth@docTitle} \\[0.1cm] % Document/Assignement Title
  166. \Hrule \\[3.5cm] % -------
  167. % vertical space
  168. % Authors
  169. \begin{minipage}{0.4\textwidth}
  170. \begin{flushleft}
  171. \large
  172. \ifdefined \auth@workGroup \emph{\textsc{\auth@workGroup}} \\[2ex]\fi
  173. \ifnum \isequal{\auth@coauthor}{yes}=0
  174. \emph{Συντάκτες:}
  175. \else
  176. \emph{Συντάκτης:}
  177. \fi \\
  178. \textsc{\auth@authorName} \\
  179. \textsc{AEM:\auth@authorAEM} \\[1ex]
  180. \normalsize \href{mailto:\auth@authorMail}{\auth@authorMail} \\[2ex]
  181. \large
  182. \ifnum \isequal{\auth@coauthor}{yes}=0
  183. \textsc{\auth@coauthorName} \\
  184. \textsc{AEM:\auth@coauthorAEM} \\[1ex]
  185. \normalsize \href{mailto:\auth@coauthorMail}{\auth@coauthorMail}
  186. \fi
  187. \end{flushleft}
  188. \end{minipage}
  189. \begin{minipage}{0.4\textwidth}
  190. \begin{flushright} \large
  191. \emph{Διδάσκων:} \\ % Instructor
  192. \textsc{\auth@instructorName} \\[1ex]
  193. \normalsize
  194. \href{mailto:\auth@instructorMail}{\auth@instructorMail}
  195. \end{flushright}
  196. \end{minipage} \\
  197. \vfill
  198. {\large \auth@date} \\ % date
  199. \end{titlepage}
  200. \newpage
  201. }
  202. % \TitleHeader
  203. \newcommand{\authTitleHeader}{%
  204. \begin{center} % Center everything on the page
  205. % Logo
  206. \begin{figure}
  207. \center
  208. \includegraphics[width=5cm]{img/auth_logogr.png}
  209. \end{figure}
  210. % Titles
  211. \textsc{\Large \auth@department} \\[0.4cm] % Department
  212. \textsc{\Large \auth@className} \\[0.1cm] % Class/Course name
  213. {\Large \bfseries \auth@docTitle} \\[0.2cm] % Document/Assignement Title
  214. {\large \auth@date} \\[0.4cm] % date
  215. % Authors
  216. \begin{minipage}{0.4\textwidth}
  217. \begin{flushleft}
  218. \large
  219. \ifnum \isequal{\auth@coauthor}{yes}=0
  220. \emph{Συντάκτες:}
  221. \else
  222. \emph{Συντάκτης:}
  223. \fi \\
  224. \textsc{\auth@authorName} \\
  225. \textsc{AEM:\auth@authorAEM} \\[1ex]
  226. \normalsize \href{mailto:\auth@authorMail}{\auth@authorMail} \\[2ex]
  227. \large
  228. \ifnum \isequal{\auth@coauthor}{yes}=0
  229. \textsc{\auth@coauthorName} \\
  230. \textsc{AEM:\auth@coauthorAEM} \\[1ex]
  231. \normalsize \href{mailto:\auth@coauthorMail}{\auth@coauthorMail}
  232. \fi
  233. \end{flushleft}
  234. \end{minipage}
  235. \begin{minipage}{0.4\textwidth}
  236. \begin{flushright} \large
  237. \emph{Διδάσκων:} \\ % Instructor
  238. \textsc{\auth@instructorName} \\[1ex]
  239. \normalsize
  240. \href{mailto:\auth@instructorMail}{\auth@instructorMail}
  241. \end{flushright}
  242. \end{minipage}
  243. \end{center}
  244. }
  245. % Setup theme
  246. % =====================================================
  247. \AtBeginDocument{%
  248. % Page layout (check above for the geometry setup)
  249. \authSetPageLayout
  250. % Fonts
  251. \authFontEnvSetup{CMU Serif}{CMU Sans Serif}{Courier New}
  252. % Header - Footer
  253. \pagestyle{plain}
  254. \thispagestyle{authTitlePageStyle}
  255. % Page styles and formating
  256. \authPageStyle
  257. \normalsize
  258. } % End \AtBeginDocument
  259. % QA document public environments/commands
  260. % =====================================================
  261. % Common fields
  262. % =====================================================
  263. \newcommand*{\AuthorName}[1]{\def\auth@authorName{#1}}
  264. \newcommand*{\AuthorMail}[1]{\def\auth@authorMail{#1}}
  265. \newcommand*{\AuthorAEM}[1]{\def\auth@authorAEM{#1}}
  266. \newcommand*{\CoAuthorName}[1]{\def\auth@coauthorName{#1}}
  267. \newcommand*{\CoAuthorMail}[1]{\def\auth@coauthorMail{#1}}
  268. \newcommand*{\CoAuthorAEM}[1]{\def\auth@coauthorAEM{#1}}
  269. \newcommand*{\WorkGroup}[1]{\def\auth@workGroup{#1}}
  270. \newcommand*{\DocTitle}[1]{\def\auth@docTitle{#1}}
  271. \newcommand*{\Department}[1]{\def\auth@department{#1}}
  272. \newcommand*{\ClassName}[1]{\def\auth@className{#1}}
  273. \newcommand*{\InstructorName}[1]{\def\auth@instructorName{#1}}
  274. \newcommand*{\InstructorMail}[1]{\def\auth@instructorMail{#1}}
  275. \newcommand*{\CurrentDate}[1]{\def\auth@date{#1}}
  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. }