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

View File

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

View File

@@ -3,31 +3,37 @@
\definechangesauthor[color=RawSienna]{CP}
\newcommand{\CP}[1]{\comment[id=CP]{#1}}
% Footnotes
\usepackage[hang]{footmisc}
\setlength{\footnotemargin}{3mm} % Margin between footnote number and text
% Images
\usepackage{graphicx}
\usepackage{caption} % Point references to the figure not the caption
\usepackage[export]{adjustbox} % For valign in subfigs
% Includes
\usepackage{bookmark} % Manage bookmarks
\usepackage{import} % Allow relative paths
\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{
bookmarksnumbered = true, % Include section numbers in bookmarks
bookmarksopen = true, % Auto-open bookmarks
bookmarksopenlevel = 2, % Open up to subsections
bookmarksnumbered = true, % Include section numbers in bookmarks
bookmarksopen = true, % Auto-open bookmarks
bookmarksopenlevel = 2, % Open up to subsections
}
\hypersetup{
colorlinks = true, % Color links
allcolors = Black, % Default color
citecolor = OliveGreen, % Color of citations
linkcolor = MidnightBlue, % Color of internal links
allbordercolors = White, % No borders around links
colorlinks = true, % Color links
allcolors = Black, % Default color
citecolor = OliveGreen, % Color of citations
linkcolor = MidnightBlue, % Color of internal links
allbordercolors = White, % No borders around links
}
% Lists
@@ -35,10 +41,6 @@
\setlist{nolistsep} % No space before and after lists
\setitemize{noitemsep} % No space between items in itemize
% References
\usepackage{bookmark} % Manage bookmarks
\usepackage{etoc} % Local table of contents
% Tables
\usepackage{booktabs} % Better tables
\usepackage{makecell} % For multi-line cells in tables
@@ -48,10 +50,6 @@
% Units
\usepackage{siunitx} % For numbers with units
\sisetup{
retain-explicit-plus=true, % Keep + in numbers
uncertainty-mode=separate % Separate uncertainty with +- instead of ()
retain-explicit-plus=true, % Keep + in numbers
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
\usepackage{iftex}
\ifluatex
\usepackage{libertinus-otf}
\usepackage{libertinus-otf}
\else
\usepackage{mathtools} % Math improvements
\usepackage{libertinus} % Libertinus font for text and math
\usepackage[T1]{fontenc} % Use T1 font encoding
\usepackage{textcomp} % Additional symbols
\usepackage[varqu, varl]{inconsolata} % Better monospace font (with alternative "quote" [varqu] and "l" [varl])
%\usepackage{libertinust1math} % Libertinus math font
\usepackage{mathtools} % Math improvements
\usepackage{libertinus} % Libertinus font for text and math
\usepackage[T1]{fontenc} % Use T1 font encoding
\usepackage{textcomp} % Additional symbols
\usepackage[varqu, varl]{inconsolata} % Better monospace font (with alternative "quote" [varqu] and "l" [varl])
%\usepackage{libertinust1math} % Libertinus math font
\fi
\usepackage[english]{babel} % Typographical rules
@@ -42,10 +42,10 @@
\fancyfoot[C]{\thepage} % Page number in the center of the footer
\appto\mainmatter{
\renewcommand{\chaptermark}[1]{\markboth{\chaptername~\thechapter~--\ #1}{}} % Chapter formatting
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}} % Section formatting
\fancyhead[LO]{\small\nouppercase{\leftmark}} % Chapter in the left on odd pages
\fancyhead[RE]{\small\nouppercase{\rightmark}} % Section in the right on even pages
\renewcommand{\chaptermark}[1]{\markboth{\chaptername~\thechapter~--\ #1}{}} % Chapter formatting
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}} % Section formatting
\fancyhead[LO]{\small\nouppercase{\leftmark}} % Chapter in the left on odd pages
\fancyhead[RE]{\small\nouppercase{\rightmark}} % Section in the right on even pages
}
\setlength{\headheight}{14pt}
@@ -54,4 +54,4 @@
\hfuzz=20pt
\vfuzz=20pt
\hbadness=2000
\vbadness=\maxdimen
\vbadness=\maxdimen

View File

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