我正在尝试制作一个包含一些子图的表格,目前我得到了这个(显示框已激活):
但我想获得类似这样的东西,其中图例在左侧的多行中垂直居中(用油漆修改它):
我在网上找不到解决方案,有些人甚至说用 \multirow :/ 是不可能的。有人能帮帮我吗?这是我的代码:
\documentclass[11pt, oneside]{Thesis} % The default font size and one-sided printing (no margin offsets)
\graphicspath{{./Pictures/}} % Specifies the directory where pictures are stored
\usepackage[T1]{fontenc}
\usepackage{mathtools} % loads »amsmath«
\usepackage{amsmath}
\usepackage{physics}
\usepackage{float}
\usepackage{tabularx}
\usepackage{adjustbox}
\usepackage[english]{babel}
\usepackage[table]{xcolor}
\usepackage{tabularx}
\usepackage{showframe} % for demo
\usepackage{lmodern}
\usepackage{microtype}
\usepackage{ragged2e}
\usepackage{lua-visual-debug}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[square, numbers, comma, sort&compress]{natbib}
\usepackage{booktabs}
%\usepackage[table,xcdraw]{xcolor}
\hypersetup{urlcolor=blue, colorlinks=true} % Colors hyperlinks in blue - change to black if annoying
\title{\ttitle} % Defines the thesis title - don't touch this
\begin{document}
\begin{table}[H]
\centering
\begin{tabular}{l c c}
\multirow{2}{*}{
\begin{subfigure}[m{2cm}]{0.1\textwidth}
\includegraphics[height=8cm]{legend_u}
\end{subfigure}
}
& \begin{subfigure}[t]{0.4\textwidth}
\caption*{k-$\varepsilon$ RNG}
\includegraphics[height=8cm]{keRNG_u}
\end{subfigure}
& \begin{subfigure}[t]{0.4\textwidth}
\caption*{k-$\varepsilon$ Realizable}
\includegraphics[height=8cm]{keReal_u}
\end{subfigure} \\
& \begin{subfigure}[t]{0.4\textwidth}
\caption*{k-$\omega$ SST}
\includegraphics[height=8cm]{koSST_u}
\end{subfigure}
& \begin{subfigure}[t]{0.4\textwidth}
\caption*{LES}
\includegraphics[height=8cm]{LES_u}
\end{subfigure}
\end{tabular}
\end{table}
\end{document}
答案1
环境中包含的垂直定位图片的主要障碍multirow
是参数。它将被视为行的锚点移动到表格行的顶部。[t]
subfigure
multirow
删除 MWE 中所有不必要的内容并从下面的代码example-image
包中使用graphicx
\documentclass[11pt]{article}
\usepackage{array,booktabs,multirow,tabularx}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{showframe} % for demo
\begin{document}
\begin{table}[h]
\centering
\begin{tabularx}{\textwidth}{c*{2}{>{\centering\arraybackslash}X}@{}}
\multirow{2}{*}{\includegraphics[width=1cm,height=8cm]{example-image}}
& \begin{subfigure}{\hsize}
\caption*{k-$\varepsilon$ RNG}
\includegraphics[width=\hsize,height=8cm]{example-image}
\medskip
\end{subfigure}
& \begin{subfigure}{\hsize}
\caption*{k-$\varepsilon$ Realizable}
\includegraphics[width=\hsize,height=8cm]{example-image}
\medskip
\end{subfigure}
\\
& \begin{subfigure}{\hsize}
\caption*{k-$\omega$ SST}
\includegraphics[width=\hsize,height=8cm]{example-image}
\end{subfigure}
& \begin{subfigure}{\hsize}
\caption*{LES}
\includegraphics[width=\hsize,height=8cm]{example-image}
\end{subfigure}
\end{tabularx}
\end{table}
\end{document}
我得到:
对于保留纵横比的图片尺寸,您只需要确定图片的宽度,即:\includegraphics[width=\hsize]{<real picture>}
答案2
不需要\multirow
:这是两个不同的表。请注意,该[H]
选项通常是不好的;在这种情况下,它完全没用,因为无论如何这都会是一个页面浮动。
\documentclass[11pt]{article}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{showframe} % for demo
\begin{document}
\begin{table}
\centering
\begin{tabular}{@{}c@{}}% for centering
\includegraphics[width=0.1\textwidth,height=8cm]{example-image-9x16}
\end{tabular}
\begin{tabular}{@{}cc@{}}
\begin{subfigure}{0.4\textwidth}
\caption*{k-$\varepsilon$ RNG}
\includegraphics[width=\textwidth,height=8cm]{example-image-9x16}
\end{subfigure}
&
\begin{subfigure}{0.4\textwidth}
\caption*{k-$\varepsilon$ Realizable}
\includegraphics[width=\textwidth,height=8cm]{example-image-9x16}
\end{subfigure}
\\
\\
\begin{subfigure}{0.4\textwidth}
\caption*{k-$\omega$ SST}
\includegraphics[width=\textwidth,height=8cm]{example-image-9x16}
\end{subfigure}
&
\begin{subfigure}{0.4\textwidth}
\caption*{LES}
\includegraphics[width=\textwidth,height=8cm]{example-image-9x16}
\end{subfigure}
\end{tabular}
\end{table}
\end{document}
我添加它height=8cm
只是为了扭曲可用的图像并使它们与您的图像相似;当然您不会添加它。