1

I have a 5x2 array of subfigures. My document has IEEEtran style and I am using this test code:

\documentclass[journal,twocolumn,10pt]{IEEEtran}   
\usepackage{graphicx}
\usepackage{mwe}% just for the example content

\begin{document}

\blindtext

\begin{figure*}

\includegraphics[width=.2\textwidth]{_kkk/javier-sesion-14-SEC-6-FRAMES.pdf}\hfill \includegraphics[width=.25\textwidth]{_kkk/javier-sesion-14-SEC-6-ALL.pdf} \[\smallskipamount] \includegraphics[width=.55\textwidth]{_kkk/javier-sesion-14-SEC-3-FRAMES.pdf}\hfill \includegraphics[width=.25\textwidth]{_kkk/javier-sesion-14-SEC-3-ALL.pdf} \[\smallskipamount] \includegraphics[width=.4\textwidth]{_kkk/javier-sesion-14-SEC-26-FRAMES.pdf}\hfill \includegraphics[width=.25\textwidth]{_kkk/javier-sesion-14-SEC-26-ALL.pdf} \[\smallskipamount] \includegraphics[width=.6\textwidth]{_kkk/javier-sesion-14-SEC-16-FRAMES.pdf}\hfill \includegraphics[width=.25\textwidth]{_kkk/javier-sesion-14-SEC-16-ALL.pdf} \[\smallskipamount] \includegraphics[width=.6\textwidth]{_kkk/javier-sesion-14-SEC-7-FRAMES.pdf}\hfill \includegraphics[width=.25\textwidth]{_kkk/javier-sesion-14-SEC-7-ALL.pdf}

\caption{Combinations examples from session S4} \label{SESION4} \end{figure*}

\blindtext

\end{document}

The PDF-figures are in this link.

enter image description here

that I would like to look like this

enter image description here

leaving little space to fill if possible, filling the text width length.

One of the problems could be the white margin around the *-FRAMES.pdf figures.

Zarko
  • 296,517
pablo
  • 451

2 Answers2

3

With use of the \adjincludegraphics defined in the adjustbox package, defined common images features by use of \adjustboxset (exception are added locally) and arrange images in a table, where content in the first column is right aligned, and in the second left:

\documentclass[journal]{IEEEtran}
\usepackage[export]{adjustbox}
\usepackage{array, booktabs}

\usepackage{lipsum} % for dummy text

\begin{document}

\begin{figure*}

\adjustboxset{height=0.08\textheight, width=\linewidth, % keepaspectratio, % add when are used original images margin=0pt 3pt 0pt 3pt }

\begin{tabular}{\textwidth}{@{} >{\raggedleft}m{\dimexpr0.75\textwidth-\tabcolsep}
m{\dimexpr0.25\linewidth-\tabcolsep} @{}} \adjincludegraphics[height=0.16\textheight, % at original image width=.2\textwidth]{example-image-duck} & \adjincludegraphics{example-image}\par \adjincludegraphics{example-image} \ \addlinespace \adjincludegraphics[height=0.16\textheight, width=.55\textwidth]{example-image-duck} & \adjincludegraphics{example-image}\par \adjincludegraphics{example-image} \ \addlinespace \adjincludegraphics[height=0.16\textheight, width=.4\textwidth]{example-image-duck} & \adjincludegraphics{example-image}\par \adjincludegraphics{example-image} \ \addlinespace \adjincludegraphics[height=0.16\textheight, width=.6\textwidth]{example-image-duck} & \adjincludegraphics{example-image}\par \adjincludegraphics{example-image} \ \addlinespace \adjincludegraphics[height=0.16\textheight, width=.6\textwidth]{example-image-duck} & \adjincludegraphics{example-image}\par \adjincludegraphics{example-image} \ \caption{Combinations examples from session S4} \end{tabular
} \end{figure*} \lipsum\lipsum \end{document}

enter image description here

Note: by height of example-images are simulate unknown heights of your original images.

Edit:

After your comments is completely unclear, what actually is your problem, so it is almost impossible to help you. I only can to show you an idea, how you can simple arrange your images. All details about images (their size) I left you, since your images are unknown. In MWE below images size are only simulated (based on given width in your MWE) by height and width options in includegraphics:

\documentclass[journal]{IEEEtran}
\usepackage{graphicx}
\usepackage{array, booktabs}

\usepackage{lipsum} % for dummy text

\begin{document}

\begin{figure*}

\setkeys{Gin}{height=0.18\textheight, width=\linewidth, % image width is defined by column width % keepaspectratio, % add when are used original images }

\begin{tabular}{\textwidth}{@{} >{\raggedleft}m{\dimexpr0.75\textwidth-\tabcolsep} m{\dimexpr0.25\linewidth-\tabcolsep} @{}} \includegraphics[height=0.13\textheight, % simulate height of original image width=.2\textwidth]{example-image-duck} & \includegraphics{example-image} \ \addlinespace \includegraphics[height=0.13\textheight, width=.55\textwidth]{example-image-duck} & \includegraphics{example-image} \ \addlinespace \includegraphics[height=0.13\textheight, width=.4\textwidth]{example-image-duck} & \includegraphics{example-image} \ \addlinespace \includegraphics[height=0.13\textheight, width=.6\textwidth]{example-image-duck} & \includegraphics{example-image} \ \addlinespace \includegraphics[height=0.13\textheight, width=.6\textwidth]{example-image-duck} & \includegraphics{example-image} \ \caption{Combinations examples from session S4} \end{tabular} \end{figure*} \lipsum\lipsum \end{document}

enter image description here

Zarko
  • 296,517
  • Thanks. Is there any way to place the 5 rows of figures on the same page? like in the scheme. – pablo Aug 13 '21 at 21:22
  • @pablo, yes, it is. Reduce height of images. – Zarko Aug 14 '21 at 03:40
  • @pablo, see edited answer. – Zarko Aug 14 '21 at 05:04
  • @Zarco Thank you. The images at the right column come in pairs in one pdf file and have two plots together. Testing the solution with the PDFs gets small plots in the second column. Changing m{\dimexpr0.65\textwidth-\tabcolsep} m{\dimexpr0.35\linewidth-\tabcolsep} the weights it enlarges the second column but changes the aspect ratio. – pablo Aug 14 '21 at 09:00
  • @pablo, oh, your question is complete unclear. From image follows, that in second columns in each row are stack of two images. In the case, that in each cell are one image, solution is even simpler ... actually it is now not clear, what is than your problem- I will correct my answer (last time). – Zarko Aug 14 '21 at 09:20
3

The white space around *-FRAMES.pdf is not uniform and varies from figure to figure. It can be trimmed using trim and clip within \includegraphics, but it does involve measuring (or guessing) each left, right, top and bottom margin. A lot of manual operations if you have many figures.

So I choose a two step workflow:

(1) Use pdfcrop to get rid of all whitespace, running cropFig.tex in your _kkk directory

You will end up with six new figures, now neatly cropped and named *FRAMES-crop.pdf

Needs pdflatex and \write18 enabled. For most TeX distributions set the --shell-escape flag when running latex/pdflatex.

For example. with TeXstudio, set

pdflatex.exe -synctex=1 -interaction=nonstopmode -shell-escape %.tex

See the example https://tex.stackexchange.com/a/151669/161015

(2) To design the figure, it is easier to use a tabular environment. I chose nicematrix because it provides a \Block command that will vertically center the content in the cell, without the need for any additional packages.

The length of \FrameHeight is used to control the height and width of the FRAMES and thus the entire figure.

Following your comment, I set the height of * ALL.pdf equal to 1.4\FrameHeight.

d

This is the the main code:

\documentclass[journal,twocolumn,10pt]{IEEEtran}   
\usepackage{graphicx}
%\usepackage{mwe}% just for the example content

\usepackage{showframe} % show the margin

\usepackage{nicematrix} % added <<<< \usepackage[center]{caption} % centering the caption

\begin{document}

\newlength{\FrameHeight} \setlength{\FrameHeight}{0.16\textwidth} % to control the figure Frame width and height

\begin{figure*}

\begin{NiceTabular}{rl}[cell-space-limits=6pt] % add space between rows

\Block{}{\includegraphics[keepaspectratio,height=\FrameHeight]{_kkk/javier-sesion-14-SEC-6-FRAMES-crop.pdf}}& \Block{}{\includegraphics[keepaspectratio,height=1.4\FrameHeight]{_kkk/javier-sesion-14-SEC-6-ALL.pdf}} \ \Block{}{\includegraphics[keepaspectratio,height=\FrameHeight]{_kkk/javier-sesion-14-SEC-3-FRAMES-crop.pdf}}& \Block{}{\includegraphics[keepaspectratio,height=1.4\FrameHeight]{_kkk/javier-sesion-14-SEC-3-ALL.pdf}} \ \Block{}{\includegraphics[keepaspectratio,height=\FrameHeight]{_kkk/javier-sesion-14-SEC-26-FRAMES-crop.pdf}}& \Block{}{\includegraphics[keepaspectratio,height=1.4\FrameHeight]{_kkk/javier-sesion-14-SEC-26-ALL.pdf}} \ \Block{}{\includegraphics[keepaspectratio,height=\FrameHeight]{_kkk/javier-sesion-14-SEC-16-FRAMES-crop.pdf}}& \Block{}{\includegraphics[keepaspectratio,height=1.4\FrameHeight]{_kkk/javier-sesion-14-SEC-16-ALL.pdf}} \ \Block{}{\includegraphics[keepaspectratio,height=\FrameHeight]{_kkk/javier-sesion-14-SEC-7-FRAMES-crop.pdf}}& \Block{}{\includegraphics[keepaspectratio,height=1.4\FrameHeight]{_kkk/javier-sesion-14-SEC-7-ALL.pdf}} \

\end{NiceTabular}

\caption{Combinations examples from session S4}\label{SESION4} \end{figure*}

\end{document}

This is the file cropFig.tex

% !TeX TS-program = pdflatex %%<<<<<<<<<<<<<<<<<<<<<<

%% file cropFig.tex

\documentclass{article}

\usepackage{graphicx} % From https://tex.stackexchange.com/a/151669/161015 \newcommand{\includeCroppedPdf}[2][]{% \immediate\write18{pdfcrop #2}% \includegraphics[#1]{#2-crop}}

\begin{document} \noindent \includeCroppedPdf[width=\textwidth]{javier-sesion-14-SEC-3-FRAMES} \includeCroppedPdf[width=\textwidth]{javier-sesion-14-SEC-6-FRAMES} \includeCroppedPdf[width=\textwidth]{javier-sesion-14-SEC-7-FRAMES} \includeCroppedPdf[width=\textwidth]{javier-sesion-14-SEC-16-FRAMES} \includeCroppedPdf[width=\textwidth]{javier-sesion-14-SEC-26-FRAMES} \end{document}

and part of its output

x

UPDATE II

Making the left figures smaller and the right larger:

By changing \AllHeight you can modify the height of the *ALL figures (and the width, they are squares). To insert five of them on one page it should be a little less than 1/5 of the text height to allow room for the caption.

With \FrameHeight you can modify the height of all *FRAME' figures relative to the height of *ALL` figures while allowing the widest one to fit on the left side of the page.

z

\documentclass[journal,twocolumn,10pt]{IEEEtran}   
\usepackage{graphicx}
%\usepackage{mwe}% just for the example content

%\usepackage{showframe} % show the margin

\usepackage{nicematrix} % added <<<< \usepackage[center]{caption} % centering the caption

\begin{document}

\newlength{\FrameHeight} \newlength{\AllHeight}

\setlength{\FrameHeight}{0.13\textwidth} % to control the figure(s) FRAMA width (and height)
\setlength{\AllHeight}{0.19\textheight} % to control the figure(s)
ALL width and height. (It is a square)

\begin{figure*} \setlength{\tabcolsep}{10pt} %columns separation

\begin{NiceTabular}{rc}[cell-space-limits=0pt] % add space between rows

\Block{}{\includegraphics[keepaspectratio,height=\FrameHeight]{_kkk/javier-sesion-14-SEC-6-FRAMES-crop.pdf}}& \Block{}{\includegraphics[keepaspectratio,height=\AllHeight]{_kkk/javier-sesion-14-SEC-6-ALL.pdf}} \ \Block{}{\includegraphics[keepaspectratio,height=\FrameHeight]{_kkk/javier-sesion-14-SEC-3-FRAMES-crop.pdf}}& \Block{}{\includegraphics[keepaspectratio,height=\AllHeight]{_kkk/javier-sesion-14-SEC-3-ALL.pdf}} \ \Block{}{\includegraphics[keepaspectratio,height=\FrameHeight]{_kkk/javier-sesion-14-SEC-26-FRAMES-crop.pdf}}& \Block{}{\includegraphics[keepaspectratio,height=\AllHeight]{_kkk/javier-sesion-14-SEC-26-ALL.pdf}} \ \Block{}{\includegraphics[keepaspectratio,height=\FrameHeight]{_kkk/javier-sesion-14-SEC-16-FRAMES-crop.pdf}}& \Block{}{\includegraphics[keepaspectratio,height=\AllHeight]{_kkk/javier-sesion-14-SEC-16-ALL.pdf}} \ \Block{}{\includegraphics[keepaspectratio,height=\FrameHeight]{_kkk/javier-sesion-14-SEC-7-FRAMES-crop.pdf}}& \Block{}{\includegraphics[keepaspectratio,height=\AllHeight]{_kkk/javier-sesion-14-SEC-7-ALL.pdf}} \

\end{NiceTabular}

\caption{Combinations examples from session S4}\label{SESION4} \end{figure*}

\end{document

Simon Dispa
  • 39,141
  • Thank you it working. I just would like to ask you if it would be possible to see the second column (the plots on the right) bigger. – pablo Aug 13 '21 at 22:36
  • I would like to trie make the boxing bag images a little smaller to make the plots at the right a little bigger keeping the page text width. – pablo Aug 13 '21 at 22:44
  • @pablo Please see the updated answer. – Simon Dispa Aug 13 '21 at 23:20