Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a line of text in a pspicture environment and I need to distribute the words in a way like \hfill could do. Here is an image of what I want:

enter image description here

I currently have this minimal example

\documentclass[pstricks,border=2cm]{standalone}
\begin{document}
\begin{pspicture}(12,3)

\psline(1,1)(11,1)
\rput[Bl]{0}(1,1){Word LongWord Words MuchLongerWord}

% command which draws the grid and labels it
\psgrid[subgriddiv=0, griddots=10, gridlabels=12pt]
\end{pspicture}

\end{document}

Which compiles to this (using another font): enter image description here

How should I enhance it to get the desired result?

Condition: I need it to compile with xelatex (which, as far as I have read, doesn't like the idea of putting text on a path) so I can't experiment with pst-text much.

I don't necessarily need to place the text on any path. I essentially only need to equally distribute the words in a certain amount of horizontal space. Any ideas how to get there?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

You can use a \makebox with Option s (stretch).

\documentclass[pstricks,border=2cm]{standalone}
\begin{document}
\begin{pspicture}(12,3)

\psline(1,1)(11,1)
\rput[Bl]{0}(1,1){\makebox[10cm][s]{Word LongWord Words MuchLongerWord}}

% command which draws the grid and labels it
\psgrid[subgriddiv=0, griddots=10, gridlabels=12pt]
\end{pspicture}

\end{document}

Result:

enter image description here

share|improve this answer
    
Thanks a lot. Works perfectly. –  Zababa Aug 4 at 16:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.