I'm a total beginner in latex ; I mostly use it indirectly using pandoc to generate PDF from markdown.
I could not manage to make something good (you know, time, willpower...), so I cheated ; I used my predecessor's work and managed somehow to hack something I liked...
But then ! Then one problem I couldn't solve. Only the LAST page of any document I make have a footer. Every other page don't have it. Any idea ? I'm not necesarly asking for the straight solution but for what package/function could cause that so I could solve it myself. I played around and start to despair :/
Example of file I get : https://gnuw.arzinfo.pw/data/otyugh/ass ... /cr.md.pdf
I use the following template :
Code: Select all
\documentclass[a4paper,12pt]{book}
\usepackage{fontspec}
\setmainfont{FreeSans}
\setmonofont{Hack}
\usepackage{setspace}
\setstretch{1.25}
\usepackage[shorthands=off,french]{babel}
% pas de page vide
\let\cleardoublepage\clearpage
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
% mise en page et taille
\usepackage{geometry}
\geometry{top=65pt,bottom=70pt,right=50pt,left=50pt}
% captions sans label ni numéro.
\usepackage[font={small,it},labelformat=empty]{caption}
% prise en charge des images
\usepackage{graphicx}
\usepackage{grffile}
% forcer le positionnement des images dans le texte
\usepackage{float}
\let\origfigure\figure
\let\endorigfigure\endfigure
\renewenvironment{figure}[1][2] {
\expandafter\origfigure\expandafter[H]
} {
\endorigfigure
}
\usepackage[export]{adjustbox}
% plus de couleurs
\usepackage[dvipsnames]{xcolor}
\definecolor{Covercolor}{HTML}{005885}
\definecolor{Chaptercolor}{HTML}{67ADD0}
% links
\usepackage[unicode=true]{hyperref}
\hypersetup{breaklinks=true,
bookmarks=true,
pdfauthor={$author-meta$},
pdftitle={$title-meta$},
colorlinks=true,
citecolor=.,
urlcolor=Covercolor,
linkcolor=Covercolor,
filecolor=.,
pdfborder={0 0 0}}
% don't use monospace font for urls
\urlstyle{same}
% custom header/footer/page
\usepackage{fancyhdr}
\usepackage{fancybox}
\pagestyle{plain}
\fancyhf{}
% header & footer
\lfoot{$title$}
\cfoot{\thepage}
$if(logo)$
\rfoot{\includegraphics[width=18pt,valign=c]{$logo$}}
$endif$
\pagenumbering{arabic}
\renewcommand{\headrulewidth}{0pt} % pas de ligne en header
\renewcommand{\footrulewidth}{0pt} % pas de ligne en footer
\lhead{\itshape{\nouppercase{\rightmark}}}
\chead{}
% liste à puces rondes pas fr
\frenchbsetup{StandardLists=true}
% profondeur de la numérotation
\setcounter{secnumdepth}{4}
% retirer les saut de page après chapitre
\usepackage{etoolbox}
\makeatletter
\patchcmd{\chapter}{\if@openright\cleardoublepage\else\clearpage\fi}{}{}{}
\makeatother
\usepackage{titlesec}
% titres #1 custom : seul sur une page colorée
%\titleformat{\chapter}[hang]{\vspace{20ex}\thispagestyle{empty}\pagecolor{Chaptercolor}\color{white}\vbox{\rule{\textwidth}{20pt}}\vspace{2ex}\bfseries\LARGE}%
% {\thechapter}{.5ex}{\centering}[\vspace{1.2ex}\rule{\textwidth}{20pt}\clearpage\pagecolor{white}]%
% {\bfseries\LARGE}
% titre #1 custom : bandeau de couleur
\titleformat{\chapter}[block]{\color{white}\thispagestyle{empty}\bfseries\Large}{}{0pt}{\colorsection}
\titlespacing*{\chapter}{0pt}{\baselineskip}{\baselineskip}
\newcommand{\colorsection}[1]{%
\colorbox{Covercolor}{\parbox{\dimexpr\textwidth-2\fboxsep}{\thechapter\ #1}}}
% titre #2 custom : color
\titleformat{\section}[hang]{\color{Covercolor}\bfseries\large}%
{\thesection}{.5ex}{}%
{\bfseries\large}
% titre #3 custom color
\titleformat{\subsection}[hang]{\color{Covercolor}\bfseries\large}%
{\thesubsection}{.5ex}{}%
{\bfseries\large}
% titre #4 custom color
\titleformat{\subsubsection}[hang]{\color{Covercolor}\bfseries\large}%
{\thesubsubsection}{.5ex}{}%
{\bfseries\large}
% codes sans cadre
\usepackage{listings}
\lstset{backgroundcolor=\color{gray!10},xleftmargin=1ex,xrightmargin=1ex,
frame=leftline,language=sh,basicstyle=\ttfamily\small,breaklines=true,
prebreak={\textbackslash}}
% images
% ne pas dépasser la zone de texte
\raggedbottom
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\setlength\@fptop{0\p@}% float at the top
\makeatother
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
% tables
$if(tables)$
\usepackage{longtable,booktabs}
$endif$
$if(strikeout)$
% avoid problems with \sout in headers with hyperref:
\usepackage[normalem]{ulem}
\pdfstringdefDisableCommands{\renewcommand{\sout}{}}
$endif$
% listes serrées
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}
}
$for(header-includes)$
$header-includes$
$endfor$
% start----------------------------------------------------------------
\begin{document}
\begin{titlepage}
\pagecolor{Covercolor}\color{white}\centering
\rule{\textwidth}{.75pt}\vskip25pt
{\bfseries\Huge $title$}
$if(date)$ \\$date$\vskip5pt $endif$
\vfill
$if(logo)$
\vfill
\IfFileExists{$logo$}{
\includegraphics[width=8cm]{$logo$}
}{<!>logo : chemin incorrect<!>}
$endif$
\vfill\vfill
{\normalsize $author$\vskip5pt}
Dernière mise à jour : \today\vskip5pt
\rule{\textwidth}{.75pt}
\end{titlepage}
$for(include-before)$
$include-before$
$endfor$
%\clearpage
\pagecolor{white}
\color{black}
\setcounter{page}{1}
$body$
$for(include-after)$
$include-after$
$endfor$
% toc
\hypersetup{linkcolor=black}
\setcounter{tocdepth}{4}
%\clearpage
%\tableofcontents\label{toc}
%\clearpage
% lof
%\listoffigures\label{pics}
%\clearpage
\end{document}