Tell me more ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

So I am making Digraphs in tikz and want to put infinity as edge label but im getting an error. I got no error when i set the label under the vertices to infinity.

\documentclass[a4paper,11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{listingsutf8}
\usepackage{multicol}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage[retainorgcmds]{IEEEtrantools}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning,fit,matrix} 
\usepackage{wasysym}
\usepackage{float}



\usepackage{listings,relsize} 
\lstloadlanguages{R} 
\lstset{language=R,basicstyle=\smaller[1],
commentstyle=\rmfamily\smaller, showstringspaces=false,breaklines=true} 
\lstset{escapeinside={(*}{*)}} 

\begin{document}
\tikzstyle{vertex}=[circle,fill=black!25,minimum size=15pt,inner sep=0pt] 
\tikzstyle{selectedvertex} = [vertex, fill=red!24] 
\tikzstyle{edge} = [draw,thick,-] 
\tikzstyle{arc}= [draw,thick,->,shorten >=1pt,>=stealth'] 
\tikzstyle{arcl} = [draw,thick,->,shorten>=1pt,>=stealth',bend left=25] 
\tikzstyle{arcr} = [draw,thick,->,shorten >=1pt,>=stealth']
\tikzstyle{rpath}=[draw, thick,->,shorten >=1pt,>=stealth',red, opacity=0.4]
\tikzstyle{weight} = [font=\small] 
\tikzstyle{selected edge} = [draw,line width=5pt,-,red!50]
\tikzstyle{ignored edge} = [draw,line width=5pt,-,black!20] 
\newcommand*{\vpointer}{\vcenter{\hbox{\scalebox{2}{\Huge\pointer}}}}
\def\Arrow{\raisebox{3\height}{\scalebox{3}{$\Rightarrow$}}}


\begin{figure} [H]
    \begin{tikzpicture}[width=0.3\textwidth, auto,swap] 
      % First we draw the vertices  
        \foreach \pos/\name/\weight in
    {{(0,1)/s/-2},
    {(1,4)/1/1},
    {(4.5,4)/2/-1},
    {(4,0)/3/2},
    {(5,1.5)/t/0},
    {(2.5,0)/s'/-$\infty$},
    {(0.5,6)/t'/0}}
            \node[vertex,label=below:\weight] (\name) at \pos {$\name$};
        % Connect vertices with edges and draw weights
        \foreach \source/ \dest /\weight in { 
s/1/2, 1/2/2,1/3/2,2/3/3, 3/t/3 , t/s/$\infty$, s/t'/2,2/t'/1,s'/1/1,s'/3/2
      }
    \path[arcr] (\source) -- node[weight] {$\weight$} (\dest); 
\end{tikzpicture} 
\end{figure}

The first -$\infty$ works fine but at the line with the edges the infinity won't work. I get the error at the line with \path[arcr] and I don't know how to copi paste the error from kile :S.

It does show the infinity sign as wanted but right behind it it writes "pgf@stop"

Hope you can help : )

share|improve this question
nvm. Found the error to be the $ signs. Guess it get doublicated since weight is displayed inside $ signs. – Bo Stentebjerg Sep 27 '12 at 9:17
2  
Hi Bo, welcome to the site! Could you turn that code snippet into a full minimal example document, i.e. starting from \documentclass and including all required libraries and definitions? – Jake Sep 27 '12 at 9:17

closed as too localized by Jake, lockstep, diabonas, zeroth, Brent.Longborough Sep 27 '12 at 10:44

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.

Browse other questions tagged or ask your own question.