2

I'm trying to use TikZ to place the 'c' in this graph in the centre of the triangle spanned by 'a','b',d'. Is there an easy way to do this, or should I be trying to use tikzpicture for this purpose?

$$\begin{tikzcd}[column sep=small]  a \arrow[dash]{dr} \arrow[dash]{dd} \arrow[dash]{drr}& & \\
    & c \arrow[dash]{r}& d  \\
    b \arrow[dash]{ur} \arrow[dash]{urr}&&
    \end{tikzcd}$$
Bobyandbob
  • 4,899

1 Answers1

2

What about inserting one extra column between c and d?

\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-cd}
\begin{document}
$$\begin{tikzcd}[column sep=small]  
 a \arrow[dash]{dr} \arrow[dash]{dd} \arrow[dash]{drrr} & & \\
             & c \arrow[dash]{rr} & & d  \\
 b \arrow[dash]{ur} \arrow[dash]{urrr}&&
 \end{tikzcd}$$
\end{document}

However, this is not an equilateral triangle, nor c is at the true center. For this case I would prefer to use a tikzpicture:

\begin{tikzpicture}
    \node (c) {$c$};
    \foreach \angle/\name in {0/d,120/a,240/b}
      \node (\name) at (\angle:1) {$\name$};
    \draw (a) -- (d) -- (b) -- (a);
    \foreach \name in {a,b,d} \draw (c) -- (\name);
\end{tikzpicture}

Compare the three versions:

Comparison

If (a) and (b) are not required to be vertically aligned, I would prefer to make horizontal the edge (b)--(d), which gives a better optical impression of (c) being at center:

rotated triangle

This can be easily achieved by changing the angles in the tikzpicture version:

\begin{tikzpicture}
    \node (c) {$c$};
    \foreach \angle/\name in {-30/d,90/a,210/b}
      \node (\name) at (\angle:1) {$\name$};
    \draw (a) -- (d) -- (b) -- (a);
    \foreach \name in {a,b,d} \draw (c) -- (\name);
\end{tikzpicture}
JLDiaz
  • 55,732