[pstricks] Labels on x-axis

Martin Chicoine martin.chicoine at umontreal.ca
Mon Mar 12 15:34:46 CET 2007


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?

 

\documentclass{article}

\usepackage{mathptmx,pstricks-add}

 

\makeatletter

  \newlength{\labelpos}

  \setlength{\labelpos}{\pst at xticksizeB}

  \addtolength{\labelpos}{\pslabelsep}

  \addtolength{\labelpos}{1.84ex}

  \newcommand{\psxpoint}[2]{

    \psline[linewidth=.5pt]{-}(#1,\pst at xticksizeB)(#1,\pst at xticksizeA)

    \rput[b]{0}(#1,-\labelpos){#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}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://tug.org/pipermail/pstricks/attachments/20070312/c2cdf2a1/attachment.html 


More information about the PSTricks mailing list