I am trying to put an image into the same page as the \part
header, something like a sub-cover.
I tried something along the lines:
\documentclass[10pt,ebook,italian,onecolumn,oneside,titlepage,extrafontsizes]{memoir}
\usepackage[italian]{babel}
\usepackage{graphicx}
...
\title{Book Title}
\begin{document}
\frontmatter
\maketitle
\mainmatter
\chapterstyle{companion}
\tableofcontents
\part{Part I Title}
\includegraphics[width=\linewidth]{PartIcover.jpg}
\chapter{First Chapter TItle}
This does not work well for two reasons:
- image is not right after "Part I Title", but on next page.
- in image page I get a spurious "INDEX #" header (which is not present in
\part
page, of course)
Is it possible to achieve the desired effect? ("Part I Title" on top of page and image below it).
If so: how?
Note: I am almost a newbie to LaTeX, please be lenient.
Update: following advice in comments I made the following; working, but fragile to say the least:
\documentclass[...]{memoir}
\usepackage[italian]{babel}
\usepackage{graphicx}
...
\def\@partimage{}
\newcommand{\partimage}[2][]{\gdef\@partimage{\includegraphics[#1]{#2}}}
\renewcommand{\printparttitle}[1]{\parttitlefont #1\vfil\@partimage\vfil\gdef\@partimage{}}
\makeatother
...
\title{Book Title}
\begin{document}
\frontmatter
\maketitle
\mainmatter
\chapterstyle{companion}
\tableofcontents
\partimage[width=210pt]{PartIcover.jpg}
\part{Part I Title}
\includegraphics[width=\linewidth]{PartIcover.jpg}
\chapter{First Chapter Title}
This is very fragile because I need to hand-compute remaining height after \part
title.
I saw this answer, but I'm unsure how to use it in the above code.
[width=\linewidth]
. What is the right spell to say "scale to fit in page"? (I currently put[width=210pt]
, but that is very fragile).height=\textheight
. Try e.g.\documentclass{article} \usepackage{graphicx} \begin{document} \includegraphics[angle=90,height=0.9\textheight]{example-image-duck} \end{document}
.\textheight
is the full height of text area, while I need "remaining height in current page". Any hint where I should look for that kind of data? I have seen tex.stackexchange.com/a/373312/167976 but I'm unsure how to use it in my case. I will update question.