Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have two sublfoat that I would like to align from the horizontal coordinate line.

\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}

enter image description here

share|improve this question
    
Fix spelling of "potential" in the caption before you submit the paper? –  Ethan Bolker Oct 2 '13 at 14:13

1 Answer 1

up vote 5 down vote accepted

You can add the baseline option to both TikZ picture so that the vertical value y = 0 will be the baseline from both pictures. But this also displaces the captions, this can be avoided by adding a pseudo-node to the left picture where the right one has the V_rep node.

With the subcaption package, the same trick can be used.

Code (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}

Code (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}

Output

enter image description here

share|improve this answer
    
...carries the spelling error. –  Elements in Space Oct 2 '13 at 14:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.