What is the best way to place a label in the middle of a line with TikZ? I mean smack dab in the middle of the line, not above or below it. The following is close
\begin{tikzpicture}
\draw[|->, color=red] (-4cm, 0.5cm) -- (2.5cm, 0.5cm) node[midway, color=black] {$\tau_{r}$};
\end{tikzpicture}
But the line crosses right through the node and its text, which is bad.
I don't know if there is an option to choose the background color of a node, which I think would solve the problem (e.g. background=white). fill doesn't seem to work.


fill=white, but I added it beforecolor=black. This resulted in the whole box being black. Does order of commands actually matter in TikZ? – Tianxiang Xiong Apr 20 '12 at 07:34color=blackthen that is a meta-command which sets all colours to black: line colour, fill colour, and text colour. If you want to override any of those then you have to reset it afterwards. – Andrew Stacey Apr 20 '12 at 07:36fill“the area enclosed by the path is filled with the current filling color, which is either the last color set using the generalcolor=option or the optional color⟨color⟩.” (p. 161) So in you case the last set color wins and overwrites the setting offill. – Tobi Apr 20 '12 at 07:382+3 = 3+2ought to be surprising - the fact that it isn't is merely because we're so familiar with it that we don't notice the oddity. But almost everywhere else, order matters. In Norway there is a children's song which translates roughly to: "Open window, look out - hello weather, how are you?". Imagine the difference if you first put your head out of the window and then opened it.) – Andrew Stacey Apr 20 '12 at 07:39