有了以下代码,如何插入另一页,该页面的边距参数与代码中显示的边距参数不同?基本上,第一页是具有不同边距的封面页(顶部=20、底部=20、右侧=20、左侧=20),这是我想集成到此代码中的页面。谢谢!
\documentclass[12pt,oneside,a4paper]{article}
\usepackage[
left=40mm,
top=30mm,
right=20mm,
bottom=20mm,
headsep=12.5mm,
headheight=14.5pt, %%% 3mm is too small
heightrounded
]{geometry}
\usepackage{fancyhdr,xpatch}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0.0pt}
\fancyhf{}
\fancyhead[R]{Title of topic --- \thepage}
\makeatletter
\let\ORI@section\section
\renewcommand{\section}{\@ifstar\s@section\ORI@section}
\newcommand{\s@section}[1]{%
\ORI@section*{#1}
\csname phantomsection\endcsname % for hyperref
\addcontentsline{toc}{section}{#1}
}
\xpatchcmd{\tableofcontents}{\section}{\ORI@section}{}{} % toc not in toc
\makeatother
\begin{document}
\pagenumbering{roman}
\tableofcontents
\clearpage
\listoffigures
\clearpage
\listoftables
\clearpage
\section*{Section A}
\clearpage
\pagenumbering{arabic}
\section{Section B}
\end{document}
答案1
使用\newgeometry
宏是解决问题的办法。更改页面就像向 MWE 添加一样简单
\newgeometry{top=20mm, bottom=20mm, right=20mm, left=20mm}
A Title Page
\restoregeometry%
\clearpage
这给出了新的完整 MWE
\documentclass[12pt,oneside,a4paper]{article}
\usepackage[
left=40mm,
top=30mm,
right=20mm,
bottom=20mm,
headsep=12.5mm,
headheight=14.5pt, %%% 3mm is too small
heightrounded
]{geometry}
\usepackage{fancyhdr,xpatch}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0.0pt}
\fancyhf{}
\fancyhead[R]{Title of topic --- \thepage}
\makeatletter
\let\ORI@section\section
\renewcommand{\section}{\@ifstar\s@section\ORI@section}
\newcommand{\s@section}[1]{%
\ORI@section*{#1}
\csname phantomsection\endcsname % for hyperref
\addcontentsline{toc}{section}{#1}
}
\xpatchcmd{\tableofcontents}{\section}{\ORI@section}{}{} % toc not in toc
\makeatother
\begin{document}
\newgeometry{top=20mm, bottom=20mm, right=20mm, left=20mm}
A Title Page
\restoregeometry%
\clearpage
\pagenumbering{roman}
\tableofcontents
\clearpage
\listoffigures
\clearpage
\listoftables
\clearpage
\section*{Section A}
\clearpage
\pagenumbering{arabic}
\section{Section B}
\end{document}