What's the easiest way to right-align a left-aligned block of text? e.g. I'd like to set an address as far to the right margin as possible without manual measure of the longest line. I tried \hfill\vbox{some lines}, but that doesn't work. Grüßlis vom Hraban! -- www.fiee.net/texnique/ www.ramm.ch/context/
What's the easiest way to right-align a left-aligned block of text?
\startalignmen[right] %left,middle
The lines \stopalignment
No, that's a simple left-aligned (raggedright) block of text. I need to right-align a left-aligned block, like this: | one line | a very long line| another line | | The text should go as far to the right as the longest line allows. Grüßlis vom Hraban! -- www.fiee.net/texnique/ www.ramm.ch/context/
On lundi, fév 3, 2003, at 17:33 Europe/Paris, Henning Hraban Ramm wrote:
What's the easiest way to right-align a left-aligned block of text?
\startalignmen[right] %left,middle
The lines \stopalignment
No, that's a simple left-aligned (raggedright) block of text. I need to right-align a left-aligned block, like this:
| one line | a very long line| another line | |
The text should go as far to the right as the longest line allows.
Grüßlis vom Hraban!
Using Plain TeX macros, which work also in ConTeXt, I do it the following way (which is probably not elegant...): \starttext \vbox{ \hbox{\bf laboratoire\dots}\medskip \line{\it universit\'e de versailles\hfill cnrs (umr 7641)} \vskip .3 true cm \hrule \vskip .3 true cm \line{% \vtop{ \hbox{Laboratoire\dots } \hbox{B\^atiment Fermat} \hbox{Universit\'e de Versailles} \hbox{45, avenue des \'Etats-Unis} \hbox{78035 Versailles cedex} \hbox{France}} \hss\vtop{ \hbox{t\'el\'ephone : 01 39 25 25 25} \hbox{{secr\'etariat : num\'ero \`a pr\'eciser plus tard}} \hbox{fax : 01 39 25 25 25} } } } \stoptext
On lundi, fév 3, 2003, at 17:33 Europe/Paris, Henning Hraban Ramm wrote:
What's the easiest way to right-align a left-aligned block of text?
\startalignmen[right] %left,middle
The lines \stopalignment
No, that's a simple left-aligned (raggedright) block of text. I need to right-align a left-aligned block, like this:
| one line | a very long line| another line | |
The text should go as far to the right as the longest line allows.
Grüßlis vom Hraban!
Using Plain TeX macros, which work also in ConTeXt, I do it the following way (which is probably not elegant...): \starttext \vbox{ \hbox{\bf laboratoire\dots}\medskip \line{\it universit\'e de versailles\hfill cnrs (umr 7641)} \vskip .3 true cm \hrule \vskip .3 true cm \line{% \vtop{ \hbox{Laboratoire\dots } \hbox{B\^atiment Fermat} \hbox{Universit\'e de Versailles} \hbox{45, avenue des \'Etats-Unis} \hbox{78035 Versailles cedex} \hbox{France}} \hss\vtop{ \hbox{t\'el\'ephone : 01 39 25 25 25} \hbox{{secr\'etariat : num\'ero \`a pr\'eciser plus tard}} \hbox{fax : 01 39 25 25 25} } } } \stoptext
Hi Hraban, Here another atempt. I do hope that I understood is correctly>
No, that's a simple left-aligned (raggedright) block of text. I need to right-align a left-aligned block, like this:
| one line | a very long line| another line | |
The text should go as far to the right as the longest line allows.
\starttext \startnarrower[2*left] \startalignment[right] \input tufte \stopalignment \stopnarrower \stoptext I see, that there is a limitation in that you will have to specify how much the textblock is moved away from the left margin. Gruss Willi
I see, that there is a limitation in that you will have to specify how much the textblock is moved away from the left margin.
That's what I meant. I can't see the need to calculate something manually while using a programmable system. In my example the line at the right is the right border of the \textwidth.
| one line | a very long line| another line | |
Grüßlis vom Hraban! -- www.fiee.net/texnique/ www.ramm.ch/context/
Henning Hraban Ramm wrote:
In my example the line at the right is the right border of the \textwidth.
| one line | a very long line| another line | |
Still alot of manual intervention but ... you could switch to two column mode, calculate your longest line in your address and use that as the width of your second column. %-- tryAddress.tex -------------------------------------------- \starttext \setbox\scratchbox\hbox{ADE Ridderstraat 27}% Longest line in address \defineparagraphs[LongIndentation][n=2] \setupparagraphs[LongIndentation][2][width=\wd\scratchbox] \startLongIndentation \LongIndentation% Start second column \startlines PRAGMA ADE Ridderstraat 27 8061 GH Hasselt NL +31 (0)38 477 53 69 \stoplines \stopLongIndentation \showframe \stoptext %-- end tryAddress.tex ----------------------------------------
At 11:37 AM 2/6/2003 +0800, Guy Worthington wrote:
Henning Hraban Ramm wrote:
In my example the line at the right is the right border of the \textwidth.
| one line | a very long line| another line | |
Still alot of manual intervention but ... you could switch to two column mode, calculate your longest line in your address and use that as the width of your second column.
%-- tryAddress.tex -------------------------------------------- \starttext
\setbox\scratchbox\hbox{ADE Ridderstraat 27}% Longest line in address \defineparagraphs[LongIndentation][n=2] \setupparagraphs[LongIndentation][2][width=\wd\scratchbox]
\startLongIndentation \LongIndentation% Start second column \startlines PRAGMA ADE Ridderstraat 27 8061 GH Hasselt NL +31 (0)38 477 53 69 \stoplines \stopLongIndentation
\showframe
\stoptext
let's end this suffering: \startalignment[left] \noindent\framed [width=fit,align=right] {PRAGMA\\ADE Ridderstraat 27\\ 8061 GH Hasselt NL\\+31 (0)38 477 53 69} \stopalignment so, framed can give back a tight box; turn off the frame, set the offset to overlay and ... ------------------------------------------------------------------------- Hans Hagen | PRAGMA ADE | pragma@wxs.nl Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com ------------------------------------------------------------------------- information: http://www.pragma-ade.com/roadmap.pdf documentation: http://www.pragma-ade.com/showcase.pdf -------------------------------------------------------------------------
let's end this suffering:
\startalignment[left] \noindent\framed [width=fit,align=right] {PRAGMA\\ADE Ridderstraat 27\\ 8061 GH Hasselt NL\\+31 (0)38 477 53 69} \stopalignment
so, framed can give back a tight box; turn off the frame, set the offset to overlay and ...
Thank you, Hans! I could really have thought of \framed myself! Grmbl... And thank you, Guy, for your endevours! Grüßlis vom Hraban! -- www.fiee.net/texnique/ www.ramm.ch/context/
participants (5)
-
Guy Worthington
-
Hans Hagen
-
Henning Hraban Ramm
-
Otared Kavian
-
Willi Egger