I need to fit all the text on the page into a frame. The margins on each edge are two centimeters. The headers and footers should be in a frame. That is, the header should start on the second centimeter from the beginning of the page. The footer should end before the second centimeter from the end of the page.
Here's what I tried
\documentclass[12pt, a4paper, titlepage]{extreport}
\usepackage{fontspec}
\setmainfont{CMU Serif}
\setsansfont{CMU Sans Serif}
\setmonofont{CMU Typewriter Text}
\usepackage{polyglossia}
\setdefaultlanguage{latin}
\setotherlanguage{english}
\usepackage[
a4paper,
margin=2cm,
includeheadfoot,
noheadfoot,
nomarginpar,
showframe
]{geometry}
\usepackage{blindtext}
\begin{document}
\Blinddocument
\end{document}
But the footer is still outside the frame.
I need to fit all the text on the page into a frame. The margins on each edge are two centimeters. The headers and footers should be in a frame. That is, the header should start on the second centimeter from the beginning of the page. The footer should end before the second centimeter from the end of the page.
Here's what I tried
\documentclass[12pt, a4paper, titlepage]{extreport}
\usepackage{fontspec}
\setmainfont{CMU Serif}
\setsansfont{CMU Sans Serif}
\setmonofont{CMU Typewriter Text}
\usepackage{polyglossia}
\setdefaultlanguage{latin}
\setotherlanguage{english}
\usepackage[
a4paper,
margin=2cm,
includeheadfoot,
noheadfoot,
nomarginpar,
showframe
]{geometry}
\usepackage{blindtext}
\begin{document}
\Blinddocument
\end{document}
But the footer is still outside the frame.
Share Improve this question edited Feb 15 at 13:20 samcarter_is_at_topanswers.xyz 38.9k5 gold badges57 silver badges76 bronze badges asked Feb 14 at 0:25 TimothéeTimothée 112 bronze badges 3- Cann you add a sketch how the result should look like? – samcarter_is_at_topanswers.xyz Commented Feb 14 at 9:22
- Added a scetch for reference. – Timothée Commented Feb 15 at 13:16
- Thanks. Also about xelatex: texdev/2024/11/05/engine-news-from-the-latex-project – samcarter_is_at_topanswers.xyz Commented Feb 15 at 13:24
1 Answer
Reset to default 0If you draw the frame separately, you could increase the bottom margin to whatever is needed to place the page number inside of the frame:
\documentclass[12pt, a4paper, titlepage]{extreport}
\usepackage[
a4paper,
margin=2cm,
bottom=2.4cm,
includeheadfoot,
noheadfoot,
nomarginpar,
]{geometry}
\usepackage{duckuments}
\usepackage{tikz}
\AddToHook{shipout/background}{
\begin{tikzpicture}[remember picture,overlay]
\draw[red] ([shift={(2cm,2cm)}]current page.south west) rectangle ([shift={(-2cm,-2cm)}]current page.north east);
\end{tikzpicture}
}
\begin{document}
\duckument
\end{document}