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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use subfig to show an array of tikz figures. Unfortunately these figures are sometimes of different height, so they don't show up properly aligned:

enter image description here

I'd like to see all nodes on the same line. I'm new to TikZ, so I'm wondering if it is possible to give all figures a minimum height. I tried to set a bounding box using \useasboundingbox (0,0) rectangle (5,2); but it was difficult for me to estimate the correct values. Is there a way to calculate that, or is it possible to render an invisible phantom edge (with label) that gives the figure a) the same height as figure b)? Or is there a way to do the alignment on subfig's side?

Below is a MWE:


\tikzstyle{state}=[circle,thick,draw=black!75,fill=black!20,minimum size=6mm, text=black]


   \begin{tikzpicture}[node distance=2.8cm, bend angle=35,auto]
      \node [state] (v1) at (1,0) {$D$};
      \node [state] (v2) at (4,0) {$N$};
      \draw (v1) edge [<-, bend left] node {$M_\text{in}$} (v2);
   \begin{tikzpicture}[node distance=2.8cm, bend angle=35,auto]
      \node [state] (v1) at (1,0) {$D$};
      \node [state] (v2) at (4,0) {$N$};
      \draw (v1) edge [<-, bend left] node {$M_\text{in}$} (v2);
      \draw (v1) edge [->, bend right] node {$M_\text{out}$} (v2);

share|improve this question
A possible hack-ish solution which also requires a little bit of adjustment is adding baseline=1cm to the first tikzpicture options. I don't know too much about subfig but you can also consider subcaption package or using minipages :) See further vertical alignment with subfig and subcaption vs. subfig – percusse Dec 15 '11 at 13:35
up vote 15 down vote accepted

For each TikZ picture, set the baseline option and refer to the node you would like to use for the alignment:

share|improve this answer
Awesome, I didn't expect it to be so easy. Thanks! – vanto Dec 15 '11 at 14:01
Here baseline=(v1.base) because v1 and v2 are aligned vertically in each picture. – Alain Matthes Dec 15 '11 at 14:11

Your Answer


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.