我正在论文的每一页边缘设置章节标记,但遇到了一个问题\thechapter
偏离了一个。我设法通过检查发货文档并尝试不同的钩子。如果有人遇到类似的问题,这里有一个最小的工作示例。
干杯
\documentclass[10pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage[absolute]{textpos}
\TPGrid[0mm,0mm]{10}{12}
\newcommand*{\AddEverypageHook}[1]{%
% \AddToHook{shipout/background}{\put(1in,-1in){#1}}} % This does not work
\AddToHook{shipout/before}{#1} % This is the fix
}
\begin{document}
\AddEverypageHook{
\textblockcolour{black}
\begin{textblock}{1}(0,0)
\vspace{10.5mm}
\hspace{7mm}\huge{\sffamily\fontseries{b}\selectfont\thechapter}
\vspace{10.5mm}
\end{textblock}
}
\chapter{Foo}
\chapter{Bar}
\end{document}