我有两个 sublfoat,我想从水平坐标线对齐。
\documentclass{article}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{subfig}
\begin{document}
\begin{figure}
\centering
\subfloat[Using the electrode as einzel lens.]{
\begin{tikzpicture}
\draw[->] (-0.25,0) -- (3.5,0) node[below left] {$z$};
\draw[->] (0,-0.25) -- (0,3.5) node[below left] {$V$};
\draw (0, 3.0) node[above right] {$V_p$} -- ++(0.35, 0) -- ++(1.25, -3.0) -- ++(0.25, 0) -- ++(0.15, 0.75) node[above] {$V_{\text{ein}}$} -- ++(0.30, 0) -- ++(0.15, -0.750);
\end{tikzpicture}
}
\quad
\subfloat[Using the electrode as repeller.]{
\begin{tikzpicture}
\draw[->] (-0.25,0) -- (3.5,0) node[below left] {$z$};
\draw[->] (0,-0.25) -- (0,3.5) node[below left] {$V$};
\draw (0, 3.0) node[above right] {$V_p$} -- ++(0.35, 0) -- ++(1.25, -3.0) -- ++(0.25, 0) -- ++(0.15, -.75) node[below] {$V_{\text{rep}}$} -- ++(0.30, 0) -- ++(0.15, 0.750);
\end{tikzpicture}
}
\caption{Potentail diagram of the extraction.}
\label{fig:potential}
\end{figure}
\end{document}
答案1
您可以将baseline
选项添加到 TikZ 图片,以便垂直值是= 0 将成为两张图片的基线。但这也会取代标题,可以通过在左图中右图有节点的位置添加伪节点来避免这种情况V_rep
。
有了subcaption
包,就可以使用同样的技巧。
代码 (subfig
)
\documentclass{article}
\usepackage{tikz,amsmath}
\usepackage{subfig}
\begin{document}
\begin{figure}\centering
\subfloat[Using the electrode as einzel lens.]{
\begin{tikzpicture}[baseline]
\draw[->] (-0.25,0) -- (3.5,0) node[below left] {$z$};
\draw[->] (0,-0.25) -- (0,3.5) node[below left] {$V$};
\draw (0, 3.0) node[above right] {$V_p$} -- ++(0.35, 0) -- ++(1.25, -3.0) -- ++(0.25, 0) -- ++(0.15, 0.75) node[above] {$V_{\text{ein}}$} -- ++(0.30, 0) -- ++(0.15, -0.750);
\end{tikzpicture}}\quad
\subfloat[Using the electrode as repeller.]{
\begin{tikzpicture}[baseline]
\draw[->] (-0.25,0) -- (3.5,0) node[below left] {$z$};
\draw[->] (0,-0.25) -- (0,3.5) node[below left] {$V$};
\draw (0, 3.0) node[above right] {$V_p$} -- ++(0.35, 0) -- ++(1.25, -3.0) -- ++(0.25, 0) -- ++(0.15, -.75) node[below] {$V_{\text{rep}}$} -- ++(0.30, 0) -- ++(0.15, 0.750);
\end{tikzpicture}}
\caption{Potentail diagram of the extraction.}
\end{figure}
\begin{figure}\centering
\subfloat[Using the electrode as einzel lens.]{
\begin{tikzpicture}
\draw[->] (-0.25,0) -- (3.5,0) node[below left] {$z$};
\draw[->] (0,-0.25) -- (0,3.5) node[below left] {$V$};
\draw (0, 3.0) node[above right] {$V_p$} -- ++(0.35, 0) -- ++(1.25, -3.0) -- ++(0.25, 0) -- ++(0.15, 0.75) node[above] {$V_{\text{ein}}$} -- ++(0.30, 0) -- ++(0.15, -0.750);
\path (0,-.75) node[below,opacity=0] {$V_{\text{rep}}$}; % <- Pseudonode
\end{tikzpicture}}\quad
\subfloat[Using the electrode as repeller.]{
\begin{tikzpicture}
\draw[->] (-0.25,0) -- (3.5,0) node[below left] {$z$};
\draw[->] (0,-0.25) -- (0,3.5) node[below left] {$V$};
\draw (0, 3.0) node[above right] {$V_p$} -- ++(0.35, 0) -- ++(1.25, -3.0) -- ++(0.25, 0) -- ++(0.15, -.75) node[below] {$V_{\text{rep}}$} -- ++(0.30, 0) -- ++(0.15, 0.750);
\end{tikzpicture}}
\caption{Potentail diagram of the extraction.}
\end{figure}
\end{document}
代码 (subcaption
)
\documentclass{article}
\usepackage{tikz,amsmath}
\usepackage{subcaption}
\begin{document}
\begin{figure}\centering
\subcaptionbox{Using the electrode as einzel lens.}{
\begin{tikzpicture}
\draw[->] (-0.25,0) -- (3.5,0) node[below left] {$z$};
\draw[->] (0,-0.25) -- (0,3.5) node[below left] {$V$};
\draw (0, 3.0) node[above right] {$V_p$} -- ++(0.35, 0) -- ++(1.25, -3.0) -- ++(0.25, 0) -- ++(0.15, 0.75) node[above] {$V_{\text{ein}}$} -- ++(0.30, 0) -- ++(0.15, -0.750);
\path (0,-.75) node[below,opacity=0] {$V_{\text{rep}}$}; % <- Pseudonode
\end{tikzpicture}}\quad
\subcaptionbox{Using the electrode as repeller.}{
\begin{tikzpicture}
\draw[->] (-0.25,0) -- (3.5,0) node[below left] {$z$};
\draw[->] (0,-0.25) -- (0,3.5) node[below left] {$V$};
\draw (0, 3.0) node[above right] {$V_p$} -- ++(0.35, 0) -- ++(1.25, -3.0) -- ++(0.25, 0) -- ++(0.15, -.75) node[below] {$V_{\text{rep}}$} -- ++(0.30, 0) -- ++(0.15, 0.750);
\end{tikzpicture}}
\caption{Potentail diagram of the extraction.}
\label{fig:potential}
\end{figure}
\end{document}
输出
答案2
我在较小的图像上添加了一个白色(不可见)网格以增加其高度:
\begin{tikzpicture}
%Grid
\draw[white] (x1,y1) grid (x2,y2);
---
\begin{tikzpicture}