![从特定页面开始触发新几何图形](https://linux22.com/image/403441/%E4%BB%8E%E7%89%B9%E5%AE%9A%E9%A1%B5%E9%9D%A2%E5%BC%80%E5%A7%8B%E8%A7%A6%E5%8F%91%E6%96%B0%E5%87%A0%E4%BD%95%E5%9B%BE%E5%BD%A2.png)
我正在尝试在不依赖预定义类的情况下制作字母(为什么不呢?)。在下面的示例中,我想将第 1 页后的顶部边距更改为 0.75 英寸。
\documentclass[12pt]{report}
\usepackage[english]{babel}
\usepackage{datetime}
\usepackage[
% https://css.paperplaza.net/conferences/support/page.php
letterpaper,
top=1in, %first
% top-0.75in,%rest
left=0.75in,
right=0.75in,
bottom=0.75in,
showframe%only for testing
]{geometry}
\usepackage{lipsum}
\usepackage{titleps}
\usepackage{xparse}
\NewDocumentCommand{\myheading}
{O{}+mO{\newline}}
{\noindent #1#2#3}
\newpagestyle{rest}
[\small\sffamily]
{
\sethead{}{xyz}{}
\setfoot{}{\thepage}{}
% this has no effect
% \newgeometry{%
% letterpaper,
% % top=1in, %first
% top=0.75in,%rest
% left=0.75in,
% right=0.75in,
% bottom=0.75in
% }
}
\begin{document}
\thispagestyle{empty}
\pagestyle{rest}
\myheading{John Smith\\
1000 Main Street\\
Washington, DC}
\myheading[\shortdate]{\today}
\myheading{John Doe\\
1001 Main Street\\
Washington, DC}
\myheading[Re:~]{xyz}
\myheading{Sir,}
\lipsum[1-5]\\
\myheading{Sincerely}[,]
\vspace*{3em}
\myheading{John Smith.}
\myheading[Encl.:~]{Specimen xyz}
\myheading[PS:~]{One last thing\dots}
\end{document}
答案1
根据文档主体的要求设置页边距。对于您的情况,页边距应为
\usepackage[
% https://css.paperplaza.net/conferences/support/page.php
letterpaper,
margin = 0.75in
]{geometry}
\vspace*{0.25in}
然后,在第一页(或,在序言中)发布\AtBeginDocument{\vspace*{0.25in}}
,将第一页上的文本块减少 1/4 英寸(或,将顶部边距增加 1/4 英寸)。
以下是显示用例的模板:
\documentclass{article}
\usepackage[
margin = 0.75in,
showframe% Just for this example
]{geometry}
\usepackage{lipsum}
\AtBeginDocument{\vspace*{0.25in}}
\begin{document}
\sloppy% Just for this example
\lipsum[1-15]
\end{document}
您的文档的所有页面的边距都将相同,即使第一页有变化(通过showframe
向您添加选项来可视化)geometry
设置)。
答案2
flowfram 包在这么简单的事情上有点浪费。但它确实可以改变特定页面的几何形状。
\documentclass[12pt]{report}
\usepackage[english]{babel}
\usepackage{datetime}
\usepackage[
% https://css.paperplaza.net/conferences/support/page.php
letterpaper,
top=0.75in,% use larger
left=0.75in,
right=0.75in,
bottom=0.75in,
showframe%only for testing
]{geometry}
\usepackage{lipsum}
\usepackage{titleps}
\usepackage{xparse}
\usepackage{flowfram}
\newflowframe[1]{\textwidth}{\dimexpr \textheight-.25in}{0pt}{0pt}
\NewDocumentCommand{\myheading}
{O{}+mO{\newline}}
{\noindent #1#2#3}
\newpagestyle{rest}
[\small\sffamily]
{
\sethead{}{xyz}{}
\setfoot{}{\thepage}{}
% this has no effect
% \newgeometry{%
% letterpaper,
% % top=1in, %first
% top=0.75in,%rest
% left=0.75in,
% right=0.75in,
% bottom=0.75in
% }
}
\begin{document}
\thispagestyle{empty}
\pagestyle{rest}
\myheading{John Smith\\
1000 Main Street\\
Washington, DC}
\myheading[\shortdate]{\today}
\myheading{John Doe\\
1001 Main Street\\
Washington, DC}
\myheading[Re:~]{xyz}
\myheading{Sir,}
\lipsum[1-5]\\
\myheading{Sincerely}[,]
\vspace*{3em}
\myheading{John Smith.}
\myheading[Encl.:~]{Specimen xyz}
\myheading[PS:~]{One last thing\dots}
\end{document}