11

I'm writing a report with two parts using the article class.

\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}

I need two parts titled say, \part{Heisenberg Picture} and \part{Schroedinger Picture}. These parts correspond to Title 1,Supervisor X and Title 2,Supervisor Y respectively. How can I redefine the \maketitle command to do this? (If it's too complicated, is there an easier method?)

1

2 Answers 2

10

The titling package does exactly what you require. I've also cleaned up your code to put the formatting parts into the \pretitle etc. commands leaving the contents of \title and author free of formatting.

\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}
4
\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}
1
  • This is the same as my answer, but preserving the non-ideal practice of putting formatting into the title/author commands themselves.
    – Alan Munn
    Commented Jul 23, 2014 at 4:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .