0

I have the following code:

\documentclass[journal,twocolumn,10pt]{IEEEtran}

\usepackage{subfigure}
\usepackage{mathtools}

\begin{document}

\begin{figure}[t]
\centering
\subfigure[Line]{\centering
  $E= \begin{bmatrix}
      0 & 1 & 0 & 0 \\
      1 & 0 & 1 & 0 \\
      0 & 1 & 0 & 1 \\
      0 & 0 & 1 & 0 \\
    \end{bmatrix}$}
\subfigure[Square]{\centering
  $E= \begin{bmatrix}
      0 & 1 & 0 & 1 \\
      1 & 0 & 1 & 0 \\
      0 & 1 & 0 & 1 \\
      1 & 0 & 1 & 0 \\
    \end{bmatrix}$}
\subfigure[Full]{\centering
  $E= \begin{bmatrix}
      0 & 1 & 1 & 1 \\
      1 & 0 & 1 & 1 \\
      1 & 1 & 0 & 1 \\
      1 & 1 & 1 & 0 \\
    \end{bmatrix}$}
\subfigure[Star]{\centering
  $E= \begin{bmatrix}
      0 & 1 & 1 & 1 \\
      1 & 0 & 0 & 0 \\
      1 & 0 & 0 & 0 \\
      1 & 0 & 0 & 0 \\
    \end{bmatrix}$}
\caption{Adjacency matrices for network graphs}
\label{EMATRICES}
\end{figure}


\end{document}

which results in this figure:

enter image description here

I would like to know if there is any form to center the captions and subcaptions and give some space between the subcaptions and the matrices.

Regards

  • For the vertical space: \setlength{\subfigcapskip}{0.3cm}. But are you sure that a figure is the best environment to show matrices? – user36296 Jun 18 '18 at 16:26
  • @samcarter Thanks. I do not use an array of math equations because I would like to place labels and \ref labels I could use. – user1993416 Jun 18 '18 at 16:31
1

Your subcaptions are centered, they are just not centered with the matrices, because there is also E = in front.

The subfigures you had are not really figures, that is why the subcaptions appear so close to them. They could be converted to figures with TikZ.

The positioning of the caption can be customized with package caption.

Here is code

\usepackage{mathtools}
\usepackage{caption}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usepackage{graphicx}
\usepackage{subfigure}
\usepackage{float}

\begin{document}

\begin{figure}[t]
\centering
\captionsetup{justification=centering}
\resizebox {0.8 \columnwidth}{!}{
\subfigure[Line]{\centering
\begin{tikzpicture}
\draw (0,0) node {$E = \begin{bmatrix}
0 & 1 & 0 & 0 \\
1 & 0 & 1 & 0 \\
0 & 1 & 0 & 1 \\
0 & 0 & 1 & 0 \\
\end{bmatrix}$};
\end{tikzpicture}
}
\subfigure[Square]{\centering
\begin{tikzpicture}
\draw (0,0) node {$E = \begin{bmatrix}
0 & 1 & 0 & 1 \\
1 & 0 & 1 & 0 \\
0 & 1 & 0 & 1 \\
1 & 0 & 1 & 0 \\
\end{bmatrix}$};
\end{tikzpicture}
}
}
\resizebox {0.8 \columnwidth}{!}{
\subfigure[Full]{\centering
\begin{tikzpicture}
\draw (0,0) node {$E = \begin{bmatrix}
0 & 1 & 1 & 1 \\
1 & 0 & 1 & 1 \\
1 & 1 & 0 & 1 \\
1 & 1 & 1 & 0 \\
\end{bmatrix}$};
\end{tikzpicture}
}
\subfigure[Star]{\centering
\begin{tikzpicture}
\draw (0,0) node {$E = \begin{bmatrix}
0 & 1 & 1 & 1 \\
1 & 0 & 0 & 0 \\
1 & 0 & 0 & 0 \\
1 & 0 & 0 & 0 \\
\end{bmatrix}$};
\end{tikzpicture}
}
}
\caption{Adjacency matrices for network graphs}
\label{EMATRICES}
\end{figure}

Here is how it looks like

subfloat

  • thanks. How could I set the width of the subfigures to fill for example 0.8\columnwidth?. – user1993416 Jun 18 '18 at 18:19
  • @user1993416 You could use \resizebox, please see the updated code in the answer. – zyy Jun 18 '18 at 19:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.