TransWikia.com

How to enlarge figures to take maximum available space?

TeX - LaTeX Asked by SHAONI NANDI on December 14, 2020

I am trying to put two figures side by side using minipage. But the figures are shrinking and not using the full page width. How to get figures that use the full page width?

begin{figure}[h]
    begin{minipage}{0.5textwidth}
            includegraphics[width=columnwidth]{P1.jpg}
    end{minipage}
    begin{minipage}{0.5textwidth}
    includegraphics[width=columnwidth]{P2.jpg}
    end{minipage}
end{figure}

2 Answers

There is no need to use minipage.

documentclass{article}
usepackage{graphicx}

usepackage{showframe,lipsum} % just for the example

begin{document}

lipsum[1][1-3]

begin{figure}[htp]

includegraphics[width=0.49textwidth]{example-image-a}hfill
includegraphics[width=0.49textwidth]{example-image-b}

caption{Two side by side figures filling the space, with some separation}

end{figure}

lipsum[1][4-5]
begin{figure}[htp]

includegraphics[width=0.5textwidth]{example-image-a}%
includegraphics[width=0.5textwidth]{example-image-b}

caption{Two side by side figures filling the space, with no separation}

end{figure}

lipsum[1][6-7]

end{document}

enter image description here

Answered by egreg on December 14, 2020

Using max textwidth with minor space between the figures

enter image description here

begin{figure}[h]
    begin{minipage}{0.5textwidth}
        includegraphics[width=textwidth]{image-b}
    end{minipage}
    begin{minipage}{0.5textwidth}
        includegraphics[width=textwidth]{image-a}
    end{minipage}%
end{figure}

If no space required between the figures put a % after the first minipage

enter image description here

begin{figure}[h]
    begin{minipage}{0.5textwidth}
        includegraphics[width=textwidth]{image-b}
    end{minipage}%
    begin{minipage}{0.5textwidth}
        includegraphics[width=textwidth]{image-a}
    end{minipage}%
end{figure}

edit --to prevent protruding image in to margin--with respect to suggestion by @mico

begin{figure}[h]
    begin{minipage}{0.4975textwidth}
        includegraphics[width=textwidth]{image-b}
    end{minipage}hfill
    begin{minipage}{0.4975textwidth}
        includegraphics[width=textwidth]{image-a}
    end{minipage}%
end{figure}

enter image description here

Answered by js bibra on December 14, 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