[Tex/LaTex] Line is not perfectly horizontal in Commutative Diagram in Tikz

commutative-diagramstikz-pgf

I ran into an issue today, while rendering a simple diagram with Tikz. The horizontal line in the following picture is ever so slightly lower on the right hand side than on its left.
Commutative Diagram

Adding a subscript to the \mathbb B on the left didn't change this behavior – neither did omitting the label h_j on the top.

Here is a minimal working code for this diagram:

\documentclass{article}
\usepackage{amssymb}
\usepackage{tikz}
\usetikzlibrary{matrix}

\begin{document}
\begin{center}
\begin{tikzpicture}
\matrix (m) 
[matrix of math nodes,row sep=4em,column sep=4em,minimum width=2em] 
{
\mathbb B & \mathbb B_{j} \\
          & \mathbb B_{i} \\ 
}; 
\path[-stealth] 
(m-1-1) edge node [above] {$h_{j}$} (m-1-2)
        edge node [below] {$h_{i}$} (m-2-2)
(m-1-2) edge node [right] {$h_{\mathbb B_{i}, \mathbb B_{j}}$} (m-2-2);
\end{tikzpicture}
\end{center}
\end{document}

Is this a known issue and does anyone know how to fix it?

Best Answer

The \mathbb{B}_j on the right is deeper than the \mathbb{B} on the left, that is why the line is lower on the right. You can just add a \vphantom{_j} to the node on the left to compensate for this.

\documentclass[border=2pt,tikz]{standalone}
\usetikzlibrary{matrix}
\usepackage{amssymb}
\begin{document} 

\begin{tikzpicture}
\matrix (m) 
[matrix of math nodes,row sep=4em,column sep=4em,minimum width=2em] 
{
\mathbb{B}\vphantom{_j} & \mathbb{B}_j \\
          & \mathbb B_{i} \\ 
}; 
\path[-stealth] 
(m-1-1) edge node [above] {$h_{j}$} (m-1-2)
        edge node [below] {$h_{i}$} (m-2-2)
(m-1-2) edge node [right] {$h_{\mathbb B_{i}, \mathbb B_{j}}$} (m-2-2);
\end{tikzpicture}

\end{document}

enter image description here

Also with node positioning instead of \matrix can look nicer:

\documentclass[border=2pt,tikz]{standalone}
\usetikzlibrary{positioning}
\usepackage{amssymb}
\begin{document}

\begin{tikzpicture}[node distance=1.5cm]
\node (b) {$\mathbb{B}$};
\node[right=of b]  (bj) {$\mathbb{B}_j$};
\node[below=of bj] (bi) {$\mathbb{B}_i$};   

\path[-stealth] 
    (b)  edge node [above] {$h_{j}$} (bj)
         edge node [below] {$h_{i}$} (bi)
    (bj) edge node [right] {$h_{\mathbb B_{i}, \mathbb B_{j}}$} (bi);
\end{tikzpicture}

\end{document}

enter image description here