我想用 LaTeX 制作一个表格,我编写了以下程序:
\documentclass[]{article}
\usepackage{graphicx}
\usepackage[usenames, dvipsnames]{color}
\usepackage{multirow}
\begin{document}
\begin{tabular}{|c|c|c||c|c|c|c}
\cline{2-5}
\multicolumn{1}{c|}{\multirow{1}{*}{}}& $\gamma_n$ & $\rho_{00}^\infty$ + $\eta_{\infty}$ & $\rho_{00}^\infty$ + $\eta_{\infty}$ & $\gamma_n$ & \multicolumn{1}{|c}{\multirow{1}{*}{}}\\
\hline
\multirow{5}{*}{\includegraphics[height=20mm]{fnodiss.eps}}& 0.01 & 0.2& 0.01 & 0.2 & \multicolumn{1}{c|}{\multirow{5}{*}{\includegraphics[height=20mm]{fnodiss.eps}}} \\
\cline{2-5}
& 0.01 & 0.2 & 0.01 & 0.2 \\
\cline{2-5}
& 0.01 & 0.2& 0.01 & 0.2 \\
\cline{2-5}
& 0.01 & 0.2& 0.01 & 0.2 \\
\cline{2-5}
& \textcolor{red}{0.9399} & 0.2 & 0.01 & 0.2 \\
\hline
\multirow{5}{*}{\includegraphics[height=20mm]{fnodiss.eps}}& 0.01 & 0.2 & 0.01 & 0.2 &\multicolumn{1}{c|}{\multirow{5}{*}{33O}} \\
\cline{2-5}
& 0.01 & 0.2& 0.01 & 0.2 \\
\cline{2-5}
& 0.01 & 0.2& 0.01 & 0.2 \\
\cline{2-5}
& 0.01 & 0.2& 0.01 & 0.2 \\
\cline{2-5}
& 0.01 & 0.2 & 0.01 & 0.2 \\
\hline
\multirow{5}{*}{\includegraphics[height=20mm]{fnodiss.eps}}& 0.01 & 0.2 & 0.01 & 0.2 &\multirow{5}{*}{\includegraphics[height=20mm]{fnodiss.eps}} \\
\cline{2-5}
& 0.01 & 0.2 & 0.01 & 0.2 \\
\cline{2-5}
& 0.01 & 0.2 & 0.01 & 0.2 \\
\cline{2-5}
& 0.01 & 0.2 & 0.01 & 0.2 \\
\cline{2-5}
& 0.01 & 0.2 & 0.01 & 0.2 \\
\hline
\end{tabular}
\end{document}
并且它运行良好,除了最后一列不完美,即最后一条垂直线不完整。
请帮我。
答案1
您忘记了某些行末尾的 & 符号。我借此机会改进了您的表格和软件包hhline
,并对代码进行了一些更正和简化:
\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage[usenames, dvipsnames]{xcolor}
\usepackage{array, multirow, hhline}
\newcommand\myhline{\hhline{~|--||--~}}
\begin{document}
\centering
\setlength\extrarowheight{2pt}
\begin{tabular}{|c|c|c||c|c|c|c|}
\cline{2-5}
\multicolumn{1}{c|}{}& $γ_n$ & $ρ_{00}^∞$ + $η_{∞}$ & $ρ_{00}^∞$ + $η_{∞}$ & $γ_n$ & \multicolumn{1}{c}{} \\[2pt]
\hhline{---||---}
\multirow{5}{*}[-0.6ex]{\includegraphics[height=20mm, width=35mm]{fnodiss.eps}}& 0.01 & 0.2& 0.01 & 0.2 & \multicolumn{1}{c|}{\multirow{5}{*}[-0.6ex]{\includegraphics[height=20mm, width=35mm]{fnodiss.eps}}} \\
\myhline%
& 0.01 & 0.2 & 0.01 & 0.2 & \\
\myhline
& 0.01 & 0.2& 0.01 & 0.2 & \\
\myhline
& 0.01 & 0.2& 0.01 & 0.2 & \\
\myhline
& \textcolor{red}{0.9399} & 0.2 & 0.01 & 0.2 & \\
\hhline{---||---}
\multirow{5}{*}[-0.6ex]{\includegraphics[height=20mm, width=35mm]{fnodiss.eps}}& 0.01 & 0.2 & 0.01 & 0.2 &\multicolumn{1}{c|}{\multirow{5}{*}{33O}} \\
\myhline
& 0.01 & 0.2& 0.01 & 0.2 & \\
\myhline
& 0.01 & 0.2& 0.01 & 0.2 & \\
\myhline
& 0.01 & 0.2& 0.01 & 0.2 & \\
\myhline
& 0.01 & 0.2 & 0.01 & 0.2 & \\
\hhline{---||---}
\multirow{5}{*}[-0.6ex]{\includegraphics[height=20mm, width=35mm]{fnodiss.eps}}& 0.01 & 0.2 & 0.01 & 0.2 &\multirow{5}{*}[-0.6ex]{\includegraphics[height=20mm, width=35mm]{fnodiss.eps}} \\
\myhline
& 0.01 & 0.2 & 0.01 & 0.2 & \\
\myhline
& 0.01 & 0.2 & 0.01 & 0.2 & \\
\myhline
& 0.01 & 0.2 & 0.01 & 0.2 & \\
\myhline
& 0.01 & 0.2 & 0.01 & 0.2 & \\
\hline
\end{tabular}
\end{document}
答案2
我稍微重新整理一下你的例子:
\documentclass[]{article}
\usepackage{graphicx}
\usepackage[usenames, dvipsnames]{color}
\usepackage{multirow}
\usepackage[active,floats,tightpage]{preview}
\setlength\PreviewBorder{1em}
\begin{document}
\begin{table}
\begin{tabular}{|c|c|c||c|c|c|c|}
\cline{2-5}
\multicolumn{1}{c|}{\multirow{1}{*}{}}
& $\gamma_n$ & $\rho_{00}^\infty$ + $\eta_{\infty}$
& $\rho_{00}^\infty$ + $\eta_{\infty}$
& $\gamma_n$
& \multicolumn{1}{c}{} \\
\hline
\multirow{5}{*}{\includegraphics[height=20mm]{example-image}}
& 0.01
& 0.2
& 0.01
& 0.2
& \\
\cline{2-5}
& 0.01 & 0.2 & 0.01 & 0.2 & \\
\cline{2-5}
& 0.01 & 0.2 & 0.01 & 0.2 & \\
\cline{2-5}
& 0.01 & 0.2 & 0.01 & 0.2 & \\
\cline{2-5}
& \textcolor{red}{0.9399}
& 0.2 & 0.01 & 0.2 &
\multirow{-5}{*}{\includegraphics[height=20mm]{example-image}} \\
\hline
\end{tabular}
\end{table}
\end{document}
最后一行出现: