TransWikia.com

When including a .PDF, caption is not below .PDF when using /eject page-height change

TeX - LaTeX Asked on January 20, 2021

Consider the following MWE (you will need a test.pdf image to compile this).

This should compile using standard LaTeX. The problem is

  • the caption is not below the .PDF image at all. It is on the next page.
  • there is an extra page inserted before the image .PDF.

    documentclass[]{memoir}
    
    usepackage{graphicx}
    usepackage{caption}
    
    usepackage{epstopdf}
    epstopdfDeclareGraphicsRule{.pdf}{png}{.png}{convert #1 OutputFile}
    AppendGraphicsExtensions{.pdf}
    
    begin{document}
    
    eject pdfpagewidth=8.27in pdfpageheight=21.5in
    
    section{Vision}
    
    begin{center}
    includegraphics[width=0.9textwidth]{test.pdf}
    captionof{figure}{Caption.}
    end{center}
    
    eject pdfpagewidth=8.27in pdfpageheight=11.69in
    
    end{document}
    

    Please note that none of this weird behavior happens when using the following code (.PDF is here replaced by a dummy non-.PDF image):

    documentclass[]{memoir}
    
    usepackage{graphicx}
    usepackage{duckuments} 
    usepackage{caption}
    
    begin{document}
    
    eject pdfpagewidth=8.27in pdfpageheight=21.5in
    
    section{Vision}
    
    begin{center}
    includegraphics[width=3cm]{example-image-duck}
    captionof{figure}{Caption.}
    end{center}
    
    eject pdfpagewidth=8.27in pdfpageheight=11.69in
    
    end{document}
    

One Answer

Thanks to Ulrike Fischer:

Wrapping it inside

begin{minipage}[t]{1textwidth}

will fix it.

Update after David's comment:

noindentbegin{minipage}{textwidth}

Answered by O0123 on January 20, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP