# [pstricks] Labels on x-axis

Herbert Voss LaTeX at zedat.fu-berlin.de
Mon Mar 12 17:19:19 CET 2007

Martin Chicoine schrieb:
> I created the < \psxpoint > command to put labels at arbitrary positions on
> the x-axis. It works ok but I have to add the factor 1.84ex in order to
> align the label. So if I change font or something else, it doesn't align
> well anymore. What parameter should I put there instead?
>
>
you have to use the [t] option for \rput. However, with \rput(! ...
you do not need to define a new length.

\documentclass{article}

\makeatletter
\newcommand{\psxpoint}[2]{%
\psline[linewidth=.5pt]{-}(#1,\pst at xticksizeB)(#1,\pst at xticksizeA)
\rput[t](! #1 \pst at number\pslabelsep \pst at number\pst at xticksizeB add
\pst at number\psyunit div neg ){#2}}
\makeatother
\begin{document}

\begin{psgraph}[arrows=->](0,0)(-1,-2)(4,2){.5\textwidth}{!}
\psplot[algebraic]{0}{4}{sin(x)}
\psxpoint{1.5}{$2x_0$}
\end{psgraph}

\end{document}

Herbert