
我正在尝试为文档的第一页设置不同的页边距。由于我不确定第一页的内容,因此\afterpage
已使用该命令来实现所需的效果。但是,我注意到第二页的第一段(第 2 页顶部的红色椭圆)仍然具有第一页的页边距(请查看下面的示例)。
- 有什么方法可以强制第二页的全部内容采用新的边距?
从第二页开始,有没有办法让我得到一个灰色矩形(第 2 页和第 3 页目前仅手工绘制,以演示我想要的内容)覆盖页面的整个宽边距(垂直方向上从边到边,水平方向上从宽边距上的边缘到文本)?
\documentclass[11pt,a4paper,twoside]{article} \usepackage{lipsum,afterpage} \usepackage[left=1.5cm, top=1.5cm, right=3cm, bottom=1.5cm, nohead, nofoot]{geometry} \begin{document} \newgeometry{left=7.5cm, top=1cm, right=1cm, bottom=1cm} \afterpage{\globaldefs=1 \restoregeometry} \lipsum\lipsum\lipsum \end{document}
谢谢。
答案1
找到第二点(边缘灰色条)的解这里。
\documentclass[11pt,a4paper,twoside]{article}
\usepackage{lipsum,afterpage,eso-pic,ifthen}
\usepackage[left=3cm, top=1.5cm, right=1.5cm, bottom=1.5cm, nohead, nofoot]{geometry}
\AddToShipoutPicture{% from package eso-pic: put something to the background
\ifthenelse{\isodd{\thepage}}{
% ODD page: left bar
\AtPageLowerLeft{% start the bar at the left bottom of the page
\color{black!20}\rule{2.8cm}{\LenToUnit\paperheight}%
}%
}%
{%
% EVEN page: right bar
\AtPageLowerLeft{% start the bar at the bottom left of the page
\put(\LenToUnit{\dimexpr\paperwidth-2.8cm},0){% move it to the top right
\color{black!20}\rule{2.8cm}{\LenToUnit\paperheight}%
}%
}%
}%
}
\begin{document}
\newgeometry{left=7.5cm, top=1cm, right=1cm, bottom=1cm}
\afterpage{\globaldefs=1 \restoregeometry}
\lipsum\lipsum\lipsum
\end{document}