仅文档标题的边距不同

仅文档标题的边距不同

我正在尝试遵循特定会议的格式要求,该要求规定文档标题必须有 1.5 英寸的左右边距,而论文的其余部分必须有 1 英寸的边距。

我已经尝试过这里显示的解决方案:标题页的边距不同

但是,我需要标题后面的文本与标题位于同一页。如何让文档标题和文档文本在同一页上显示时获得不同的边距?

\documentclass[12pt]{article}

\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[top=1in,bottom=1in,right=1in,left=1in]{geometry}
\usepackage{times}
\usepackage{lipsum}

\newgeometry{top=1in,bottom=1in,right=1.5in,left=1.5in}
\title{A long title that wraps onto a second line to show where the margin is}
\author{\normalsize Author A. Name\\\normalsize [email protected]\\\normalsize Awesome Department\\\normalsize Big Deal University}
\date{}

\begin{document}

\maketitle

\restoregeometry

\section{Intro}
\lipsum[1-5]

\end{document}

答案1

您可以使用\newgeometry\restoregeometrygeometry包;一个小例子:

\documentclass{article}
\usepackage[margin=1in,showframe]{geometry}
\usepackage{lipsum}

\begin{document}

\newgeometry{margin=1.5in}
\lipsum[1-5]% your title information here
\restoregeometry
\lipsum[1-5]% your document here

\end{document}

在此处输入图片描述

上述答案假设标题信息应该出现在其自己的页面上;在对原始问题进行编辑后,很明显事实并非如此;标题信息是使用 \maketitle 生成的,文档文本应立即开始。

在这种情况下,可以使用包adjustwidth中的环境changepage;修补\@maketitle可以完成这项工作:

\documentclass{article}
\usepackage[margin=1in,showframe]{geometry}
\usepackage{lipsum}
\usepackage{etoolbox}
\usepackage{changepage}

\title{A long title that wraps onto a second line to show where the margin is; some more text}
\author{\normalsize Author A. Name\\\normalsize [email protected]\\\normalsize Awesome Department\\\normalsize Big Deal University}
\date{}

\makeatletter
\patchcmd{\@maketitle}{\begin{center}}{\begin{adjustwidth}{-0.5in}{-0.5in}\begin{center}}{}{}
\patchcmd{\@maketitle}{\end{center}}{\end{center}\end{adjustwidth}}{}{}
\makeatother

\begin{document}


\maketitle
\lipsum[1-5]

\end{document}

在此处输入图片描述

showframe选项仅用于提供视觉指导。

相关内容