TransWikia.com

Changing margins for only 1 page destroys format

TeX - LaTeX Asked by Kong on December 13, 2020

I have a page that has too many pictures so I change the margin settings

newgeometry{left=3.5cm,right=3.5cm,bottom=0.1cm, top=0.1cm}
% insert image here
resetgeometry

The problem is, when I do that, the text gets split to a different page. Like in the example below (blurred) there is a lot of white space remaining in the page. Latex would automatically put more text there to fill it up but because I used the geometry function it does not work anymore. How can i fix this ?

Basically, how can I have a large image that fit in 1 page using the margin settings and still have latex functioning properly ?

begin{figure}
captionsetup[subfigure]{labelformat=empty}
    setlengthtabcolsep{0pt}
begin{tabularx}{linewidth}{*{20}{>{centeringarraybackslashfootnotesize $}X<{$}}}
x_1 & x_2 & x_3 & x_4 & x_5 & x_6 & x_7 & x_8 & x_9 & x_{10} & x_{11} & x_{12} & x_{13} & x_{14} & x_{15} & x_{16} & x_{17} & x_{18} & x_{19} & x_{20}  [-7ex]
multicolumn{20}{c}{subfloat[Ground Truth]{{includegraphics[width=textwidth]{results/ms.png}}}} 
hat{x_2} & hat{x_3} & hat{x_4} & hat{x_5} & hat{x_6} & hat{x_7} & hat{x_8} & hat{x_9} & hat{x_{10}} & hat{x_{11}} & hat{x_{12}} & hat{x_{13}} & hat{x_{14}} & hat{x_{15}} & hat{x_{16}} & hat{x_{17}} & hat{x_{18}} & hat{x_{19}} & hat{x_{20}} & hat{x_{21}}  [-7ex]
multicolumn{20}{c}{subfloat[Recurrent Neural Network]{{includegraphics[width=textwidth]{results/ms-rnn.png}}}} 
hat{x_2} & hat{x_3} & hat{x_4} & hat{x_5} & hat{x_6} & hat{x_7} & hat{x_8} & hat{x_9} & hat{x_{10}} & hat{x_{11}} & hat{x_{12}} & hat{x_{13}} & hat{x_{14}} & hat{x_{15}} & hat{x_{16}} & hat{x_{17}} & hat{x_{18}} & hat{x_{19}} & hat{x_{20}} & hat{x_{21}}  [-7ex]
multicolumn{20}{c}{subfloat[Variational Recurrent Neural Network]{{includegraphics[width=textwidth]{results/ms-vrnn.png}}}}  [-7ex]
noindentrule{15cm}{0.4pt} 
x_1 & x_2 & x_3 & x_4 & x_5 & x_6 & x_7 & x_8 & x_9 & x_{10} & x_{11} & x_{12} & x_{13} & x_{14} & x_{15} & x_{16} & x_{17} & x_{18} & x_{19} & x_{20}  [-7ex]
multicolumn{20}{c}{subfloat[Ground Truth]{{includegraphics[width=textwidth]{results/mm.png}}}} 
hat{x_2} & hat{x_3} & hat{x_4} & hat{x_5} & hat{x_6} & hat{x_7} & hat{x_8} & hat{x_9} & hat{x_{10}} & hat{x_{11}} & hat{x_{12}} & hat{x_{13}} & hat{x_{14}} & hat{x_{15}} & hat{x_{16}} & hat{x_{17}} & hat{x_{18}} & hat{x_{19}} & hat{x_{20}} & hat{x_{21}}  [-7ex]
multicolumn{20}{c}{subfloat[Recurrent Neural Network]{{includegraphics[width=textwidth]{results/mm-rnn.png}}}} 
hat{x_2} & hat{x_3} & hat{x_4} & hat{x_5} & hat{x_6} & hat{x_7} & hat{x_8} & hat{x_9} & hat{x_{10}} & hat{x_{11}} & hat{x_{12}} & hat{x_{13}} & hat{x_{14}} & hat{x_{15}} & hat{x_{16}} & hat{x_{17}} & hat{x_{18}} & hat{x_{19}} & hat{x_{20}} & hat{x_{21}}  [-7ex]
multicolumn{20}{c}{subfloat[Variational Recurrent Neural Network]{{includegraphics[width=textwidth]{results/mm-vrnn.png}}}}  [-7ex]
noindentrule{15cm}{0.4pt} 
end{tabularx}
caption{}
label{fig:ood-ms}
end{figure}

enter image description here
enter image description here

One Answer

This shows an example of an easy approach using smash. I use vbox to textheight to tell LaTeX that this figure will take a complete page so it doesn't place any other figures on this float page. In this approach you'd most likely have to adapt some lengths to make it fit your needs.

documentclass[]{article}

usepackage{blindtext,graphicx}
usepackage{geometry}
usepackage{floatpag}

begin{document}
%your approach:
blindtext
newgeometry{left=3.5cm,right=3.5cm,bottom=0.1cm, top=0.1cm}
begin{figure}
  includegraphics[width=textwidth,height=textheight]{example-image}
end{figure}
restoregeometry
blindtext
clearpage

%different approach:
blindtext
begin{figure}[p]
  thisfloatpagestyle{empty}%
  centering
  vbox to textheight{%
    vspace*{1.12textheight}%
    smash{makebox[textwidth]{%
      includegraphics[width=1.1textwidth,height=0.85paperheight]{example-image}
    }}%
    caption{foo bar}
  }%
end{figure}

blindtext

end{document}

Answered by Skillmon on December 13, 2020

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