我想创建双面文章作为小册子,其中第一页居中,其余页面不居中。出于某种原因,在 afterpage 宏中使用\newgeometry
andrestoregeometry
不起作用。这是一个最小(非)工作示例:
\documentclass[11pt,twoside,a5paper]{article}
\newlength{\marg}
\setlength{\marg}{1in}
\usepackage[paper=a5paper,twoside,bottom=\marg,top=\marg,left=\dimexpr\marg-.4in\relax,right=\marg]{geometry}
\usepackage{afterpage,lipsum}
\title{Some Booklet}
\author{Me \and Myself \and I}
\begin{document}
\newgeometry{margin=\marg}
\maketitle
\afterpage{\clearpage\restoregeometry}
Here is some text that will still be on the first page. As soon as the page breaks,
there should be a new (resp. old) twoside geometry, with the text continuing freely.
But it doesn't work! %(ノ°Д°)ノ︵ ┻━┻
\lipsum[1-6]
\end{document}
有人知道为什么这不起作用吗?
答案1
TeX 换行发生在分页之前,因此您需要在段落被分成行之前知道行宽,这意味着您需要知道文本将落在哪一页。不过,通过一些手动操作,您可以强制实现所需的输出。
\documentclass[11pt,twoside,a5paper]{article}
\newlength{\marg}
\setlength{\marg}{1in}
\usepackage[paper=a5paper,twoside,bottom=\marg,top=\marg,left=\dimexpr\marg-.4in\relax,right=\marg]{geometry}
\usepackage{afterpage,lipsum}
\title{Some Booklet}
\author{Me \and Myself \and I}
\begin{document}
\newgeometry{margin=\marg}
\maketitle
Here is some text that will still be on the first page. As soon as the page breaks,
there should be a new (resp. old) twoside geometry, with the text continuing freely.
But it doesn't work! %(ノ°Д°)ノ︵ ┻━┻
\lipsum[1]
% first bit of paragraph 2
Nam dui ligula, fringilla a, euismod sodales, sollicitudin
vel, wisi. Morbi auctor lorem non justo. Nam lacus libero,
pretium at, lobortis vitae, ultricies et, tellus. Donec
aliquet, tortor sed accumsan bibendum, erat ligula aliquet{\parfillskip=0pt\par}
\restoregeometry
%\lipsum[2]
% second bit of paragraph 2
\noindent magna, vitae ornare odio metus a mi. Morbi ac orci et nisl
hendrerit mollis. Suspendisse ut massa. Cras nec ante. Pellentesque a
nulla. Cum sociis natoque penatibus et magnis dis parturient montes,
nascetur ridiculus mus. Aliquam tincidunt urna. Nulla ullamcorper
vestibulum turpis. Pellentesque cursus luctus mauris.
\lipsum[3-6]
\end{document}