From e28102591d5c1f22c66f2924903b8e9d3506b794 Mon Sep 17 00:00:00 2001 From: Samuel Ortion Date: Wed, 17 Apr 2024 10:50:29 +0200 Subject: [PATCH] Use cleanthesis pretty page numbering --- report.org | 3 +- report.pdf | 4 +- setup.org | 8 ++- sty/lamme2024.sty | 123 ++++++++++++++++++++++++++++++++++++++++------ 4 files changed, 120 insertions(+), 18 deletions(-) diff --git a/report.org b/report.org index 2f92aff..649ece7 100644 --- a/report.org +++ b/report.org @@ -2,7 +2,7 @@ #+author: Samuel Ortion #+date: 2023-2024 #+LATEX_CLASS: lamme2024 -#+LATEX_CLASS_OPTIONS: [twoside=false] +#+LATEX_CLASS_OPTIONS: [twoside=true] #+LATEX_HEADER: \usepackage{sty/lamme2024} #+bibliography: references.bib @@ -227,3 +227,4 @@ Principle: construct vertex communities based on where an agent would get stuck # Local Variables: # eval: (progn (org-babel-goto-named-src-block "startup") (org-babel-execute-src-block) (outline-hide-sublevels 1)) # End: +* diff --git a/report.pdf b/report.pdf index 2573e69..fbcd519 100644 --- a/report.pdf +++ b/report.pdf @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a33b17a4dc21bd767ab98a233be1903c840c806cedb9a4ddc50a99e35a23b70a -size 185000 +oid sha256:159602494c9369ec8c88c0d353566b76b1fa3e7f549b1a9ba9f7acb24086090a +size 194024 diff --git a/setup.org b/setup.org index 63f2321..640ec3d 100644 --- a/setup.org +++ b/setup.org @@ -6,6 +6,9 @@ Let's say I want this emacs-lisp code to be run at startup when I open my org fi (setq lamme2024 "org powered") #+end_src +#+RESULTS: +: org powered + To do so, add the following somewhere in your =report.org= file: #+begin_src org #+name: startup @@ -50,7 +53,7 @@ See: [[https://emacs.stackexchange.com/a/41456/41374]] * Add latex: link for custom latex macro text wrapping -#+begin_src emacs-lisp +#+begin_src emacs-lisp :tangle yes (org-add-link-type "latex" nil (lambda (path desc format) @@ -61,6 +64,9 @@ See: [[https://emacs.stackexchange.com/a/41456/41374]] (format "\\%s{%s}" path desc))))) #+end_src +#+RESULTS: +: Created latex link. + #+begin_src emacs-lisp :tangle yes (org-add-link-type "latex" nil diff --git a/sty/lamme2024.sty b/sty/lamme2024.sty index f814e80..b0a91d6 100644 --- a/sty/lamme2024.sty +++ b/sty/lamme2024.sty @@ -14,6 +14,16 @@ \RequirePackage{subcaption} \RequirePackage{csquotes} \RequirePackage[english]{babel} +%% Caption +\captionsetup{ + labelfont={color=black, bf}, + figurename=Figure, + tablename=Table, + font={sf}, + labelsep=period, + justification=raggedright, + singlelinecheck=false +} % Colors \RequirePackage{xcolor} @@ -134,19 +144,104 @@ \addtocontents{toc}{\protect\setcounter{tocdepth}{#1}}% \setcounter{tocdepth}{#1}% } -% Adapted to KOMA-Script (and to my preferences): -\renewcommand*{\sectionformat}{\thesection\filright\hspace{1ex}} -\addtokomafont{subsection}{\color{primary}} \fi -\usepackage{titlesec} -\titleformat{\chapter}[frame] -{\itshape\color{primary}} -{\filright - \normalsize - \enspace Chapter \thechapter\enspace} -{10mm} -{\fontsize{35}{20}\selectfont\normalfont\bfseries\filright\hspace{1ex}} -\titleformat{\section}{\Large\normalfont\bfseries\color{primary}}{\thesection \hspace{1ex}}{1ex}{} -\titleformat{\subsection}{\large\normalfont\bfseries\color{primary}}{\thesubsection \hspace{1ex}}{1ex}{} -\titleformat{\subsubsection}{\normalsize\normalfont\bfseries\color{primary}}{}{1ex}{} +% + +% \usepackage{sty/cleanthesis-extracts} + +\RequirePackage[manualmark]{scrlayer-scrpage} +\renewcommand*\chaptermark[1]{% + \markboth{\Ifnumbered{chapter}{\chaptermarkformat}{}}{#1}% <- outdated macro replaced +} +\AfterTOCHead[toc]{\markboth{}{\contentsname}} + +\clearpairofpagestyles +\clubpenalty = 10000 +\widowpenalty = 10000 + +\automark[section]{part} +\setlength{\footheight}{120pt} % avoids scrlayer-scrpage warning: +% footheight to low warning +\setlength{\footskip}{185pt} % BAD HACK that moves the foot downwards +\KOMAoption{footwidth}{foot:53pt} % BAD HACK that moves the foot towards +\setkomafont{pagefoot}{\normalfont\footnotesize} +\setkomafont{pagenumber}{\normalfont \fontfamily{\sfdefault}\selectfont \normalsize \bfseries\color{black}} + +\renewcommand{\partmark}[1]{% + \markboth{% + % use \@chapapp instead of \chaptername to avoid + % 'Chapter A Appendix ...', thanks to @farbverlust (issue #47) + \fontfamily{\sfdefault}\selectfont + {\color{fgBlue}\textbf{\partname\ \thepart}}% + \quad% + \protect\begin{minipage}[t]{.65\textwidth}% + #1% + \protect\end{minipage}% + }{}% +} + +\newlength{\lensectionnumber} +\renewcommand{\sectionmark}[1]{% + \markright{% + \normalsize\fontfamily{\sfdefault}\selectfont\bfseries + \setlength{\lensectionnumber}{0em} + \settowidth{\lensectionnumber}{\textbf{\thesection}\quad} + \protect\begin{minipage}[t]{.72\textwidth}% + {\ }% bad hack to prevent a wrong baseline for the minipage + \protect\raggedleft% + \hangindent=\lensectionnumber% + {\color{black}\textbf{\fontfamily{\sfdefault}\selectfont\thesection}}% + \quad% + #1% + \protect\end{minipage}% + }% +} + +\newcommand{\ctfooterline}{% + \color{black}\rule[-90pt]{1.25pt}{100pt}% +} + +% Page number for odd (right) pages +\newcommand{\ctfooterrightpagenumber}{% + \ctfooterline% + \hspace*{10pt}% + \begin{minipage}[b]{1.5cm}% + \pagemark\ % + \end{minipage}% +} + +%% Page number for even (left) pages +\newcommand{\ctfooterleftpagenumber}{% + \begin{minipage}[b]{1.5cm}% + \raggedleft\pagemark% + \end{minipage}% + \hspace*{10pt}% + \ctfooterline% +} + +%% Defines the content for header and footer +\lehead{} +\cehead{} +\rehead{} +\lohead{} +\cohead{} +\rohead{} +\lefoot[% > plain + \ctfooterleftpagenumber% +]{% > srcheadings + \ctfooterleftpagenumber% + \hspace*{0.75cm}% + %\headmark% +} +\cefoot{} +\refoot{} +\lofoot{} +\cofoot{} +\rofoot[% > plain + \ctfooterrightpagenumber% +]{% > srcheadings + %\headmark% + \hspace*{0.75cm}% + \ctfooterrightpagenumber% +}