## 编译环境
操作系统
* [x] Windows 7/8/10
* [ ] macOS
* [ ] Linux
`若需勾选,请把[ ]改成[x]`
Tex发行版
* [x] TexLive `2...
## 编译环境
操作系统
* [x] Windows 7/8/10
* [ ] macOS
* [ ] Linux
`若需勾选,请把[ ]改成[x]`
Tex发行版
* [x] TexLive `2020`
* [ ] MikTeX `版本号`
* [ ] CTeX
`若需勾选,请把[ ]改成[x]`
## 我的问题
最近读完《The TeX Book》,想玩玩 `\shipout` 命令练手。于是自己给自己提一个需求——每页都要判断文字占用行高是否超过版心高的一半,如果是,则在版心下方空白处居中打印 “以下空白” 字样。
以下代码可以完成任务
```tex
\documentclass{article}
\usepackage{lipsum}
\makeatletter
\output={\shipout\box255}
\let\shipout@temp=\shipout
\def\shipout{\shipout@hook\shipout@temp}
\long\def\shipout@hook{%
% \shipout@temp\vbox{%
% baselineskip = \the\baselineskip, pagetotal = \the\pagetotal, pagegoal = \the\pagegoal
% \par
% \ifdim\pagetotal<.5\pagegoal
% less then a half.
% \else
% more then a half.
% \fi}
\ifdim\pagetotal<.5\pagegoal
\setbox255=\vbox to\pagegoal{\unvbox255 \vfill\hbox to\hsize{\hfill\Huge NULL\hfill}\vfill}
\fi}
\makeatother
\begin{document}
\lipsum
\end{document}
```
输出共 3 页

取消 8 - 15 行的注释可以看到在独立一页中输出相关数据
目前的问题是,如果将第 4 行注释掉,根据书上说,TeX 将使用自己的例行程序。然而这导致后续自定义的钩子就不工作了,难道 (La)TeX 自己的例行程序没有使用 `\box255` 么?

一周热门 更多>