[Tex/LaTex] Reduction of Space between two Sub-figures


I want to reduce the space between two subfigures and use that space to make those subfigures large. How to do that? My code is as follows:


Best Answer

Consider the following minimal example that shows three different ways of spacing sub-figures:

  1. Maximum length
  2. Equal lengths
  3. Fixed length

Different lengths separating subfigures

  % Maximum length


  % Equal length


  % Fixed length


The showframe package was loaded to highlight the text block boundaries. Note the use of % for precise spacing. See What is the use of percent signs (%) at the end of lines? for more on this.

  1. Maximum length: Here a stretchable length of \hfill is used to push both subfigures to the edges of the text block. Note the % at the end of the second subfigure, if you're placing content on the following line.

  2. Equal lengths: A stretchable length is placed on either side of the subfigures to equalize the length from the text block boundary as well as between the subfigures. Note the use of \hspace*{\fill} on either side of the subfigures, while \hfill suffices between them.

  3. Fixed length: Use a fixed \hspace{<len>} between the subfigures, together with \centering to centre and separate the subfigures by a fixed distance <len> (1em in my example).

Some comments:

  • Note the use of % at the end of lines. They do add spurious spaces in your output. While it may not be visible, you may not get exact lengths otherwise. See What is the use of percent signs (%) at the end of lines? for more on this.

  • Only method 3 (fixed length) requires \centering, unless you're also providing a figure caption (which you didn't in your code snippet. Moreover, using \label without a \caption does not help here. It works within \subcaptionbox (from subcaption), since it writes a caption, but you would still need a separate \caption for your figure environment for \label{fig1} to yield anything.