26

I would like to put a logo above my title, but I would also like to keep the title/author/date on the first page of text.

All of the solutions I've found so far relate to the title page package, which instigates a separate page.

Inserting a figure turns the first page into a 'regular' page, with header and footer, followed by the title on the next page.

I'm using article class.

Any suggestions?

Code below is slightly modified from XeLaTeX template to provide MWE.

\documentclass[12pt]{article}
\usepackage{geometry} 
\geometry{a4paper}              

\usepackage{graphicx}
\usepackage{amssymb}


\usepackage{fontspec,xltxtra,xunicode}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont[Mapping=tex-text]{Hoefler Text}
\setsansfont[Scale=MatchLowercase,Mapping=tex-text]{Gill Sans}
\setmonofont[Scale=MatchLowercase]{Andale Mono}

\title{Brief Article}
\author{The Author}
\date{}     

\begin{document}
\maketitle

Content of document, starting straight away, same page...
I would like the image to have appeared at the top, above Brief Article.
    But where to put the command?


\end{document}  

2 Answers 2

27

The titling package is what you're looking for:

\documentclass[12pt]{article}
\usepackage{geometry} 
\geometry{a4paper}              

\usepackage[demo]{graphicx} % the demo option is just for the example
\usepackage{amssymb}
\usepackage{titling}

\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{Hoefler Text}
\setsansfont[Scale=MatchLowercase,Ligatures=TeX]{Gill Sans}
\setmonofont[Scale=MatchLowercase]{Andale Mono}

\pretitle{%
  \begin{center}
  \LARGE
  \includegraphics[width=6cm,height=2cm]{logo}\\[\bigskipamount]
}
\posttitle{\end{center}}

\begin{document}

\title{Brief Article}
\author{The Author}
\date{}     

\maketitle

Content of document, starting straight away, same page...
I would like the image to have appeared at the top, above Brief Article.
    But where to put the command?


\end{document}  

enter image description here

Note that you're using a quite old syntax for loading fonts.

5
  • This is the one, easy as pie. Especially as I am actually using the titling package in the report. I noticed you have changed \setmainfont for \setromanfont etc.
    – Pwdr
    Feb 7, 2014 at 13:49
  • I've found a problem with this: changing the justification from centre to raggedleft makes the title itself raggedright.
    – Pwdr
    Nov 19, 2014 at 13:21
  • @Pwdr Maybe you want only the image flush left?
    – egreg
    Nov 19, 2014 at 13:30
  • Flush right, but even still, the title moves with it in this example - because the command to \end{flushright} is in \posttitle{}. Moving it to the last line of \pretitle makes the title itself go to flushleft.
    – Pwdr
    Nov 19, 2014 at 13:46
  • 2
    @Pwdr Don't add a flushleft environment, but just \hfill in front of \includegraphics, which will override the centering just for that line.
    – egreg
    Nov 19, 2014 at 13:49
12

Why don't you simply add the picture in to the title like

\title[Brief Article]{\includegraphics[scale=0.2]{example-image-a}\\ Brief Article}

As noted by Barbara, since an article title becomes a running head, it is better to use the optional argument with suitable text for use as header.

Full code:

\documentclass[12pt]{article}
\usepackage{geometry}
\geometry{a4paper}

\usepackage{graphicx}
\usepackage{amssymb}


\usepackage{fontspec,xltxtra,xunicode}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont[Mapping=tex-text]{Hoefler Text}
\setsansfont[Scale=MatchLowercase,Mapping=tex-text]{Gill Sans}
\setmonofont[Scale=MatchLowercase]{Andale Mono}

\title[Brief Article]{\includegraphics[scale=0.2]{example-image-a}\\ Brief Article}
\author{The Author}
\date{}

\begin{document}
\maketitle

Content of document, starting straight away, same page...
I would like the image to have appeared at the top, above Brief Article.
    But where to put the command?


\end{document} 

enter image description here

4
  • 1
    since an article title becomes a running head, it would be a good idea to use the optional argument for \title to provide suitable text. Feb 7, 2014 at 14:44
  • @barbarabeeton Fair point :) Edited with thanks.
    – user11232
    Feb 7, 2014 at 14:48
  • I could even put a complete tikzpicture environment in there. Ugly as hell but worked nicely!
    – Suuuehgi
    Sep 28, 2021 at 16:13
  • 2
    That doesn't work. It gives you LaTeX Error: Missing \begin{document}.
    – pmaen
    Oct 2, 2021 at 16:38

You must log in to answer this question.

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