Fix latex format

This commit is contained in:
2024-09-24 11:27:30 +02:00
parent 8887bd07b9
commit 964681c2ec
8 changed files with 143 additions and 145 deletions

View File

@@ -1,8 +1,8 @@
{ {
\hypersetup{linkcolor=black} \hypersetup{linkcolor=black}
\chapterstartoc{List of Acronyms} \chapterstartoc{List of Acronyms}
\label{ch:acronyms} \label{ch:acronyms}
\renewcommand{\glossarysection}[2][]{} % Remove the title of the glossary \renewcommand{\glossarysection}[2][]{} % Remove the title of the glossary
\printnoidxglossary \printnoidxglossary
} }

View File

@@ -1,5 +1,5 @@
{ {
\hypersetup{linkcolor=black} \hypersetup{linkcolor=black}
\listoffigures \listoffigures
\addcontentsline{toc}{chapter}{\listfigurename} \addcontentsline{toc}{chapter}{\listfigurename}
} }

View File

@@ -1,5 +1,5 @@
{ {
\hypersetup{linkcolor=black} \hypersetup{linkcolor=black}
\listoftables \listoftables
\addcontentsline{toc}{chapter}{\listtablename} \addcontentsline{toc}{chapter}{\listtablename}
} }

View File

@@ -1,21 +1,21 @@
\usepackage[% \usepackage[%
indexonlyfirst% Show only the first use page on the list of acronyms indexonlyfirst% Show only the first use page on the list of acronyms
]{glossaries} ]{glossaries}
\usepackage{xspace} % To avoid problems with missing spaces after custom commands \usepackage{xspace} % To avoid problems with missing spaces after custom commands
% Set the list of acronyms style % Set the list of acronyms style
\newglossarystyle{dots}{% From https://tex.stackexchange.com/a/327513 \newglossarystyle{dots}{% From https://tex.stackexchange.com/a/327513
\setglossarystyle{list}% Base style \setglossarystyle{list}% Base style
% %
\renewcommand*{\glossentry}[2]{% \renewcommand*{\glossentry}[2]{%
\item[% \item[%
\upshape\bfseries% Upright and bold \upshape\bfseries% Upright and bold
\glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}}% The acronym \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}}% The acronym
]% ]%
\glossentrydesc{##1}% The description \glossentrydesc{##1}% The description
\unskip\leaders\hbox to 2.9mm{\hss.}\hfill##2}% The pages \unskip\leaders\hbox to 2.9mm{\hss.}\hfill##2}% The pages
% %
\renewcommand*{\glsgroupskip}{}% No gap between groups \renewcommand*{\glsgroupskip}{}% No gap between groups
} }
\setglossarystyle{dots} \setglossarystyle{dots}
@@ -23,13 +23,13 @@
% Define the acronyms % Define the acronyms
\NewDocumentCommand{\acronym}{O{#2} m m}{% #1 = command, #2 = acronym, #3 = full name \NewDocumentCommand{\acronym}{O{#2} m m}{% #1 = command, #2 = acronym, #3 = full name
\newacronym{#1}{#2}{#3}% \newacronym{#1}{#2}{#3}%
\expandafter\newcommand\csname #1\endcsname{% Create a command named after the acronym (call \#1) \expandafter\newcommand\csname #1\endcsname{% Create a command named after the acronym (call \#1)
\gls{#1}\xspace% \gls{#1}\xspace%
}% }%
\expandafter\providecommand\csname #1s\endcsname{% Create a plural command (call \#1s) if not already defined \expandafter\providecommand\csname #1s\endcsname{% Create a plural command (call \#1s) if not already defined
\glspl{#1}\xspace% \glspl{#1}\xspace%
}% }%
} }
% Style the acronyms % Style the acronyms

View File

@@ -1,30 +1,30 @@
\usepackage[ \usepackage[
backend=biber, backend=biber,
style=alphabetic, style=alphabetic,
backref=true,% Show page numbers where citations appear backref=true,% Show page numbers where citations appear
maxbibnames=99,% Show all authors in bibliography maxbibnames=99,% Show all authors in bibliography
maxalphanames=1,% Show only one author in citations keys maxalphanames=1,% Show only one author in citations keys
maxcitenames=1,% Show only one authors in citations in text maxcitenames=1,% Show only one authors in citations in text
]{biblatex} ]{biblatex}
% Define citation style to be [Author, Year] % Define citation style to be [Author, Year]
% From https://tex.stackexchange.com/a/176119 % From https://tex.stackexchange.com/a/176119
\DeclareLabelalphaTemplate{ \DeclareLabelalphaTemplate{
\labelelement{% Author \labelelement{% Author
\field[final]{shorthand} \field[final]{shorthand}
\field{labelname} \field{labelname}
\field{label} \field{label}
} }
\labelelement{% Comma \labelelement{% Comma
\literal{,\addhighpenspace} \literal{,\addhighpenspace}
} }
\labelelement{% Year \labelelement{% Year
\field{year} \field{year}
} }
} }
\DeclareLabelalphaNameTemplate{% Use prefix + family name for 'Author' in citation keys \DeclareLabelalphaNameTemplate{% Use prefix + family name for 'Author' in citation keys
\namepart[use]{prefix} \namepart[use]{prefix}
\namepart{family} \namepart{family}
} }
\renewcommand*{\labelalphaothers}{} % Remove "et al." in citation keys \renewcommand*{\labelalphaothers}{} % Remove "et al." in citation keys
@@ -32,25 +32,25 @@
\DeclareCiteCommand{\textcite} \DeclareCiteCommand{\textcite}
{\usebibmacro{prenote}} {\usebibmacro{prenote}}
{% {%
\ifciteindex{\indexnames{labelname}}{}% \ifciteindex{\indexnames{labelname}}{}%
\bibhyperref{\printnames{labelname}}% Author \bibhyperref{\printnames{labelname}}% Author
\setunit{\addspace}% Space \setunit{\addspace}% Space
\printtext[brackets]{\bibhyperref{\printdateextra}}% Year \printtext[brackets]{\bibhyperref{\printdateextra}}% Year
} }
{\multicitedelim} {\multicitedelim}
{\usebibmacro{postnote}} {\usebibmacro{postnote}}
% Remove some fields from bibliography % Remove some fields from bibliography
\AtEveryBibitem{ \AtEveryBibitem{
\ifentrytype{book}{}{ \ifentrytype{book}{}{
\clearfield{isbn}% \clearfield{isbn}%
} }
\clearfield{day}% \clearfield{day}%
\clearlist{editor}% \clearlist{editor}%
\clearfield{extra}% \clearfield{extra}%
\clearfield{location}% \clearfield{location}%
\clearfield{month}% \clearfield{month}%
\clearfield{series}% \clearfield{series}%
\clearlist{publisher}% \clearlist{publisher}%
\clearfield{url}% \clearfield{url}%
} }

View File

@@ -3,31 +3,37 @@
\definechangesauthor[color=RawSienna]{CP} \definechangesauthor[color=RawSienna]{CP}
\newcommand{\CP}[1]{\comment[id=CP]{#1}} \newcommand{\CP}[1]{\comment[id=CP]{#1}}
% Footnotes
\usepackage[hang]{footmisc}
\setlength{\footnotemargin}{3mm} % Margin between footnote number and text
% Images % Images
\usepackage{graphicx} \usepackage{graphicx}
\usepackage{caption} % Point references to the figure not the caption \usepackage{caption} % Point references to the figure not the caption
\usepackage[export]{adjustbox} % For valign in subfigs \usepackage[export]{adjustbox} % For valign in subfigs
% Includes % Includes
\usepackage{bookmark} % Manage bookmarks
\usepackage{import} % Allow relative paths \usepackage{import} % Allow relative paths
\usepackage{pdfpages} % Include PDFs \usepackage{pdfpages} % Include PDFs
\usepackage{hyperref} % Hyperlinks % Formatting
\usepackage[autostyle]{csquotes} % For quotes
\usepackage[dvipsnames]{xcolor} % More colors
% Footnotes
\usepackage[hang]{footmisc}
\setlength{\footnotemargin}{3mm} % Margin between footnote number and text
% Links
\usepackage{hyperref}
\hypersetup{ \hypersetup{
bookmarksnumbered = true, % Include section numbers in bookmarks bookmarksnumbered = true, % Include section numbers in bookmarks
bookmarksopen = true, % Auto-open bookmarks bookmarksopen = true, % Auto-open bookmarks
bookmarksopenlevel = 2, % Open up to subsections bookmarksopenlevel = 2, % Open up to subsections
} }
\hypersetup{ \hypersetup{
colorlinks = true, % Color links colorlinks = true, % Color links
allcolors = Black, % Default color allcolors = Black, % Default color
citecolor = OliveGreen, % Color of citations citecolor = OliveGreen, % Color of citations
linkcolor = MidnightBlue, % Color of internal links linkcolor = MidnightBlue, % Color of internal links
allbordercolors = White, % No borders around links allbordercolors = White, % No borders around links
} }
% Lists % Lists
@@ -35,10 +41,6 @@
\setlist{nolistsep} % No space before and after lists \setlist{nolistsep} % No space before and after lists
\setitemize{noitemsep} % No space between items in itemize \setitemize{noitemsep} % No space between items in itemize
% References
\usepackage{bookmark} % Manage bookmarks
\usepackage{etoc} % Local table of contents
% Tables % Tables
\usepackage{booktabs} % Better tables \usepackage{booktabs} % Better tables
\usepackage{makecell} % For multi-line cells in tables \usepackage{makecell} % For multi-line cells in tables
@@ -48,10 +50,6 @@
% Units % Units
\usepackage{siunitx} % For numbers with units \usepackage{siunitx} % For numbers with units
\sisetup{ \sisetup{
retain-explicit-plus=true, % Keep + in numbers retain-explicit-plus=true, % Keep + in numbers
uncertainty-mode=separate % Separate uncertainty with +- instead of () uncertainty-mode=separate % Separate uncertainty with +- instead of ()
} }
% Others
\usepackage[autostyle]{csquotes} % For quotes
\usepackage[dvipsnames]{xcolor} % More colors

View File

@@ -8,14 +8,14 @@
% Typography % Typography
\usepackage{iftex} \usepackage{iftex}
\ifluatex \ifluatex
\usepackage{libertinus-otf} \usepackage{libertinus-otf}
\else \else
\usepackage{mathtools} % Math improvements \usepackage{mathtools} % Math improvements
\usepackage{libertinus} % Libertinus font for text and math \usepackage{libertinus} % Libertinus font for text and math
\usepackage[T1]{fontenc} % Use T1 font encoding \usepackage[T1]{fontenc} % Use T1 font encoding
\usepackage{textcomp} % Additional symbols \usepackage{textcomp} % Additional symbols
\usepackage[varqu, varl]{inconsolata} % Better monospace font (with alternative "quote" [varqu] and "l" [varl]) \usepackage[varqu, varl]{inconsolata} % Better monospace font (with alternative "quote" [varqu] and "l" [varl])
%\usepackage{libertinust1math} % Libertinus math font %\usepackage{libertinust1math} % Libertinus math font
\fi \fi
\usepackage[english]{babel} % Typographical rules \usepackage[english]{babel} % Typographical rules
@@ -42,10 +42,10 @@
\fancyfoot[C]{\thepage} % Page number in the center of the footer \fancyfoot[C]{\thepage} % Page number in the center of the footer
\appto\mainmatter{ \appto\mainmatter{
\renewcommand{\chaptermark}[1]{\markboth{\chaptername~\thechapter~--\ #1}{}} % Chapter formatting \renewcommand{\chaptermark}[1]{\markboth{\chaptername~\thechapter~--\ #1}{}} % Chapter formatting
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}} % Section formatting \renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}} % Section formatting
\fancyhead[LO]{\small\nouppercase{\leftmark}} % Chapter in the left on odd pages \fancyhead[LO]{\small\nouppercase{\leftmark}} % Chapter in the left on odd pages
\fancyhead[RE]{\small\nouppercase{\rightmark}} % Section in the right on even pages \fancyhead[RE]{\small\nouppercase{\rightmark}} % Section in the right on even pages
} }
\setlength{\headheight}{14pt} \setlength{\headheight}{14pt}

View File

@@ -1,8 +1,8 @@
\newcommand{\importchapter}[2]{% Load a chapter (#2) in a path (#1) \newcommand{\importchapter}[2]{% Load a chapter (#2) in a path (#1)
\cleardoublepage% after a clear double page \cleardoublepage% after a clear double page
\graphicspath{{#1/figures/}}% with figures \graphicspath{{#1/figures/}}% with figures
\glsresetall% reset the acronyms \glsresetall% reset the acronyms
\includefrom{#1}{#2}% and relative paths \input in the chapter \includefrom{#1}{#2}% and relative paths \input in the chapter
} }
\newcommand{\chaptertoc}{% Print the table of contents for the chapter \newcommand{\chaptertoc}{% Print the table of contents for the chapter
@@ -17,8 +17,8 @@
\NewCommandCopy{\oldlabel}{\label} \NewCommandCopy{\oldlabel}{\label}
\newcommand{\labelprefix}{main} \newcommand{\labelprefix}{main}
\newcommand{\mainlabel}[1]{% \newcommand{\mainlabel}[1]{%
\renewcommand{\labelprefix}{#1}% \renewcommand{\labelprefix}{#1}%
\oldlabel{\labelprefix}% \oldlabel{\labelprefix}%
} }
\renewcommand{\label}[1]{\oldlabel{\labelprefix:#1}} \renewcommand{\label}[1]{\oldlabel{\labelprefix:#1}}
@@ -32,10 +32,10 @@
\NewEnvironmentCopy{oldequation}{equation} \NewEnvironmentCopy{oldequation}{equation}
\RenewDocumentEnvironment{equation}{m}{% \RenewDocumentEnvironment{equation}{m}{%
\begin{oldequation}% \begin{oldequation}%
\label{\labelprefix:eq:#1}% \label{\labelprefix:eq:#1}%
}{% }{%
\end{oldequation}% \end{oldequation}%
} }
% Images % Images
@@ -43,12 +43,12 @@
% reference later with: \figref{universe} % reference later with: \figref{universe}
% 1 = \linewidth = 150 mm % 1 = \linewidth = 150 mm
\RenewDocumentCommand{\fig}{O{1} O{htbp} m m O{}}{% #1 = width, #2 = position, #3 = filename, #4 = caption, #5 = additional caption \RenewDocumentCommand{\fig}{O{1} O{htbp} m m O{}}{% #1 = width, #2 = position, #3 = filename, #4 = caption, #5 = additional caption
\begin{figure}[#2]% \begin{figure}[#2]%
\centering% \centering%
\includegraphics[width=#1\linewidth]{#3}% \includegraphics[width=#1\linewidth]{#3}%
\caption[#4]{#4#5} \caption[#4]{#4#5}
\label{fig:#3}% \label{fig:#3}%
\end{figure}% \end{figure}%
} }
% example: % example:
@@ -58,46 +58,46 @@
% \end{subfigs} % \end{subfigs}
% reference later with: \figref{label} % reference later with: \figref{label}
\RenewDocumentEnvironment{subfigs}{O{htbp} m m o}{% #1 = position, #2 = label, #3 = filename, #4 = subfig titles \RenewDocumentEnvironment{subfigs}{O{htbp} m m o}{% #1 = position, #2 = label, #3 = filename, #4 = subfig titles
\begin{figure}[#1]% \begin{figure}[#1]%
\centering% \centering%
}{% }{%
\caption[#3]{% \caption[#3]{%
#3% #3%
\IfValueTF{#4}{% \IfValueTF{#4}{%
\begin{enumerate*}[label=\textbf{(\alph*)}]% \begin{enumerate*}[label=\textbf{(\alph*)}]%
#4% #4%
\end{enumerate*}% \end{enumerate*}%
}% }%
}% }%
\label{fig:#2}% \label{fig:#2}%
\end{figure}% \end{figure}%
} }
\NewDocumentCommand{\subfigsheight}{m}{% Set the height of the subfigures \NewDocumentCommand{\subfigsheight}{m}{% Set the height of the subfigures
\setkeys{Gin}{height=#1}% \setkeys{Gin}{height=#1}%
} }
\RenewDocumentCommand{\subfig}{o O{b} m}{% #1 = width, #2 = valign, #3 = filename \RenewDocumentCommand{\subfig}{o O{b} m}{% #1 = width, #2 = valign, #3 = filename
\hfill% \hfill%
\subfloat[\label{fig:#3}]{% \subfloat[\label{fig:#3}]{%
\IfValueTF{#1}{% \IfValueTF{#1}{%
\includegraphics[width=#1\linewidth, valign=#2, keepaspectratio]{#3}% \includegraphics[width=#1\linewidth, valign=#2, keepaspectratio]{#3}%
}{% }{%
\includegraphics[valign=#2, keepaspectratio]{#3}% \includegraphics[valign=#2, keepaspectratio]{#3}%
}%
}% }%
\hfill% }%
\hfill%
} }
\captionsetup{% \captionsetup{%
labelfont={sf,bf,up}, % sans-serif, bold, upright labelfont={sf,bf,up}, % sans-serif, bold, upright
} }
\RenewDocumentEnvironment{tab}{O{htbp} m m o}{% #1 = position, #2 = label, #3 = title, #4 = additional caption \RenewDocumentEnvironment{tab}{O{htbp} m m O{}}{% #1 = position, #2 = label, #3 = title, #4 = additional caption
\begin{table}[#1]% \begin{table}[#1]%
\centering% \centering%
\caption[#3]{#3#4}% \caption[#3]{#3#4}%
\label{tab:#2}% \label{tab:#2}%
}{% }{%
\end{table}% \end{table}%
} }