对于以下 MWE:
\documentclass[a4paper,12pt,addpoints]{exam}
\usepackage[]{geometry}
\usepackage{lipsum,graphbox,mdframed,array,ragged2e,booktabs,fmtcount,multicol,multirow,tabularx,cellspace,calc,tcolorbox,tikz,calc,fmtcount,etoolbox,soul}
\pagestyle{headandfoot}
\firstpagefooter%
{}%
{%
\hrule\vspace{2pt}
\begin{minipage}[t][][t]{0.5\textwidth}
text
\end{minipage}%
\begin{minipage}[t][][t]{0.5\textwidth}
\flushright Page \thepage\ of \numpages%
\flushright\vspace{\baselineskip}Please Turn Over \begin{tikzpicture}[baseline=-\the\dimexpr\fontdimen22\textfont2\relax]\draw[-latex,line width=4pt] (0,0) -- ++(10mm,0);\end{tikzpicture}%
\end{minipage}%
}%
{}
\begin{document}
\begin{questions}
\question
\lipsum
\end{questions}
\end{document}
,绘制 tikz 箭头时出现此错误
字体 \nullfont 只有 7 个 fontdimen 参数。
然而,当删除页脚中箭头的 tikz 绘图时
\firstpagefooter%
{}%
{%
\hrule\vspace{2pt}
\begin{minipage}[t][][t]{0.5\textwidth}
text
\end{minipage}%
\begin{minipage}[t][][t]{0.5\textwidth}
\flushright Page \thepage\ of \numpages%
\flushright\vspace{\baselineskip}Please Turn Over
\end{minipage}%
}%
{}
错误消失。
因此,我有两个问题:
1-绘制箭头时什么原因导致此错误?
2-为什么箭头没有与内联文本垂直对齐,如下所示?
答案1
您需要确保在请求时数学字体设置正确\fontdimen22\textfont2
,这可以通过发出来完成\check@mathfonts
。
\documentclass[a4paper,12pt,addpoints]{exam}
\usepackage{geometry}
\usepackage{tikz}
\usepackage{lipsum}
\makeatletter
\newcommand\turnover{%
\check@mathfonts % ensure math fonts are defined
\begin{tikzpicture}[baseline=-\the\dimexpr\fontdimen22\textfont2\relax]
\draw[-latex,line width=4pt] (0,0) -- ++(10mm,0);
\end{tikzpicture}%
}
\makeatother
\pagestyle{headandfoot}
\firstpagefooter%
{}%
{%
\hrule\vspace{2pt}
\begin{minipage}[t]{0.5\textwidth}
text
\end{minipage}%
\begin{minipage}[t]{0.5\textwidth}
\raggedleft
Page \thepage\ of \numpages\\[\baselineskip]
Please Turn Over \turnover
\end{minipage}%
}%
{}
\begin{document}
\begin{questions}
\question
\lipsum
\end{questions}
\end{document}
请注意不是使用\flushright
,但是\raggedleft
。
答案2
也许你想要这个
\documentclass[a4paper,12pt,addpoints]{exam}
\usepackage[]{geometry}
\usepackage{lipsum,graphbox,mdframed,array,ragged2e,booktabs,fmtcount,multicol,multirow,tabularx,cellspace,calc,tcolorbox,tikz,calc,fmtcount,etoolbox,soul}
\pagestyle{headandfoot}
\firstpagefooter%
{}%
{%
\hrule\vspace{2pt}
\begin{minipage}[t][][t]{0.5\textwidth}
text
\end{minipage}%
\begin{minipage}[t][][t]{0.5\textwidth}
\flushright Page \thepage\ of \numpages%
\flushright\vspace{\baselineskip}Please Turn Over
$\vcenter{\hbox{\begin{tikzpicture}\draw[-latex,line width=4pt] (0,0) -- ++(10mm,0);\end{tikzpicture}}}$%
\end{minipage}%
}%
{}
\begin{document}
\begin{questions}
\question
\lipsum
\end{questions}
\end{document}