I'm very new to this site and just about as new to LaTeX. The question is simple: how do I get some text to appear above a node rather than inside of it? For example, I used this tikz stuff to make a cyclic graph:
\begin{figure}
\centering
\begin{tikzpicture}[scale=.7, every node/.style={circle,fill=blue!20}]
\node (n1) at (0,0) {1};
\node (n2) at (3,0) {2};
\node (n3) at (1.5,3) {3};
\draw (n1) -- (n2) -- (n3) -- (n1);
\end{tikzpicture}
\end{figure}
My attempts thus far have brought me to this:
\begin{figure}[h]
\centering
\begin{tikzpicture}
\filldraw [blue!20] (.5,0) circle (8pt);
\node (n1) at (.2,.5) {$x$};
\filldraw [blue!20] (3.5,0) circle (8pt);
\node (n2) at (3.75,.4) {$x-1$};
\filldraw [blue!20] (1.75,3) circle (8pt);
\node (n3) at (1.75,3.5) {$x-2$};
\draw (.5,0) -- (3.5,0) -- (1.75,3) -- (.5,0);
\end{tikzpicture}
\end{figure}
However, I don't like the use of \filldraw
directive for the "nodes" as much as the \node
directive. I copy/pasted from some website the stuff I started using tikz and so I'm not sure how to take the "globally applied" properties/settings and make them applicable to just a single node. I tried a few things, but this didn't help.
What I'm after is, basically, the effect of the second drawing. However, I'd like it to be better polished.
Thanks,
Andy
\documentclass{...}
and so on. My answer shows how such an MWE can look.