# sign scheme diagram in latex

I tried to draw a following diagram using tikz.

I used the following commands

\draw [black, very thick] (0,0) -- (9,0);

\draw [black, very thick] (3,1/4) -- (3, -1/4);

\draw [black, very thick] (6,1/4) -- (6, -1/4);


But I don't know how to how to write numerical values at desired place and how to write +/- sign at desired place.

Please tell me how to do it?

## 1 Answer

I make a bit change in your coordinates so that the figure fits better with your document. If it is not good, just change the coordinates in the code.

You can simply add strings to a TikZ picture by a simple \draw command:

\draw (<x>,<y>) node {<string>};


Some option can be added, for example

\draw (<x>,<y>) node[left=0.5cm] {<string>};


For example, this is your diagram:

\documentclass[tikz, border=3mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw (0,0) -- (6,0);
\draw (2,-0.1) -- (2,0.1);
\draw (4,-0.1) -- (4,0.1);
\draw (2,0) node[below=1ex] {$-3$};
\draw (4,0) node[below=1ex] {$-6$};
\begin{scope}[red] % For local settings -- thanks to @marmot's comment
\draw (1,0) node[above] {$+$};
\draw (3,0) node[above] {$-$};
\draw (5,0) node[above] {$+$};
\end{scope}
\end{tikzpicture}
\end{document}


• To add strings to a TikZ picture, there is no need to use the\draw command, \node is enough. – AndréC Jan 8 at 4:57
• @AndréC Yes. However, I think \draw command is more basic than \node (at least to me), and as the OP shows that he/she doesn't know how to add text, I decide to show her the simplest way. – JouleV Jan 8 at 5:02
• Your answer induces a false representation of how TikZ works because you confuse the picture with the path. – AndréC Jan 8 at 5:10
• @AndréC I disagree with you, it's only one different way of doing things, absolutely correct. – CarLaTeX Jan 8 at 5:40
• @AndréC Is there really a need to fight over this syntactic decision? It's a simple picture and JouleV shows one possible way (out of potentially \inf :)) to achieve the desired result (in his free time for zero money without any warranty). – Dr. Manuel Kuehner Jan 8 at 9:21