AnswerBun.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!

Related Questions

how to insert keys from token list in command

0  Asked on December 12, 2020 by aleksandr-kozlovskiy

         

How do I cite author in LaTeX with BibLaTeX?

1  Asked on December 12, 2020 by ccile

       

Broken longrightarrow

1  Asked on December 12, 2020

   

How to use Arabic symbols as mathematical variables?

1  Asked on December 12, 2020 by wjmccann

         

Reverse the direction of pause in a matrix

2  Asked on December 12, 2020

 

How to determine the kind of atom of a given mathematical symbol?

0  Asked on December 12, 2020 by matemticos-chibchas

 

csname silences errors

1  Asked on December 12, 2020 by caagr98

 

No room for a new write in LuaLaTeX

1  Asked on December 12, 2020 by aubrey-blumsohn

   

revtex4-1 and colortbl doesn’t fill cells

2  Asked on December 12, 2020 by sven

       

Tables with Pweave

4  Asked on December 12, 2020 by lars20070

 

BibTeX author tag string limitation

1  Asked on December 12, 2020

   

Latexdiff and biblatex citation commands

1  Asked on December 12, 2020 by avs

     

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP