I have a document with multiple \maketitle
tags. I would like macros that will allow me to redefine the title with a single command. While the code below produces the output I want,
\documentclass{article}
\usepackage{titling}
\begin{document}
\makeatletter
\def\maketitle{%
\par\textbf{\@title}%
\par{\@author}%
\par}
\makeatother
\title{First title}
\maketitle
\makeatletter
\def\maketitle{%
\par\textit{\@title}%
\par{\@author}%
\par}
\makeatother
\title{Second title}
\maketitle
\end{document}
I really need to have macros that encapsulate the redefining of \maketitle
. I would like something like this to work:
\documentclass{article}
\usepackage{titling}
\newcommand{\mytitleOne}{\makeatletter
\def\maketitle{%
\par\textbf{\@title}%
\par{\@author}%
\par}
\makeatother}
\newcommand{\mytitleTwo}{\makeatletter
\def\maketitle{%
\par\textit{\@title}%
\par{\@author}%
\par}
\makeatother}
\begin{document}
\mytitleOne
\title{First title}
\maketitle
\mytitleTwo
\title{Second title}
\maketitle
\end{document}