You can use \node
s to place text everywhere you want. The are by default centered at the given coordinate which can be changed using the anchor
and other options.
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[step=0.5cm,color=gray] (-1,-1) grid (1,1);
\node at (-0.75,+0.75) {A};
\node at (-0.25,+0.75) {B};
\node at (+0.25,+0.75) {C};
\node at (+0.75,+0.75) {D};
\node at (-0.75,+0.25) {E};
\node at (-0.25,+0.25) {F};
\node at (+0.25,+0.25) {G};
\node at (+0.75,+0.25) {H};
% ...
\node at (+0.75,-0.75) {Q};
\end{tikzpicture}
\end{document}
Or using a loop:
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[step=0.5cm,color=gray] (-1,-1) grid (1,1);
\newcounter{mycount}
\setcounter{mycount}{`A}
\foreach \y in {+0.75,+0.25,-0.25,-0.75}
\foreach \x in {-0.75,-0.25,0.25,0.75}
\node at (\x,\y) {\char\value{mycount}\addtocounter{mycount}{1}};
\end{tikzpicture}%
% Or
\begin{tikzpicture}
\draw[step=0.5cm,color=gray] (-1,-1) grid (1,1);
\foreach \x/\y/\m in {+0.75/+0.75/A,-0.75/-0.75/X} % etc
\node at (\x,\y) {\m};
\end{tikzpicture}%
\end{document}
You can scale the image in the X or Y direction using xscale=<number>
and yscale=<number>
, respectively. Both are scaled with scale=<number>
.
If you mean with "absolute position" a fixed position on a page you can do this by drawing it relative to the special current page
node (needs the remember picture,overlay
option on the picture). If you give more specific information about this I can make an example.
The scopes
library introduces the shorthand { [options] <...> }
for the longer \begin{scope}[options] <...> \end{scope}
. Apparently, this shorthand does not work perfectly though: If you use the conventional \begin{scope}
notation, your example works:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{chains}
\begin{document}
\begin{tikzpicture}[node distance=2mm,
every node/.style={shape=rectangle,minimum size=1cm},
,start chain=values going below]
\foreach \m in {0,...,6}
{
\node[on chain] {\m};
\ifnum\m=3
\begin{scope}[start branch=stuff going right]
\node[on chain] {A};
\end{scope}
\fi
}
\end{tikzpicture}
\end{document}
Best Answer
In the pgfmanual it says on p. 145 that
In this case, you will have to subtract an epsilon, i.e. a very small value, from the corner point. Something like
will work without any visible artefacts.