# How can I get the captions and images aligned?

I have this code

\begin{figure}
\begin{tabular}{cc}
\subfloat[$T_s$ = 119 Position with sine]{\includegraphics[width = 2in]{T119PosiSin.eps}} &
\subfloat[$T_s$ = 118 Position with sine]{\includegraphics[width = 2in]{T118PosiSin.eps}} &
\\
\subfloat[$T_s$ = 119 Current with sine]{\includegraphics[width = 2in]{T119CurrSin.eps}} &
\subfloat[$T_s$ = 118 Current with sine]{\includegraphics[width = 2in]{T118CurrSin.eps}} &
\\
\subfloat[$T_s$ = 119 Position with square]{\includegraphics[width = 2in]{T119PosiSqu.eps}} &
\subfloat[$T_s$ = 118 Position with square]{\includegraphics[width = 2in]{T118PosiSqu.eps}} &
\\
\subfloat[$T_s$ = 119 Current with square]{\includegraphics[width = 2in]{T119CurrSqu.eps}} &
\subfloat[$T_s$ = 118 Current with square]{\includegraphics[width = 2in]{T118CurrSqu.eps}}
\end{tabular}
\caption{4 x 2}
\end{figure}


This leads to the image attached where the images and the captions are not aligned properly. Does anyone know how I can make it so that they become aligned correctly?

• Welcome to TeX.SE! To mark some part of your post as code, put it in the cursor and press the {} button. And please complete your code such that it starts with \documentclass and ends with \end{document} such that those who are willing to help do not have to guess which packages you're using. – user121799 Oct 27 '18 at 17:12

Your tabular is defined with two columns, but you're using three columns in the tabular body:

\begin{tabular}{ c c }
<first column> & <second column> & <third column>
\\
<first column> & <second column> & <third column>
\\
% ...
\end{tabular}


Drop the second & so you're using only the columns specified.

\documentclass{article}

\usepackage{graphicx,subfig}

\begin{document}

\begin{figure}
\begin{tabular}{ c c }
\subfloat[$T_s = 119$ Position with sine]{\includegraphics[width = 2in]{example-image-a}} &
\subfloat[$T_s = 118$ Position with sine]{\includegraphics[width = 2in]{example-image-b}}
\\
\subfloat[$T_s = 119$ Current with sine]{\includegraphics[width = 2in]{example-image-a}} &
\subfloat[$T_s = 118$ Current with sine]{\includegraphics[width = 2in]{example-image-b}}
\\
\subfloat[$T_s = 119$ Position with square]{\includegraphics[width = 2in]{example-image-b}} &
\subfloat[$T_s = 118$ Position with square]{\includegraphics[width = 2in]{example-image-a}}
\\
\subfloat[$T_s = 119$ Current with square]{\includegraphics[width = 2in]{example-image-b}} &
\subfloat[$T_s = 118$ Current with square]{\includegraphics[width = 2in]{example-image-a}}
\end{tabular}
\caption{$2 \times 4$}
\end{figure}

\end{document}