From 964681c2ecd458c38c862535c2a705a830a7808d Mon Sep 17 00:00:00 2001 From: Erwan Normand Date: Tue, 24 Sep 2024 11:27:30 +0200 Subject: [PATCH] Fix latex format --- 4-conclusion/acronyms.tex | 10 ++--- 4-conclusion/figures.tex | 6 +-- 4-conclusion/tables.tex | 6 +-- config/acronyms.tex | 38 ++++++++-------- config/bibliography.tex | 68 ++++++++++++++-------------- config/content.tex | 44 +++++++++--------- config/template.tex | 24 +++++----- config/thesis_commands.tex | 92 +++++++++++++++++++------------------- 8 files changed, 143 insertions(+), 145 deletions(-) diff --git a/4-conclusion/acronyms.tex b/4-conclusion/acronyms.tex index 152549f..88d750e 100644 --- a/4-conclusion/acronyms.tex +++ b/4-conclusion/acronyms.tex @@ -1,8 +1,8 @@ { - \hypersetup{linkcolor=black} - \chapterstartoc{List of Acronyms} - \label{ch:acronyms} + \hypersetup{linkcolor=black} + \chapterstartoc{List of Acronyms} + \label{ch:acronyms} - \renewcommand{\glossarysection}[2][]{} % Remove the title of the glossary - \printnoidxglossary + \renewcommand{\glossarysection}[2][]{} % Remove the title of the glossary + \printnoidxglossary } diff --git a/4-conclusion/figures.tex b/4-conclusion/figures.tex index 66bbe0c..97f1344 100644 --- a/4-conclusion/figures.tex +++ b/4-conclusion/figures.tex @@ -1,5 +1,5 @@ { - \hypersetup{linkcolor=black} -\listoffigures -\addcontentsline{toc}{chapter}{\listfigurename} + \hypersetup{linkcolor=black} + \listoffigures + \addcontentsline{toc}{chapter}{\listfigurename} } diff --git a/4-conclusion/tables.tex b/4-conclusion/tables.tex index bcc8572..e9eb683 100644 --- a/4-conclusion/tables.tex +++ b/4-conclusion/tables.tex @@ -1,5 +1,5 @@ { -\hypersetup{linkcolor=black} -\listoftables -\addcontentsline{toc}{chapter}{\listtablename} + \hypersetup{linkcolor=black} + \listoftables + \addcontentsline{toc}{chapter}{\listtablename} } diff --git a/config/acronyms.tex b/config/acronyms.tex index 71ef719..cd512be 100644 --- a/config/acronyms.tex +++ b/config/acronyms.tex @@ -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 diff --git a/config/bibliography.tex b/config/bibliography.tex index d45c445..305a3dc 100644 --- a/config/bibliography.tex +++ b/config/bibliography.tex @@ -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}% } diff --git a/config/content.tex b/config/content.tex index b9cfb15..ee178b3 100644 --- a/config/content.tex +++ b/config/content.tex @@ -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 \ No newline at end of file diff --git a/config/template.tex b/config/template.tex index 507b35f..7d235f7 100644 --- a/config/template.tex +++ b/config/template.tex @@ -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 \ No newline at end of file +\vbadness=\maxdimen diff --git a/config/thesis_commands.tex b/config/thesis_commands.tex index 6238525..5445d66 100644 --- a/config/thesis_commands.tex +++ b/config/thesis_commands.tex @@ -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}% }