1

I would like to have my text "DFS-Baum" on the same line as "Graph", so in the vertical center of the graph that is following. At the moment they are on different lines and it doesn't look very ordered. My code:

\documentclass[a4paper, 11pt]{article}
\usepackage{comment} % enables the use of multi-line comments (\ifx \fi) 
\usepackage{fullpage} % changes the margin
\usepackage[swedish]{babel}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usepackage{tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\usepackage{amsmath}
\usepackage{fancyhdr}
\usetikzlibrary{positioning}
\usepackage{titlesec}
\titleformat{\subsection}[runin]{}{}{}{}[]
\usepackage{libertine}
\colorlet{Lila}{Orchid!70!}

\begin{document}
\begin{tabular}{ll}
\begin{tikzpicture}
         > = stealth, % arrow head style
        shorten > = 1pt, % don't touch arrow head to node
        auto,
        node distance = 4cm, % distance between nodes
        semithick % line style
    ]

    \tikzstyle{every state}=[
        draw = black,
        thin,
        fill = Lila!50!,
        minimum size = 10mm
    ]
 \begin{scope}[node distance=1cm and 0cm, every node/.style=state]

    \node (a) {$v$};
    \node (b)[below right= of a] {$u$};
    \node (c)[below left= of a] {$w$};
    \end{scope}

    \path[->,thick] (a) edge node {} (b);
    \path[->,thick] (b) edge node {} (c);
    \path[->,thick] (c) edge node {} (a);


    \end{tikzpicture} ~~~~ &

DFS Baum: 
\begin{tikzpicture}
         > = stealth, % arrow head style
        shorten > = 1pt, % don't touch arrow head to node
        auto,
        node distance = 4cm, % distance between nodes
        semithick % line style
    ]

    \tikzstyle{every state}=[
        draw = black,
        thin,
        fill = Lila!50!,
        minimum size = 10mm
    ]
 \begin{scope}[node distance=1cm and 0cm, every node/.style=state]

    \node (a) {$v$};
    \node (b)[below left= of a] {$u$};
    \node (c)[below left= of b] {$w$};
    \end{scope}

    \path[->,thick] (a) edge node {} (b);
    \path[->,thick] (b) edge node {} (c);
    \path[->,thick][bend left=45, magenta, very thick] (c) edge node {} (a);


    \end{tikzpicture} \\
    \end{tabular}   
\end{document}

enter image description here Thanks in advance!

Cherry
  • 195
  • 1
    You need to set the baseline for the tikzpicture, see e.g. https://tex.stackexchange.com/questions/75194/align-an-equation-and-a-tikz-picture-with-anchor-and-baseline/75199#75199 – Torbjørn T. Oct 22 '17 at 16:15
  • Seeing as you haven't said anything, I assume that question solved your problem, so I closed as duplicate. Let me know if you're still wondering about this, and we can reopen. – Torbjørn T. Oct 24 '17 at 12:23

0 Answers0