0

I want to format the title and author section of my report like the authors have done in the image below.

enter image description here

I have tried putting two horizontal rules above and below the title, but, if I do this, the title is not vertically centered between the rules. I don't know how to go about left aligning the author details.

\title{\bf \Large \rule{\textwidth}{2pt} Here is my title! \rule{\textwidth}{2pt}}
\author{Smithy \\ smithy@outlook.com}
\date{} 
\documentclass{article}
\begin{document}
\maketitle
\end{document}

If anyone could help me with this, I'd be very grateful!

1

The titling package supplies with tools for customising the \maketitle command:

\documentclass{article}
\usepackage{titling}
\pretitle{\noindent\rule{\textwidth}{2pt}\begin{center}\Large\bfseries}
\posttitle{\end{center}\noindent\rule{\textwidth}{2pt}}
\preauthor{\begin{center}\large}
\postauthor{\end{center}}

\title{ Here is my title!}
\author{Smithy \\ smithy@outlook.com}
\date{}

\begin{document}

\maketitle

\end{document} 

enter image description here

  • Thank you very much. How would I go about left-aligning the author details? – Henry Mar 29 at 12:38
  • The whole thing, or just the e-mail address? – Bernard Mar 29 at 12:42
  • The name on the left and the email on the right, as in the image I uploaded. Thanks! – Henry Mar 29 at 12:43
  • Also, is the title vertically centered using this method automatically, or will I have to use the \vspace command? – Henry Mar 29 at 12:45
  • It is vertically centred, as far as I can say, but there's always the problem of letters with ascenders or descenders which may produce a visual effect. If need, you may insert some \vspace in pretitle or posttitle. If you look at the documentation, you have some more tools (\maketitlehooka, \maketitlehookb, &c.) – Bernard Mar 29 at 12:54
1
\documentclass{article}
\title{\hrule\vspace{1ex}{\bfseries\Large Here is my title!}\vspace{1ex}\hrule}
\author{Smithy \\ smithy@outlook.com}
\date{} 
\begin{document}
\maketitle
\end{document}

enter image description here

Some notes:

  • In most cases, don't put anything before \documentclass.
  • Don't use \bf!
  • This is dirty. IMHO you should only have \title{Here is my title!} and redefine \maketitle.

So I post a proposal which I think is better.

\documentclass{article}
\makeatletter
\renewcommand\@maketitle{%
\centering\hrule\vspace{2ex}{\bfseries\Large\@title}\vspace{2ex}\hrule\par
\begin{center}
    \large\@author
\end{center}
}
\makeatother
\title{Here is my title!}
\author{Smithy \\ smithy@outlook.com}
\date{} 
\begin{document}
\maketitle
\end{document}

enter image description here


If you want to have the arrangement of the name and the email as desired, you can use \hfill instead of \\:

\documentclass{article}
\makeatletter
\renewcommand\@maketitle{%
\centering\hrule\vspace{2ex}{\bfseries\Large\@title}\vspace{2ex}\hrule\par
\begin{center}
    \large\@author
\end{center}
}
\makeatother
\title{Here is my title!}
\author{Smithy \hfill smithy@outlook.com}
\date{} 
\begin{document}
\maketitle
\end{document}

enter image description here

  • Thank you so much! How would I left align the author name, and right align the author email as in the image in my post? – Henry Mar 29 at 12:37
  • @Henry You can use \hfill. – user156344 Mar 29 at 12:38
  • Is there any chance you could update your answer with this? I've never used the \hfill command. – Henry Mar 29 at 12:40
  • 1
    @Henry I just do it. – user156344 Mar 29 at 12:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.