我试图让两个子图对齐,即图像底部保持水平,子标题也保持水平。使用普通子图,我知道我可以使用 [t]。事实上,我使用 tikzpicture 放置轴标签,并使用微分作为标签,这会占用更多垂直空间,这似乎改变了这一点。我使用的代码来自为 LaTeX 图形添加轴标签添加轴标签和导数的“求值点”栏:\Bigr,\biggr,还是 \left...\right?进行差异评价。
这是我的代码:
\documentclass{article}
\usepackage{amsmath,mleftright}
\usepackage{xparse}
\usepackage{tikz}
\usepackage{graphicx}
\usetikzlibrary{positioning}
\NewDocumentCommand{\evalat}{sO{\big}mm}{%
\IfBooleanTF{#1}
{\mleft. #3 \mright|_{#4}}
{#3#2|_{#4}}%
}
\begin{document}
\begin{figure}[h!]
\centering
\begin{subfigure}[t]{0.47\textwidth}
\begin{tikzpicture}[t]
\node (img1) {\includegraphics[scale=0.5]{image1.png}};
\node[below=of img1, node distance=0cm, yshift=1cm] {Rise Time};
\node[left=of img1, node distance=0cm, rotate=90, anchor=center,yshift=-0.7cm] {Velocity};
\end{tikzpicture}
\caption{test1}
\label{fig:velrise}
\end{subfigure}
\begin{subfigure}[t]{0.47\textwidth}
\begin{tikzpicture}[t]
\node (img1) {\includegraphics[scale=0.5]{image2.png}};
\node[below=of img1, node distance=0cm, yshift=1cm] {$\evalat[\big]{\frac{dQ}{dt}}{\text{max}}$};
\node[left=of img1, node distance=0cm, rotate=90, anchor=center,yshift=-0.7cm] {Velocity};
\end{tikzpicture}
\caption{test}
\label{fig:dqdtrise}
\end{subfigure}
\caption{test3}
\label{fig:matrices}
\end{figure}
\end{document}
输入图像为:
答案1
像这样?
对于图像和子标题的对齐,简单的解决方案都包含在表格的自己的行中:
\documentclass{article}
\usepackage{amsmath,mleftright}
\usepackage{xparse}
\usepackage[demo]{graphicx}
\usepackage{tikz}
\usetikzlibrary{positioning}
\NewDocumentCommand{\evalat}{sO{\big}mm}{%
\IfBooleanTF{#1}
{\mleft. #3 \mright|_{#4}}
{#3#2|_{#4}}%
}
\usepackage{tabularx}
\usepackage{subcaption}
\begin{document}
\begin{figure}[htb]
\begin{tabularx}{\linewidth}{@{} *{2}{>{\raggedleft\arraybackslash}X} @{}}
\begin{tikzpicture}[baseline]
\node[label=below:Rise Time,
label=left:\rotatebox{90}{Velocity}]
{\includegraphics[width=0.85\linewidth]{image1.png}};
\end{tikzpicture} & \begin{tikzpicture}[baseline]
\node[label=below:{$\evalat[\big]{\frac{dQ}{dt}}{\max}$},
label=left:\rotatebox{90}{Velocity}]
{\includegraphics[width=0.85\linewidth]{image2.png}};
\end{tikzpicture} \\
%
\begin{subfigure}{\linewidth}
\caption{test 1}
\label{fig:velrise}
\end{subfigure} & \begin{subfigure}{\linewidth}
\caption{test 2}
\label{fig:dqdtrise}
\end{subfigure}
\end{tabularx}
\caption{test3}
\label{fig:matrices}
\end{figure}
- 你的姆韦我添加
subcaption
包后就可以工作了。 - 表格中的图像与选项对齐
baseline
(选项t
未知) - 我把图像旁边的文本作为标签写入包含图像的节点
答案2
像这样?你只需要调整节点的text height
和。text depth
\documentclass{article}
\usepackage{amsmath,mleftright}
\usepackage{subcaption}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{xparse}
\NewDocumentCommand{\evalat}{sO{\big}mm}{%
\IfBooleanTF{#1}
{\mleft. #3 \mright|_{#4}}
{#3#2|_{#4}}%
}
\begin{document}
\begin{figure}[h!]
\centering
\begin{subfigure}[t]{0.47\textwidth}
\begin{tikzpicture}
\node (img1) {\includegraphics[width=0.8\linewidth]{image1.png}};
\node[below=0em of img1,text height=2em,text depth=0.6em] {Rise Time};
\node[left=3em of img1,rotate=90,anchor=center,yshift=-0.7cm]
{Velocity};
\end{tikzpicture}
\caption{test1}
\label{fig:velrise}
\end{subfigure}\quad%
\begin{subfigure}[t]{0.47\textwidth}
\begin{tikzpicture}
\node (img1) {\includegraphics[width=0.8\linewidth]{image2.png}};
\node[below=0em of img1,text height=2em,text depth=0.6em]
{$\evalat[\big]{\frac{\mathrm{d}Q}{\mathrm{d}t}}{\text{max}}$};
\node[left=3em of img1, rotate=90, anchor=center,yshift=-0.7cm] {Velocity};
\end{tikzpicture}
\caption{test}
\label{fig:dqdtrise}
\end{subfigure}
\caption{test3}
\label{fig:matrices}
\end{figure}
\end{document}
答案3
\documentclass[a4paper]{article}
\usepackage{amsmath}
\usepackage{geometry}
\usepackage{graphicx}
\usepackage{subcaption}
\begin{document}
\begin{figure}[h!]
\begin{subfigure}{0.48\textwidth}\centering
\raisebox{0.4\linewidth}{\rotatebox{90}{Velocity}}\,
\includegraphics[width=0.9\linewidth]{/tmp/image1.png}
Rise Time\vphantom{$\displaystyle\frac{Q}{d}$}
\caption{test1}\label{fig:velrise}
\end{subfigure}\hfill
\begin{subfigure}{0.48\textwidth}\centering
\raisebox{0.4\linewidth}{\rotatebox{90}{Velocity}}\,
\includegraphics[width=0.9\linewidth]{/tmp/image2.png}
$\displaystyle\frac{dQ}{dt}\Big|_{\text{max}}$
\caption{test2}\label{fig:dqdtrise}
\end{subfigure}
\caption{test3}\label{fig:matrices}
\end{figure}
\end{document}