Graphics, Figures & Tablessubcaption | Reduction of blank Space between Sub-figures

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
ahmedlasheen
Posts: 43
Joined: Wed Oct 27, 2010 10:25 pm

subcaption | Reduction of blank Space between Sub-figures

Post by ahmedlasheen »

Hello All,

I am asking if there is a way so that I can empty the space between the sub figure, so that the figures has the maximum size.
I have attached the minimal example. and also the output.
thanks in advance

Code: Select all

\documentclass[a4paper]{report}
\usepackage{geometry}
\usepackage{graphicx}
\usepackage{subcaption}% donot put \usepackage{subfig}

\begin{document}
  \begin{figure}[!ht]
    \begin{subfigure}[b]{0.5\textwidth}
      \includegraphics[width=\textwidth]{NH.png}
      \caption{NH}
      \label{fig:NH}
    \end{subfigure}
    \hspace{0.2mm} % add desired spacing between images, e. g. ~, \quad, \qquad etc.
                    %(or a blank line to force the subfigure onto a new line)
    \begin{subfigure}[b]{0.5\textwidth}
      \includegraphics[width=\textwidth]{SH.png}
      \caption{SH}
      \label{fig:SH}
    \end{subfigure}
  \end{figure}
\end{document}
Attachments
mini.tex
(638 Bytes) Downloaded 355 times
mini.png
mini.png (34 KiB) Viewed 8792 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

subcaption | Reduction of blank Space between Sub-figures

Post by svend_tveskaeg »

Hmmm ... when I compile your code and change

Code: Select all

\includegraphics[width=\textwidth]{NH.png}
and

Code: Select all

\includegraphics[width=\textwidth]{SH.png}
to

Code: Select all

\includegraphics[width=\textwidth]{segla1b}
(since I do not have your images) and compile using PDFLaTeX it works just fine; see the attached PDF file.

P.S. The image can be found here.
Attachments
test2.pdf
Output.
(46.31 KiB) Downloaded 325 times
Last edited by svend_tveskaeg on Mon Nov 05, 2012 6:15 pm, edited 2 times in total.
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
ahmedlasheen
Posts: 43
Joined: Wed Oct 27, 2010 10:25 pm

subcaption | Reduction of blank Space between Sub-figures

Post by ahmedlasheen »

Thanks for your help
I found that there is a white space around the figure, I used convert command

Code: Select all

convert --trim figure_in figure_out
to trim that space, and I compile latex again, and it works fine. The figures now have the maximum size.
I have attached the new file.
Attachments
mini.png
mini.png (77.59 KiB) Viewed 8784 times
Post Reply