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}  
Pwdr
  • 857
  • 2
  • 8
  • 20

2 Answers2

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.

egreg
  • 1,121,712
  • 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 07 '14 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 '14 at 13:21
  • @Pwdr Maybe you want only the image flush left? – egreg Nov 19 '14 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 '14 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 '14 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