2

By default, it seems that* \maketitle processes first the title, then the author, then the date. So what do I do if I want to put the author and date on the top of the page (on opposite sides of the same line), and the title below them?

*: This is what I understand from the documentation of the titling package. I may have misunderstood.

Currently, I accomplish the desired effect with:

\newcommand{\addtitle}[4]{ 
John Smith \hfill \formatdate{#2}{#1}{#3} \\[0.8cm] 

\textbf{\LARGE #4} % text of my title goes here
}

I use this command to add the title for a series of homework assignments, which all have the same author (me), but different dates and titles.

4
  • 1
    In an attempt to help you, could you help us by providing a minimal working example (MWE)?
    – Werner
    Commented Jan 20, 2014 at 19:00
  • Perhaps you can give a concrete (visual) example of what you are after (besides the requested MWE). Commented Jan 20, 2014 at 19:14
  • @ThorstenDonig Is the example source sufficient to illustrate my goal?
    – Superbest
    Commented Jan 20, 2014 at 19:16
  • Please follow the link in Werner's comment. Commented Jan 20, 2014 at 20:36

1 Answer 1

5

In your document, you can redefine the internal command \@maketitle, in order to swap the the elements; for example, you can use

\makeatletter
\def\@maketitle{%
    \newpage
    \null
    \vskip 2em%
    \vspace*{\droptitle}
    \maketitlehooka
    {\@bspreauthor \@author \@bspostauthor}
    \maketitlehookb
    {\@bspredate \@date \@bspostdate}
    \maketitlehookc
    {\@bspretitle \@title \@bsposttitle}
    \maketitlehookd
    \par
    \vskip 1.5em}
\makeatother

A complete working example:

\documentclass{article}
\usepackage{titling}
\usepackage{lipsum}% just to generate text for the example

\makeatletter
\def\@maketitle{%
    \newpage
    \null
    \vskip 2em%
    \vspace*{\droptitle}
    \maketitlehooka
    {\@bspreauthor \@author \@bspostauthor}
    \maketitlehookb
    {\@bspredate \@date \@bspostdate}
    \maketitlehookc
    {\@bspretitle \@title \@bsposttitle}
    \maketitlehookd
    \par
    \vskip 1.5em}
\makeatother

\pretitle{\par\noindent\bfseries\LARGE}
\posttitle{\par\vskip1em}
\preauthor{\par\noindent\large}
\postauthor{\hfill}
\predate{\large}
\postdate{\par\vskip0.8cm}

\author{The Author}
\title{Some interesting title}
\date{\today}

\begin{document}
\maketitle
\lipsum[1]
\end{document}

enter image description here

Feel free to adjust the settings according to your needs.

You must log in to answer this question.

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