如何在 中包含的文件中强制分页\VerbatimInput
?这是 C 代码,我更喜欢对 C 编译器透明的解决方案 - 类似于源^L
代码中的换页符 ( )。
答案1
我复制了文件的开头texbook.tex
,其中用到了几个^L
。然后此代码将在这些标记处分页:
\documentclass{article}
\usepackage{fancyvrb}
\def^^L{\par} % not outer
\def\aftereject{\aftergroup\afterejectI}
\def\afterejectI{\aftergroup\pagebreak}
\begin{document}
This will have page breaks
\VerbatimInput[defineactive=\def^^L{\aftergroup\aftereject}]{tbstart.tex}
\end{document}
这是我放入文件中的部分
% This manual is copyright (C) 1984 by the American Mathematical Society.
% All rights are reserved!
% The file is distributed only for people to see its examples of TeX input,
% not for use in the preparation of books like The TeXbook.
% Permission for any other use of this file must be obtained in writing
% from the copyright holder and also from the publisher (Addison-Wesley).
\loop\iftrue
\errmessage{This manual is copyrighted and should not be TeXed}\repeat
\pausing1 \input manmac
\ifproofmode\message{Proof mode is on!}\pausing1\fi
^L% halftitle
\titlepage
\pageno=-1983
\line{\cmman The\hfill T\kern-10pt\lower13pt\hbox{E}\kern-5pt Xbook}
\vfill
\ifproofmode
\rightline{The fine print in the upper right-hand}
\rightline{corner of each page is a draft of intended}
\rightline{index entries; it won't appear in the real book.}
\rightline{Some index entries will be in |typewriter type|}
\rightline{and/or preceded by {\tt\char`\\} or enclosed in \<$\ldots$>, etc;}
\rightline{such typographic distinctions aren't shown here.}
\rightline{An index entry often extends for several pages;}
\rightline{the actual scope will be determined later.}
\rightline{Please note things that should be indexed but aren't.}
\fi
\eject
^L% title
\pageno=-1 % the front matter is numbered with roman numerals
\font\auth=cmssdc10 scaled\magstep4 % used only on the title page
\font\elevenbf=cmbx10 scaled\magstephalf % ditto
\font\elevenit=cmti10 scaled\magstephalf % ditto
\font\elevenrm=cmr10 scaled\magstephalf % ditto
\titlepage
\line{\cmman The\hfill T\kern-10pt\lower13pt\hbox{E}\kern-5pt Xbook}
^^{Knuth, Donald Ervin}
^^{Bibby, Duane Robert}
这里^L
出现两个字符,因此您应该找到一种方法来强制您的编辑器插入真正的^L
。
第一个输出页如下,请注意,分页符就在 处^L
。
注意事项
^^L
使非外部^^L
已经处于活动状态- 我们必须弹出两层拳击才能获得
\pagebreak
效果