4
$$\begin{tikzpicture}[scale=3]
\node (A) at (1,0) {$0$};
\node (B) at (2,0) {$H^1(G/H,M^H)$};
\node (C) at (3,0) {$H^1(G,M)$};
\node (D) at (4,0) {$H^1(H,M)$};
\node (E) at (5,0) {$0$};
\path[->,font=\scriptsize,>=angle 90]
(A) edge node[above]{} (B)
(B) edge node[above]{$\phi$} (C)
(C) edge node[above]{$\psi$} (D)
(D) edge node[above]{} (E);
\end{tikzpicture}$$

How may I change the length of the arrows such that they all have the same length? I want to try and standardise the lengths of my arrows for the whole document if that is possible.

Also, I realised that if I used a smaller scale, i.e. scale=2, then because of the size of the terms $H^1(G/H,M^H)$, $H^1(G,M)$ and $H^1(H,M)$, they end up overlapping.

Haikal Yeo
  • 503
  • 3
  • 12

2 Answers2

4

The length of the arrows is determined by the distance between the terms.

You can use a single row matrix to position the terms with the same sep between them.

\documentclass{scrartcl}
\usepackage{tikz}
\usetikzlibrary{arrows,matrix}

\begin{document}
\[\begin{tikzpicture}
  \matrix(m)[
      matrix of math nodes,
      column sep=1cm% sep between columns
    ]{
    0 & H^1(G/H,M^H) & H^1(G,M) & H^1(H,M) & 0 \\};
% arrows:
  \foreach[count=\i,evaluate={\j=int(\i+1)}]\text in {{},$\phi$,$\psi$,{}}
    \path[-angle 90,font=\scriptsize](m-1-\i)edge node[above]{\text}(m-1-\j);
\end{tikzpicture}\]
\end{document}

enter image description here

Or you can use the graphs library (needs pgf/TikZ version 3.0):

\documentclass{scrartcl}
\usepackage{tikz}
\usetikzlibrary{arrows,graphs,quotes}
\tikzset{
  graphs/mathgraph/.style={
    math nodes,
    /tikz/>=angle 90,
    grow right sep=1cm,% sep between nodes
    edge={font=\scriptsize},
    fresh nodes
  }
}

\begin{document}
\[\tikz\graph[mathgraph]{0 -> "H^1(G/H,M^H)" ->["$\phi$"] "H^1(G,M)"->["$\psi$"]"H^1(H,M)" -> 0};\]

\end{document}

The result is the same as above.

esdd
  • 85,675
1

While for an exact sequence arrow with the same length may be preferable, this won't do for commutative diagrams. However, long arrows don't improve the appearance, in my opinion.

You can do it without TikZ:

\documentclass{article}
\newcommand{\lto}{\longrightarrow}
\begin{document}
This has long arrows
\[
0 \lto H^1(G/H,M^H) \lto H^1(G,M) \lto H^1(H,M) \lto 0
\]
and this has short ones, which I prefer,
\[
0 \to H^1(G/H,M^H) \to H^1(G,M) \to H^1(H,M) \to 0
\]
\end{document}

enter image description here

egreg
  • 1,121,712