# Label text alignment in tkz-euclide

I'm having a bit of difficulty with the alignment of point labels in tkz-euclide. For (a simple) example:

\documentclass{article}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\noindent
\begin{tikzpicture}
\tkzInit[ymin=0,ymax=2,xmin=0,xmax=5]
\tkzClip
\tkzDefPoint(1,1){a}
\tkzDefPoint(2,1){g}
\tkzDefPoint(3,1){k}
\tkzDefPoint(4,1){d}
\tkzDrawPoints(a,g,k,d)
\tkzDrawSegments(a,g g,k k,d)
\tkzLabelPoints[below=6pt](a,g,k,d)
\end{tikzpicture}\\
\end{document}​


gives me this (the red lines, added afterwards, illustrate):

Please suggest a way to fix this. I would much prefer something automatic, so I don't have to tune things like [below=5.283pt] by hand.

Note: I have assumed this is tkz-euclide, but this may be a tikz problem. Whatever -- I've tagged both. (And, of course, as usual, it turns out to be a problem between the keyboard and the chair.)

\tikzset{place above/.append style={anchor=base,yshift=6pt}}
\tikzset{place below/.append style={anchor=base,yshift=-12pt}}
...
\tkzLabelPoints[place above](a,g,k,d)
\tkzLabelPoints[place below](a,g,k,d)


(of course, the numbers may vary -- I'll relativise it later). The result:

Great package!!!

-
Try adding anchor=base to \tkzLabelPoints options. –  Luigi Oct 23 '12 at 8:33
@Luigi : Thank you. As you probably saw from Alain's answer, I also had to change above/below to yshift. –  Brent.Longborough Oct 23 '12 at 9:41

Not exactly a problem with tkz-euclide. With this version of tkz-euclide you can use all the options of tikz.

The definition of \tkzLabelPoints is

\tikzset{label style/.style={\tkz@euc@pointpos,\tkz@euc@labelcolor,font=\normalsize}}
\def\tkzLabelPoint{\pgfutil@ifnextchar[{\tkz@LabelPoint}{\tkz@LabelPoint[]}}
\def\tkz@LabelPoint[#1](#2)#3{\node[label style,#1] at (#2) {#3};}%

\def\tkzLabelPoints{\pgfutil@ifnextchar[{\tkz@LabelPoints}{%
\tkz@LabelPoints[]}}%
\def\tkz@LabelPoints[#1](#2){%
\foreach \point in {#2}{
\node[label style,#1] at (\point) {$\point$};}
}%


So you can modify label style or add your options in #1( this is the argument of \tkzLabelPoints) and you can use both possibilities like below ...

\documentclass{article}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\noindent
\begin{tikzpicture}
\tkzInit[ymin=0,ymax=2,xmin=0,xmax=5]
\tkzClip
\tkzDefPoint(1,1){a}
\tkzDefPoint(2,1){g}
\tkzDefPoint(3,1){k}
\tkzDefPoint(4,1){d}
\tkzDrawPoints(a,g,k,d)
\tkzDrawSegments(a,g g,k k,d)
\tikzset{label style/.append style={anchor=base}}
\tkzLabelPoints[yshift=-16pt](a,g,k,d)
\end{tikzpicture}
\end{document}​


-
Alain, merci beaucoup pour votre réponse, et, aussi, pour tkz-euclide. –  Brent.Longborough Oct 23 '12 at 9:18