4

I am having trouble using TiKz to draw a correct picture. Here is how I started it out:

\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{arrows}

\begin{document}

\tikzset{->-/.style={decoration={
  markings,
  mark=at position #1 with {\arrow{<}}},postaction={decorate}}}

\begin{tikzpicture}
% a straight line segment
\draw[latex-] (-2,0) -- (0,0);
\draw[->-=.3] (0,0) -- (1,0);
\draw[->-=.6] (0,0) -- (1,0);
\draw[-latex] (1,0) -- (2,0);
% the ticks and their labels
\foreach \x  in {-1,...,1}
  \draw[xshift=\x cm] (0pt,2pt) -- (0pt,-1pt) node[below,fill=white] {\the\numexpr\x +1\relax};
\end{tikzpicture}

\end{document}

But I want my picture to look like this:

enter image description here

How do I make the numbers appear correctly, and also make the curved arrows?

4

Like this?

enter image description here

\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{arrows}

\begin{document}

\tikzset{->-/.style={decoration={
  markings,
  mark=at position #1 with {\arrow{>}}},postaction={decorate}}}

\begin{tikzpicture}
% a straight line segment
\draw[latex-] (-2,0) -- (0,0);
\draw[->-=.3] (0,0) -- (1,0);
\draw[->-=.6] (0,0) -- (1,0);
\draw[-latex] (1,0) -- (2,0);
% the ticks and their labels
\foreach \x [count=\i start from 0] in {-1,...,1}
  \draw[xshift=\x cm] (0pt,2pt) -- (0pt,-1pt) node[below,fill=white] (\i) {\x};

\draw[->] (2) to [out=-95, in=-85] (0);
\draw[<-] (.25mm,1mm) arc(-85:265:3mm);
\end{tikzpicture}

\end{document}
  • 1
    @ᴇʏᴇs I've updated the answer. You just need {\x} as node contents. \x cannot be used as node names because they are considered real values, and I've used \i which is an integer. But there is no problem using in nodes contents. – Ignasi May 15 '15 at 15:48

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.