![表格與圖(包括圖的標題)並排。](https://rvso.com/image/286337/%E8%A1%A8%E6%A0%BC%E8%88%87%E5%9C%96%EF%BC%88%E5%8C%85%E6%8B%AC%E5%9C%96%E7%9A%84%E6%A8%99%E9%A1%8C%EF%BC%89%E4%B8%A6%E6%8E%92%E3%80%82.png)
我想創建一個並排放置圖像的表格。我遇到的問題是表格的對齊方式。任何人都可以修復程式碼以使 Lambda_1 和 Lambda_2 相應地成為每個圖的標題嗎?如果我不包含旁邊的 &1.~Real unequal eigenvalues of same sign &
那麼表格的左邊框將不會連接到標題邊框。我知道問題出在\begin{tabularx}{\textwidth}{|XX|}
.有人可以幫助我指導更改程式碼以實現更好的對齊嗎?我想將圖的列更改為 1,並並排包含圖表而不是 2 列。
我堅持使用 tabularx 是因為我不希望表格移到文件的邊緣。
\begin{table} [H]
\begin{tabularx}{\textwidth}{|XX|}
\hline
\multicolumn{2}{|c|}{Collection of Figures of 2D Phase Portraits} \\ \hline
1.~Real unequal eigenvalues of same sign & \\
\includegraphics[height=1.8in]{2D/rup.png} $\lambda_1 > \lambda_2 > 0$ & \includegraphics[height=1.8in]{2D/run.png}$\lambda_1 > \lambda_2 < 0$ \\
\hline
\end{tabularx}
\end{table}
答案1
實際上沒有必要tabularx
只為一列;tabular
可以用一個簡單的代替。我使用了subfigure
來自的環境subcaption
和功能booktabs
(沒有表格的垂直規則):
\documentclass[11pt]{article}
\usepackage[demo]{graphicx}
\usepackage{subcaption}
\usepackage{booktabs}
\begin{document}
\begin{table}[H]
\begin{tabular}{l}
\toprule
\multicolumn{1}{c}{Collection of Figures of 2D Phase Portraits} \\
\midrule
1.~Real unequal eigenvalues of same sign \\
\begin{subfigure}{\dimexpr.5\linewidth-2\fboxsep\relax}
\centering
\includegraphics[height=1.8in]{2D/rup.png}
\caption{$\lambda_1 > \lambda_2 > 0$}
\end{subfigure}\hfill%
\begin{subfigure}{\dimexpr.5\linewidth-2\fboxsep\relax}
\centering
\includegraphics[height=1.8in]{2D/run.png}
\caption{$\lambda_1 > \lambda_2 < 0$}
\end{subfigure} \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
如果標題不需要編號以進行交叉引用,則可以簡單地使用小型頁面:
\documentclass[11pt]{article}
\usepackage[demo]{graphicx}
\usepackage{booktabs}
\begin{document}
\begin{table}[H]
\begin{tabular}{l}
\toprule
\multicolumn{1}{c}{Collection of Figures of 2D Phase Portraits} \\
\midrule
1.~Real unequal eigenvalues of same sign \\
\begin{minipage}{\dimexpr.5\linewidth-2\fboxsep\relax}
\centering
\includegraphics[height=1.8in]{2D/rup.png}\par
$\lambda_1 > \lambda_2 > 0$
\end{minipage}%
\begin{minipage}{\dimexpr.5\linewidth-2\fboxsep\relax}
\centering
\includegraphics[height=1.8in]{2D/run.png}\par
$\lambda_1 > \lambda_2 < 0$
\end{minipage} \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
此demo
選項graphicx
簡單地將實際圖形替換為黑色矩形;做不是在您的實際文件中使用該選項。