![文章中有两个“maketitle”](https://linux22.com/image/294868/%E6%96%87%E7%AB%A0%E4%B8%AD%E6%9C%89%E4%B8%A4%E4%B8%AA%E2%80%9Cmaketitle%E2%80%9D.png)
我正在使用该article
课程撰写一份包含两部分的报告。
\documentclass[a4paper,11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{amsmath,amsfonts,amsthm}
\usepackage[pdftex]{graphicx}
\usepackage[top=1in,bottom=1in,left=1in,right=1in]{geometry}
\usepackage{sectsty}
\allsectionsfont{\centering \normalfont\scshape}
\usepackage{fancyhdr}
\title{\huge Title1 \\}
\author{\normalfont \normalsize
Author\\ \normalsize
Supervisors: Prof. X}
\date{}
\begin{document}
\part{Heisenberg Picture}
\maketitle
\section{Section 1}
\clearpage
\part{Schroedinger Picture}
%\maketitle2
\section{Section 1}
\end{document}
我需要两个部分,标题分别为\part{Heisenberg Picture}
和\part{Schroedinger Picture}
。这些部分分别对应于Title 1
、Supervisor X
和Title 2
。Supervisor Y
我该如何重新定义\maketitle
命令来执行此操作?(如果太复杂,有没有更简单的方法?)
答案1
该titling
包完全满足您的要求。我还清理了您的代码,将格式化部分放入了\pretitle
etc. 命令中,保留了内容\title
和author
自由格式。
\documentclass[a4paper,11pt]{article}
\usepackage{titling}
\pretitle{\begin{center}\huge}
\posttitle{\par\end{center}\vspace{\baselineskip}}
\preauthor{\normalfont\normalsize\begin{center}\begin{tabular}[t]{c}}
\postauthor{\end{tabular}\end{center}\vspace{\baselineskip}}
\title{Title 1}
\author{Author\\Supervisors: Prof. X}
\date{}
\begin{document}
\part{Heisenberg Picture}
\maketitle
\section{Section 1}
\clearpage
\part{Schroedinger Picture}
\title{Title 2}
\author{Author\\Supervisors: Prof Y}
\maketitle
\section{Section 1}
\end{document}
答案2
\documentclass[a4paper,11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{amsmath,amsfonts,amsthm}
\usepackage[pdftex]{graphicx}
\usepackage[top=1in,bottom=1in,left=1in,right=1in]{geometry}
\usepackage{sectsty}
\allsectionsfont{\centering \normalfont\scshape}
\usepackage{fancyhdr}
%%%Solution package%%%
\usepackage{titling}
%%%%%%%%%%%%%%%%%%%%%%
\title{\huge Title1 \\}
\author{\normalfont \normalsize
Author\\ \normalsize
Supervisors: Prof. X}
\date{}
\begin{document}
\part{Heisenberg Picture}
\maketitle
\section{Section 1}
\clearpage
\part{Schroedinger Picture}
%still usable due to `titling`
\title{\huge Title2 \\}
\author{\normalfont \normalsize
Author\\ \normalsize
Supervisors: Prof. Y}
\date{}
\maketitle%2
\section{Section 1}
\end{document}