On Sun, 22 Jan 2012, Sven Siegmund wrote:
> Hello,
>
> my problem is fairly complex but boils down to a few LaTeX/pstricks
> commands which would check the width of a given string of characters,
> and if this exceeds certain limits, it would compress it to a given
> width (skewing the font, resulting in an ugly typesetting result, but
> nobody would really care).
As I understand you just want the method of compressing to desired
width (and the rest, like drawing the boxes, arrows e.t.c. is another
problem you know how to deal with). Try this simple code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{article}
\usepackage{graphicx} %%% for \resizebox
\usepackage{calc} %%% for \widthof
\newlength{\mylength}
\newcommand\compress[2]{%
\setlength{\mylength}{\widthof{#1}}%
\ifdim\mylength>#2%
\resizebox{#2}{\height}{#1}%
\else
#1%
\fi}
\begin{document}
\compress{Andy}{1cm}
\compress{Andy Larkin}{1cm}
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PW