0

I need to set up a landscape layout (preferably an environment) for one page in conjuncture with an image scaled to the page's width, and there must be a chapter heading always sitting on the same place. Problem is: The chapter heading can't stay put; it either goes off to the next page or its starting position isn't consistent (it has to).

Another small issue: Maybe it's because of the landscape environment, but the image doesn't scale properly (sometimes). Hence why I tried minipages (but the results aren't very consistent...)

\documentclass{memoir}
\usepackage{geometry}
\usepackage{xcolor}
\usepackage{pagecolor}
\usepackage{pdflscape}

\usepackage{graphicx}
\usepackage{float}
\begin{document}
\newpagecolor{black}
\thispagestyle{empty}
\newgeometry{left=0cm,right=0cm,bottom=0cm,top=0cm}
\begin{landscape}
    \begin{figure}
    \centering
        \begin{minipage}{1\paperheight}
        \includegraphics[keepaspectratio,width=1\textwidth,height=\textheight]{example-image}
        \caption{caption here}
        \end{minipage}
        \begin{minipage}{1\textheight}
        \color{white}\chapter{chapter here}
        \end{minipage}
    \end{figure}
\end{landscape}
\restoregeometry

\end{document}

Here is what the code looks like: enter image description here

If I remove minipage it would become like this: enter image description here

What I want is this (intended end result): enter image description here

EDIT:

I tried using Tikzpicture's positioning feature Positioning relative to page in TikZ to stack a text node but since it is also considered to be a float it still got back down to the next page, sigh.

My next bet is trying to overlay the heading text Tikzpicture's by overlaying upon the whole page (Tikz: overlay png or pdf image over another pdf figure), not sure if it'll work though.

8
  • your example just makes ! Undefined control sequence. l.21 \chapter Aug 8, 2017 at 20:38
  • landscape always forces a page break, you probably just want \rotatebox{90}{\includegraphics{...}} also the minipage is doing nothing useful, just making the content too big for the page. Aug 8, 2017 at 20:40
  • Need to use landscape as the page dimensions need to be modified.
    – Xyd
    Aug 8, 2017 at 21:14
  • it's getting the undefined control sequence log as it doesn't accept the heading(\chapter{}) getting put there. which is why i asked the question in the first place... (also fixed the code)
    – Xyd
    Aug 8, 2017 at 21:17
  • I tried to remove the minipage environment but then the image no longer fits paperwidth, which is not what I want.
    – Xyd
    Aug 8, 2017 at 21:21

2 Answers 2

1

To avoid the "gross hack" you can redefine the memoir class hook \clearforchapter. By default this just clears the page at the start of \chapter, but it can do anything, for example include the graphic.

I also used the memoir \legend command which can put a pseudo-caption anywhere in the document (though it won't appear in any "contents" section like "list of figures" unless you explicitly add a contents line).

\begin{document}
\newpagecolor{black}
\thispagestyle{empty}
\newgeometry{left=0cm,right=0cm,bottom=0cm,top=0cm}
\begin{landscape}
  \renewcommand{\clearforchapter}{%
    \openany % or \openleft or \openright
    \centering
    \includegraphics[width=\linewidth,
    height=.9\textheight % just needed here, as example-image fills the whole page
    ]{example-image}
    \color{white}
    \legend{CAPTION HERE}
    \vspace{-0.3\textheight} % adjust as required to overlap the chapter with the image
  }
\chapter{chapter here}
\end{landscape}
\restoregeometry

\newpagecolor{white}
\chapter{Another chapter here}

\end{document}
2
  • +1 although I expect you cheated by having read the memoir manual at some point:-) (I suspected there were some memoir facilities for that but it's getting late here:-) Aug 8, 2017 at 23:18
  • Well, I use memoir for almost everything I do in LaTeX, so I knew about that hook already :-)
    – alephzero
    Aug 8, 2017 at 23:26
0

If I understand correctly you want something like

enter image description here

You certainly never want a chapter heading inside a float, so I removed that, I also removed the minipage around the image which wasn't doing much. I left one around the chapter heading, just to stop it stating a new page (which is a gross hack but still...)

\documentclass{memoir}
\usepackage{geometry}
\usepackage{xcolor}
\usepackage{pagecolor}
\usepackage{pdflscape}
\usepackage{capt-of}
\usepackage{graphicx}
\usepackage{float}
\begin{document}
\newpagecolor{black}
\thispagestyle{empty}
\newgeometry{left=0cm,right=0cm,bottom=0cm,top=0cm}
\begin{landscape}
    \centering
        \includegraphics[width=\linewidth,
  height=.7\textwidth % just needed here as example-image is too tall for the heading
]{example-image}

 \begin{minipage}{\linewidth}% just to stop \chapter starting a page
 \color{white}
 \captionof{figure}{caption here}
\chapter{chapter here}
\end{minipage}
\end{landscape}
\restoregeometry

\end{document}
4
  • Hm, I wanted to keep keepaspectratio on... but you removed it which solved the solution, but I really need that option after all... I got a better hang of the problem now. It's when I try to apply keepaspectratio on that the problem starts kicking in since the image got too big and left not enough space for the heading. Problem is I need all three: fitting the heading to the bottom to the page, setting the image's width to paperwidth and keepaspectratio on. Since it is a code that will be used more than once I need to make sure that it can be used for images of different dimensions.
    – Xyd
    Aug 8, 2017 at 23:09
  • @Xyd if you want the image full width as you showed you should use width= and no height= then keepaspectratio is not needed. But your real image is presumably wider and not tall so you have space for the heading, example-image is almost the same aspect ratio as the page so if you stretch it full width it is also full height so you can not add the caption or chapter heading. so the height= here is just simulating a different shape image. Aug 8, 2017 at 23:11
  • 1
    @Xyd saying you need to make the image full width and keep aspect ratio and have space for (anything) whatever the dimension of the original image is like saying you need 1+2=5 it is a mathematical impossibility. Aug 8, 2017 at 23:14
  • @Xyd I posted my answer while you were changing the question! I've now modified my answer.
    – alephzero
    Aug 8, 2017 at 23:23

You must log in to answer this question.

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