为了增加exam
类中的页脚宽度,我采用了提供的解决方案这里。效果很好。但是,它生成了过多的\hbox
警告信息。这有点个人化,但我总是试图摆脱所有警告信息。
请参阅 MWE。
\documentclass{exam}
% Page dimensions
\usepackage[dvips,pdftex,legalpaper,top=10.0mm,bottom=20.0mm,includeheadfoot,left=20.0mm,right=35.0mm]{geometry}
% Footer
\newlength\footerwidth
\setlength\footerwidth{\textwidth}
\addtolength{\footerwidth}{\marginparwidth}
\addtolength{\footerwidth}{\marginparsep}
\RequirePackage{xpatch}
\makeatletter
\patchcmd{\@fullfoot}{\hbox to \textwidth}{\hbox to \footerwidth}%
{}{\errmessage{Patching of \noexpand\run@fullfoot failed}}
\patchcmd{\run@fullfoot}{\hbox to \textwidth}{\hbox to \footerwidth}%
{}{\errmessage{Patching of \noexpand\run@fullfoot failed}}
\makeatother
\pagestyle{foot}
\footer{}{}{Page \thepage}
\begin{document}
\begin{questions}
\question [10] How do I get rid of the annoying overfull message?
\end{questions}
\end{document}
我想摆脱这样的警告信息,
Overfull \hbox (41.135pt too wide) has occurred while \output is active []
我知道我需要添加\begingroup\hfuzz\maxdimen\endgroup
一些代码但找不到确切的位置。
答案1
使用不同的方法...而不是增加全部的页脚宽度,您只需在右/左页脚之后/之前插入一个负空间即可将其推入边距。
\documentclass{exam}
% Page dimensions
\usepackage[
top=10mm,
bottom=20mm,
includeheadfoot,
left=20mm,
right=35mm
]{geometry}
% Footer
\pagestyle{foot}
\footer{}% <left>
{}% <center>
{Page \thepage\hspace*{-\dimexpr\marginparsep+\marginparwidth}}% <right>
\begin{document}
\begin{questions}
\question [10] How do I get rid of the annoying overfull message?
\end{questions}
\end{document}
答案2
这使用与 Werner 的答案相同的想法,但是您可以简单地做到这一点,而无需使用几何包:
\documentclass{exam}
\pagestyle{foot}
\footer{}% Empty Left
{}% Empty Center
{\rlap{\enskip Page \thepage}}
\begin{document}
\begin{questions}
\question [10] How do I get rid of the annoying overfull message?
\end{questions}
Here's some text to show the margins.
Here's some text to show the margins.
Here's some text to show the margins.
Here's some text to show the margins.
Here's some text to show the margins.
Here's some text to show the margins.
Here's some text to show the margins.
\end{document}
答案3
此版本用于\makebox
将 a 塞进\footerwidth
\hbox
空间\textwidth
。
\documentclass{exam}
% Page dimensions
\usepackage[dvips,pdftex,legalpaper,top=10.0mm,bottom=20.0mm,includeheadfoot,left=20.0mm,right=35.0mm,showframe]{geometry}
% Footer
\newlength\footerwidth
\setlength\footerwidth{\textwidth}
\addtolength{\footerwidth}{\marginparwidth}
\addtolength{\footerwidth}{\marginparsep}
\RequirePackage{xpatch}
\makeatletter
\newcommand{\myfoot}[1]{\makebox[\textwidth][l]{\hbox to \footerwidth{#1}}}
\patchcmd{\@fullfoot}{\hbox to \textwidth}{\myfoot}%
{}{\errmessage{Patching of \noexpand\run@fullfoot failed}}
\patchcmd{\run@fullfoot}{\hbox to \textwidth}{\myfoot}%
{}{\errmessage{Patching of \noexpand\run@fullfoot failed}}
\makeatother
\pagestyle{foot}
\footer{}{}{Page \thepage}
\begin{document}
\begin{questions}
\question [10] How do I get rid of the annoying overfull message?
\end{questions}
\end{document}