我试图将一个tabular
与另一个放在tabular
一起,以便将单元格条目放在多行上。但是,这样做时,相邻单元格中的两个图像似乎在其基线处对齐,而不是每个单元格的所有内容都垂直居中。MWE 如下:
\documentclass[11pt]{article}
\usepackage{graphicx}
\graphicspath{{images/}}
\pdfminorversion=6
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{backgrounds}
\pgfplotsset{compat=1.13}
\pgfplotsset{colormap={grays}{gray(0cm)=(0.5);gray(1cm)=(0)}}
\pgfplotsset{samples=3}
\usepackage{amsmath,amssymb}
\begin{document}
\begin{table*}
\caption{Table Caption}
\centering
\begin{tabular}{|c|c|}
\hline
\begin{tabular}[c]{@{}c@{}}\includegraphics[width=0.3\linewidth]{finite_line_load_vert.pdf} \\
$p=15$ kN/m \\ $a=5$ m \\ $b=15$ m \\ $c=0$ m \\ $z=$ 2 m \end{tabular} &
\begin{tikzpicture}[framed]
\begin{axis}[%
view={30}{30},
width=0.6\linewidth,
height=3in,
xlabel={Lateral Distance $x$ [m]},
xlabel style={align=center, rotate=-7},
ylabel={Lateral Distance $y$ [m]},
ylabel style={rotate=27},
zlabel={Vertical Stress $q_v$ [kPa]}
]
\addplot3[
patch,
fill=white,
opacity=0.8,
domain=0:20,
y domain=-5:5
]
{15*2^3/(2*3.1415*(y^2+2^2))*(%
((15-x)*(2*(15-x)^2+3*(y^2+2^2))/((15-x)^2+y^2+2^2)^1.5)-%
%
((5-x)*(2*(5-x)^2+3*(y^2+2^2)))/((5-x)^2+y^2+2^2)^1.5))};
\addlegendentry{$q_v$}
\end{axis}
\end{tikzpicture} \\ \hline
%
\multicolumn{2}{|c|}{\vbox{%
\begin{equation*}
E=mc^2
\end{equation*}}} \\
%
\hline
\end{tabular}
\end{table*}
\end{document}
结果如下。我试图让左右单元格在单元格中心垂直对齐。 这个问题处理了类似的问题,但没有解决垂直居中问题。
答案1
借助baseline=(current bounding box.center),
添加到的选项,tikzpicture
您可以获得所需的垂直居中对齐:
\documentclass[11pt]{article}
\usepackage{graphicx}
\graphicspath{{images/}}
\pdfminorversion=6
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{backgrounds}
\pgfplotsset{compat=1.13}
\pgfplotsset{colormap={grays}{gray(0cm)=(0.5);gray(1cm)=(0)}}
\pgfplotsset{samples=3}
\usepackage{amsmath,amssymb}
\begin{document}
\begin{table*}
\caption{Table Caption}
\centering
\begin{tabular}{|c|c|}
\hline
\begin{tabular}[c]{@{}c@{}}\includegraphics[width=0.3\linewidth]{example-image} \\
$p=15$ kN/m \\ $a=5$ m \\ $b=15$ m \\ $c=0$ m \\ $z=$ 2 m \end{tabular} &
\begin{tikzpicture}[baseline=(current bounding box.center),framed]
\begin{axis}[%
view={30}{30},
width=0.6\linewidth,
height=3in,
xlabel={Lateral Distance $x$ [m]},
xlabel style={align=center, rotate=-7},
ylabel={Lateral Distance $y$ [m]},
ylabel style={rotate=27},
zlabel={Vertical Stress $q_v$ [kPa]}
]
\addplot3[
patch,
fill=white,
opacity=0.8,
domain=0:20,
y domain=-5:5
]
{15*2^3/(2*3.1415*(y^2+2^2))*(%
((15-x)*(2*(15-x)^2+3*(y^2+2^2))/((15-x)^2+y^2+2^2)^1.5)-%
%
((5-x)*(2*(5-x)^2+3*(y^2+2^2)))/((5-x)^2+y^2+2^2)^1.5))};
\addlegendentry{$q_v$}
\end{axis}
\end{tikzpicture} \\ \hline
%
\multicolumn{2}{|c|}{\vbox{%
\begin{equation*}
E=mc^2
\end{equation*}}} \\
%
\hline
\end{tabular}
\end{table*}
\end{document}