Add a picture before book title
The issue here is, that you try to add a picture befor the \begin{document}
. Your commands only set the content of \title
but don't typeset it. You might use the following:
\documentclass[a4paper, 11pt, oneside]{book}
\usepackage{graphicx}
%opening
\title{abc}
\author{abc}
\begin{document}
\vbox{
\centering
\includegraphics[width=0.2\textwidth]{example-image}
\maketitle %this typesets the contents of \title, \author and \date
}
\clearpage
\end{document}
Please note that I put the \maketitle
and the \includegraphics
in a \vbox{}
to prevent it from pagebreaking in between the picture and the title.
EDIT: I've adapted the code to not use \maketitle
in a titlepage
-environment.
The titlepage
environment is not meant for use with \maketitle
. However, the titling
package offers a half-way house which allows you to use \maketitle
within the titlepage
environment, along with any other commands you wish.
At least, so it says on the tin. In reality, you can't put other things before \maketitle
.
However, the package also gives us a series of hooks and we can use one of those to include the image. For example,
\renewcommand\maketitlehooka{%
\begin{center}
\fbox{\includegraphics[width=0.5\textwidth]{cath-gadael-chartref}}
\end{center}%
}
So we could then say
\maketitle
to produce the title page.
\documentclass[a4paper, 11pt, oneside]{book}
\usepackage{graphicx}
\usepackage{titling}
\title{abc}
\author{abc}
\renewcommand\maketitlehooka{%
\begin{center}
\fbox{\includegraphics[width=0.5\textwidth]{cath-gadael-chartref}}
\end{center}%
}
\begin{document}
\maketitle
\end{document}
If you wished to add material after the date, or between the various elements of the standard title, you could define the appropriate hooks (b
, c
or d
) or, for material afterwards, nest the \maketitle
inside a titlingpage
environment.
\documentclass[a4paper, 11pt, oneside]{memoir}
\usepackage{lipsum, graphicx}
\author{LaTeXFan}
\title{\protect \includegraphics{example-image-a.png}\\[1cm] A very nice image}
\date{\today}
\begin{document}
\frontmatter
\maketitle
\mainmatter
\lipsum[4]
\end{document}