我有这个代码
\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}
答案1
您tabular
定义了两列,但您在tabular
正文中使用了三列:
\begin{tabular}{ c c }
<first column> & <second column> & <third column>
\\
<first column> & <second column> & <third column>
\\
% ...
\end{tabular}
删除第二个&
,以便仅使用指定的列。
\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}