On Fri, Jul 9, 2010 at 7:13 AM, Michael Murphy <michael.mur...@uni-ulm.de> wrote: > On 09/07/10 01:32, Michael Goerz wrote: >> I'm trying to do some horizontal alignment, for typesetting poetry. >> How would you solve this kind of problem? I've considered defining a >> macro \BrokenLine[line1][line2] that does the above. But, there are >> also instances where there are two or more lines as a continuation of >> one previous line. Maybe there is a possibility to mark a horizontal >> position temporarily, and then jump to that position later? > > Anyway, this is a crappy solution and you could probably make it better. As > far as I'm aware, there is no way to get the current horizontal position > across the page at any particular moment. The method below essentially just > measures the length of the line that you want to enter, and sets this as the > indent. > > \dimendef\indentl=10 > > \def\savewidth#1{% > \setbox0=\hbox{#1}% > \copy0% > \indentl=\wd0% > } > > \def\addtosavewidth#1{% > \setbox0=\hbox{#1}% > \mindent\copy0% > \advance\indentl by \wd0% > } > > \def\mindent{\hskip\indentl} Thanks, Michael, that works great!
Just out of interest: why does \savewidth create a newline if there's more text on the same line, (like this: \savewidth{start of line} and some more text ) while \addtosavewidth does not? The difference is the \hskip in front of the \copy0%; if I add \hskip0pt in front of the the \copy in \savewidth, there's also no newline -- but how does that make sense? Michael ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________