AUTh Report LaTeX/XeLaTeX class
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

427 satır
12 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. \RequirePackage[english, greek]{babel}
  32. \else
  33. \RequirePackage{fontspec}
  34. \RequirePackage{polyglossia}
  35. \fi
  36. \RequirePackage{xargs} % Commands
  37. \RequirePackage{geometry} % Layout
  38. \RequirePackage{fancyhdr}
  39. \RequirePackage{graphicx} % Figures
  40. % Format packages
  41. \RequirePackage[hang, small,labelfont=bf,up,textfont=it,up]{caption} % Custom captions under/above floats in tables or figures
  42. \RequirePackage[nobottomtitles]{titlesec}
  43. \RequirePackage{titling}
  44. \RequirePackage[bottom]{footmisc} % Place footnotes always as much to the bottom as possible.
  45. \RequirePackage{hyperref} % Various
  46. \RequirePackage[ddmmyyyy]{datetime}
  47. \RequirePackage{enumitem}
  48. % Local Tools
  49. % ===============================================
  50. % Tool to check equality
  51. \newcommand{\isequal}[2]{ \pdf@strcmp{#1}{#2} }
  52. % syntactic suggar for horizaontal rule
  53. \newcommand{\Hrule}{ \rule{\linewidth}{0.1mm} }
  54. % Theme
  55. % ===============================================
  56. % Layout
  57. % =====================================================
  58. % Page core layout settings (include head and foot)
  59. % A4 will result to:
  60. % Top margin: 12mm
  61. % Bottom margin: 11mm
  62. % Head hight: 14mm
  63. % Foot skip: 15mm
  64. % Left margin: 15mm
  65. % Right margin: 12mm
  66. \newcommand{\authTopMargin}{12mm}
  67. \newcommand{\authBottomMargin}{12mm}
  68. \newcommand{\authHeadHeight}{10mm}
  69. \newcommand{\authFootSkip}{10mm}
  70. \newcommand{\authLeftMargin}{15mm}
  71. \newcommand{\authRightMargin}{15mm}
  72. %
  73. % Sets page layout. (include head and foot)
  74. \newcommand*{\authSetPageLayout}{%
  75. \newgeometry{%
  76. includeheadfoot,
  77. top= \authTopMargin,
  78. bottom= \authBottomMargin,
  79. headheight= \authHeadHeight,
  80. footskip= \authFootSkip,
  81. lmargin= \authLeftMargin,
  82. rmargin= \authRightMargin
  83. }
  84. }
  85. % Fonts
  86. % =====================================================
  87. % [1]: Main(Serif) body font
  88. % [5]: Sans family font
  89. % [6]: Mono family font
  90. %
  91. \newcommand{\authFontEnvSetup}[3]{%
  92. \setmainfont{#1}[SmallCapsFeatures={Letters=SmallCaps}]
  93. \setsansfont{#2}
  94. \setmonofont{#3}
  95. }
  96. % Header and Footer
  97. % =====================================================
  98. \newcommand*{\authSetFooterEmpty}{%
  99. % Clear styles
  100. \fancyfoot{}
  101. \renewcommand{\footrulewidth}{0pt}
  102. }
  103. \newcommand*{\authSetFooter}{%
  104. % Clear styles
  105. \fancyfoot{}
  106. \fancyfoot[C]{\thepage}
  107. \renewcommand{\footrulewidth}{0pt}
  108. \pagenumbering{arabic}
  109. }
  110. \newcommand{\authSetHeaderEmpty}{
  111. % Clear styles
  112. \fancyhead{}
  113. \renewcommand{\headrulewidth}{0pt}
  114. }
  115. \newcommand{\authSetHeader}{
  116. % Clear styles
  117. \fancyhead{}
  118. \fancyhead[L]{\auth@className}
  119. \fancyhead[R]{\auth@docTitle}
  120. \renewcommand{\headrulewidth}{0.5pt}
  121. }
  122. %
  123. % Page styles
  124. %
  125. \fancypagestyle{plain}{%
  126. % Style for the main document (including TOC)
  127. \authSetFooter
  128. \authSetHeader
  129. }
  130. \fancypagestyle{authTitlePageStyle}{%
  131. % Style for Title page
  132. \authSetHeaderEmpty
  133. \ifnum \isequal{\auth@short}{no}=0
  134. \authSetFooterEmpty
  135. \else
  136. \authSetFooter
  137. \fi
  138. }
  139. % Common Page style
  140. \newcommand{\authPageStyle}{%
  141. \renewcommand{\bottomtitlespace}{0.12\textheight}
  142. % Change the look of the section and subsection titles
  143. \titleformat{\section}[block]{\large\scshape}{\thesection.}{1em}{}
  144. \titleformat{\subsection}[block]{\large}{\thesubsection.}{1em}{}
  145. \titleformat{\subsubsection}[block]{\normalsize}{\thesubsubsection.}{1em}{}
  146. %\setlist[itemize]{noitemsep} % Make itemize lists more compact
  147. \setlist[itemize]{topsep=6pt, partopsep=0pt, itemsep=3pt, parsep=3pt}
  148. % Set paragraph identation and skip
  149. \setlength{\parindent}{0pt}
  150. \setlength{\parskip}{0.3em}
  151. }
  152. % Setup theme
  153. % =====================================================
  154. \hypersetup{
  155. colorlinks=true,
  156. linkcolor=red, % Internal links, those generated by cross-referenced elements
  157. filecolor=blue, % Links to local files
  158. urlcolor=blue % Links to web sites
  159. }
  160. \setlist[itemize]{topsep=0pt, partopsep=0pt, itemsep=3pt, parsep=3pt}
  161. \AtBeginDocument{%
  162. % Page layout (check above for the geometry setup)
  163. \authSetPageLayout
  164. % Fonts
  165. \authFontEnvSetup{CMU Serif}{CMU Sans Serif}{Courier New}
  166. \setdefaultlanguage{greek} % Main language
  167. \setotherlanguage{english} % Other language
  168. %hyphenation settiongs
  169. \lefthyphenmin=2 % minimum characters before
  170. \righthyphenmin=2 % minimum characters after
  171. % Header - Footer
  172. \pagestyle{plain}
  173. \thispagestyle{authTitlePageStyle}
  174. % Page styles and formating
  175. \authPageStyle
  176. \normalsize
  177. } % End \AtBeginDocument
  178. % QA document public environments/commands
  179. % =====================================================
  180. % Common fields
  181. % =====================================================
  182. \newcommand*{\AuthorName}[1]{\def\auth@authorName{#1}}
  183. \newcommand*{\AuthorMail}[1]{\def\auth@authorMail{#1}}
  184. \newcommand*{\AuthorAEM}[1]{\def\auth@authorAEM{#1}}
  185. \newcommand*{\CoAuthorName}[1]{\def\auth@coauthorName{#1}}
  186. \newcommand*{\CoAuthorMail}[1]{\def\auth@coauthorMail{#1}}
  187. \newcommand*{\CoAuthorAEM}[1]{\def\auth@coauthorAEM{#1}}
  188. \newcommand*{\WorkGroup}[1]{\def\auth@workGroup{#1}}
  189. \newcommand*{\DocTitle}[1]{\def\auth@docTitle{#1}}
  190. \newcommand*{\DocSubTitle}[1]{\def\auth@docSubTitle{#1}}
  191. \newcommand*{\Department}[1]{\def\auth@department{#1}}
  192. \newcommand*{\ClassName}[1]{\def\auth@className{#1}}
  193. \newcommand*{\InstructorName}[1]{\def\auth@instructorName{#1}}
  194. \newcommand*{\InstructorMail}[1]{\def\auth@instructorMail{#1}}
  195. \newcommand*{\CoInstructorName}[1]{\def\auth@coinstructorName{#1}}
  196. \newcommand*{\CoInstructorMail}[1]{\def\auth@coinstructorMail{#1}}
  197. \newcommand*{\CurrentDate}[1]{\def\auth@date{#1}}
  198. % \FirstPage
  199. \newcommand{\authTitlePage}{%
  200. \begin{titlepage}
  201. % Logo
  202. \begin{figure}
  203. \begin{flushleft}
  204. \includegraphics[width=5cm]{img/auth_logogr.png}
  205. \end{flushleft}
  206. \end{figure}
  207. % Titles
  208. \center % Center everything on the page
  209. \textbf{} \\[3.5cm] % vertical space
  210. \textsc{\Large \auth@department} \\[0.5cm] % Department
  211. \textsc{\Large \auth@className} \\[1.5cm] % Class/Course name
  212. \Hrule \\[0.4cm] % -------
  213. {\huge \bfseries \auth@docTitle} \\[0.4cm] % Document/Assignement Title
  214. {\LARGE \bfseries \auth@docSubTitle} \\[0.1cm] % Document/Assignement Sub-Title
  215. \Hrule \\[3.5cm] % -------
  216. % vertical space
  217. % Authors
  218. \begin{minipage}{0.4\textwidth}
  219. \begin{flushleft}
  220. \large
  221. \ifdefined \auth@workGroup \emph{\textsc{\auth@workGroup}} \\[2ex]\fi
  222. \ifdefined \auth@coauthorName
  223. \emph{Συντάκτες:}
  224. \else
  225. \emph{Συντάκτης:}
  226. \fi \\
  227. \auth@authorName \\
  228. AEM:\auth@authorAEM \\[0.35ex]
  229. \normalsize \href{mailto:\auth@authorMail}{\auth@authorMail} \\[2ex]
  230. \large
  231. \ifdefined \auth@coauthorName
  232. \auth@coauthorName \\
  233. AEM:\auth@coauthorAEM \\[0.35ex]
  234. \normalsize \href{mailto:\auth@coauthorMail}{\auth@coauthorMail} \\[2ex]
  235. \fi
  236. \end{flushleft}
  237. \end{minipage}
  238. \begin{minipage}{0.4\textwidth}
  239. \begin{flushright}
  240. \large
  241. \ifdefined \auth@coinstructorName % Instructor(s)
  242. \emph{Διδάσκοντες:}
  243. \else
  244. \emph{Διδάσκων:}
  245. \fi \\
  246. \auth@instructorName \\[0.35ex]
  247. \normalsize \href{mailto:\auth@instructorMail}{\auth@instructorMail} \\[2ex]
  248. \large
  249. \ifdefined \auth@coinstructorName
  250. \auth@coinstructorName \\[0.35ex]
  251. \normalsize \href{mailto:\auth@coinstructorMail}{\auth@coinstructorMail} \\[2ex]
  252. \fi
  253. \end{flushright}
  254. \end{minipage}
  255. \vfill
  256. {\large \auth@date} \\ % date
  257. \end{titlepage}
  258. \newpage
  259. }
  260. % \TitleHeader
  261. \newcommand{\authTitleHeader}{%
  262. \begin{center} % Center everything on the page
  263. % Logo
  264. \begin{figure}
  265. \center
  266. \includegraphics[width=5cm]{img/auth_logogr.png}
  267. \end{figure}
  268. % Titles
  269. \textsc{\Large \auth@department} \\[0.4cm] % Department
  270. \textsc{\Large \auth@className} \\[0.1cm] % Class/Course name
  271. {\Large \bfseries \auth@docTitle} \\[0.2cm] % Document/Assignement Title
  272. {\large \bfseries \auth@docSubTitle} \\[0.2cm] % Document/Assignement Sub-Title
  273. {\large \auth@date} \\[0.4cm] % date
  274. % Authors
  275. \begin{minipage}{0.4\textwidth}
  276. \begin{flushleft}
  277. \large
  278. \ifdefined \auth@coauthorName
  279. \emph{Συντάκτες:}
  280. \else
  281. \emph{Συντάκτης:}
  282. \fi \\
  283. \textsc{\auth@authorName} \\
  284. \textsc{AEM:\auth@authorAEM} \\[0.35ex]
  285. \normalsize \href{mailto:\auth@authorMail}{\auth@authorMail} \\[2ex]
  286. \large
  287. \ifdefined \auth@coauthorName
  288. \textsc{\auth@coauthorName} \\
  289. \textsc{AEM:\auth@coauthorAEM} \\[0.35ex]
  290. \normalsize \href{mailto:\auth@coauthorMail}{\auth@coauthorMail} \\[2ex]
  291. \fi
  292. \end{flushleft}
  293. \end{minipage}
  294. \begin{minipage}{0.4\textwidth}
  295. \begin{flushright} \large
  296. \large
  297. \ifdefined \auth@coinstructorName % Instructor(s)
  298. \emph{Διδάσκοντες:}
  299. \else
  300. \emph{Διδάσκων:}
  301. \fi \\
  302. \textsc{\auth@instructorName} \\[0.35ex]
  303. \normalsize \href{mailto:\auth@instructorMail}{\auth@instructorMail} \\[2ex]
  304. \large
  305. \ifdefined \auth@coinstructorName
  306. \textsc{\auth@coinstructorName} \\[0.35ex]
  307. \normalsize \href{mailto:\auth@coinstructorMail}{\auth@coinstructorMail} \\[2ex]
  308. \fi
  309. \end{flushright}
  310. \end{minipage}
  311. \end{center}
  312. }
  313. \newcommand{\InsertTitle}{%
  314. \ifnum \isequal{\auth@short}{no}=0
  315. \authTitlePage
  316. \else
  317. \authTitleHeader
  318. \fi
  319. }
  320. % \InsertFigure{}{}{}{}{}
  321. % [1]: Position specifier
  322. % [2]: scale
  323. % [3]: Label
  324. % [4]: Figure file
  325. % [5]: Caption text
  326. % example: \InsertFigure{!h}{0.8}{fig:lala}{lala.png}{\eng{Makes lala}}
  327. \newcommand{\InsertFigure}[5]{
  328. \begin{figure}[#1]
  329. \captionsetup{format=plain}
  330. \centering
  331. \includegraphics[width=#2\textwidth]{#4}
  332. \caption{#5}
  333. \label{#3}
  334. \end{figure}
  335. }
  336. % \WrapFigure{}{}{}{}
  337. % [1]: scale
  338. % [2]: place left or right r,l,R,L
  339. % [3]: Label
  340. % [4]: Figure file
  341. % [5]: Caption text
  342. % example: \WrapFigure{0.8}{r}{fig:lala}{lala.png}{\eng{Makes lala}}
  343. \newcommand{\WrapFigure}[5]{
  344. \begin{wrapfigure}{#2}{#1\textwidth}
  345. \vspace{-20pt}
  346. \begin{center}
  347. \captionsetup{format=plain}
  348. \includegraphics[width=#1\textwidth]{#4}
  349. \caption{#5}
  350. \label{#3}
  351. \end{center}
  352. \vspace{-20pt}
  353. \end{wrapfigure}
  354. }