2

I have a TikZ picture:

\begin{tikzpicture}
  \matrix (m) [matrix of math nodes,row sep=0em,column sep=3em,minimum width=2em] {
     E_1 & H^+ \\
     E_1^\perp & H^- \\
     &\R^{2m}\backslash\left\{H^+\cap H^-\right\}\\};
  \path[-stealth]
    (m-1-1) edge (m-1-2)
    (m-2-1) edge (m-2-2)
            edge (m-1-2)
            edge (m-3-2);
\end{tikzpicture}

So far so good. It looks like this:

enter image description here

Two questions:

  1. How can I align the the right nodes horizontally to the left, so that the left side of the right nodes is on one vertical line?
  2. How can I align the right or left nodes vertically, so that the two horizontal arrows are exactly horizontal? Right now they are a little tilted.
  • While code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. This is especially important for tikz as there are numerous libraries. – Peter Grill Jan 13 '16 at 11:04
3

By default a matrix of nodes anchors (place and align) nodes on their baseline, but you can change it fixing a new anchor point:

\documentclass[tikz,border=2mm]{standalone}

\usetikzlibrary{matrix}
\usepackage{amsmath}

\begin{document}

\begin{tikzpicture}
  \matrix (m) [matrix of math nodes,row sep=0em,column sep=3em,minimum width=2em, nodes={anchor=west}] {
     E_1 & H^+ \\
     E_1^\perp & H^- \\
     &R^{2m}\backslash\left\{H^+\cap H^-\right\}\\};
  \path[-stealth]
    (m-1-1) edge (m-1-2)
    (m-2-1) edge (m-2-2)
            edge (m-1-2)
            edge (m-3-2);
\end{tikzpicture}
\end{document}

enter image description here

| improve this answer | |
  • But now the lowest arrow doesn't end in the middle of the right element's side. How to correct this? – Rob Jan 13 '16 at 13:02
  • 1
    @Rob edge (m-3-2) finishes the line at node's center but stops drawing it a node's hidden border. Same happens with line going to H+ from second line. A possible solution could be edge (m-3-2.west) which will finish at central point on node's west border. – Ignasi Jan 13 '16 at 14:53
4

A version with tikz-cd; only a small adjustment needs to be made for an arrow.

\documentclass{article}
\usepackage{amssymb}
\usepackage{tikz-cd}

\begin{document}

\begin{tikzcd}[
  cells={nodes={anchor=west}},
  end anchor={west},
  row sep=1ex,
  column sep=large,
]
E_1 \arrow[r] & H^+ \\
E_1^\perp
  \arrow[ru,end anchor=south west]
  \arrow[r]
  \arrow[rd] & H^- \\
& \mathbb{R}^{2m}\setminus (H^+\cap H^-)
\end{tikzcd}

\end{document}

enter image description here

| improve this answer | |
0

Here's a minimal version using tikz-cd package.

Output

enter image description here

Code

\documentclass[letterpaper,11pt,reqno]{amsart}
\usepackage{tikz-cd}

\begin{document}
\[\begin{tikzcd}[row sep=2mm, column sep=1.5cm, cells={anchor=west}]
    E_1 \arrow[r]   & H^+ \\
    E_1^\perp \arrow[ur]\arrow[r]\arrow[dr, end anchor={west}] & H^- \\
    & \mathbb{R}^{2m} \setminus\left\{H^+\cap H^-\right\}\ \\
\end{tikzcd}\]
\end{document}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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