ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* aligned text block
@ 2003-02-02  9:11 Henning Hraban Ramm
  2003-02-02 21:56 ` Willi Egger
  0 siblings, 1 reply; 11+ messages in thread
From: Henning Hraban Ramm @ 2003-02-02  9:11 UTC (permalink / raw)


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/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: aligned text block
  2003-02-02  9:11 aligned text block Henning Hraban Ramm
@ 2003-02-02 21:56 ` Willi Egger
  2003-02-03 16:33   ` Henning Hraban Ramm
  0 siblings, 1 reply; 11+ messages in thread
From: Willi Egger @ 2003-02-02 21:56 UTC (permalink / raw)


Hi Hraban,
> What's the easiest way to right-align a left-aligned block of text?

%\startlines
   \startalignmen[right] %left,middle

     The lines
   \stopalignment
%\stoplines

Grüsse Willi

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: aligned text block
  2003-02-02 21:56 ` Willi Egger
@ 2003-02-03 16:33   ` Henning Hraban Ramm
  2003-02-03 17:14     ` Otared Kavian
                       ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Henning Hraban Ramm @ 2003-02-03 16:33 UTC (permalink / raw)


>> 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/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: aligned text block
  2003-02-03 16:33   ` Henning Hraban Ramm
@ 2003-02-03 17:14     ` Otared Kavian
  2003-02-03 17:15     ` Otared Kavian
  2003-02-05  8:58     ` Willi Egger
  2 siblings, 0 replies; 11+ messages in thread
From: Otared Kavian @ 2003-02-03 17:14 UTC (permalink / raw)



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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: aligned text block
  2003-02-03 16:33   ` Henning Hraban Ramm
  2003-02-03 17:14     ` Otared Kavian
@ 2003-02-03 17:15     ` Otared Kavian
  2003-02-05  8:58     ` Willi Egger
  2 siblings, 0 replies; 11+ messages in thread
From: Otared Kavian @ 2003-02-03 17:15 UTC (permalink / raw)



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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: aligned text block
  2003-02-03 16:33   ` Henning Hraban Ramm
  2003-02-03 17:14     ` Otared Kavian
  2003-02-03 17:15     ` Otared Kavian
@ 2003-02-05  8:58     ` Willi Egger
  2003-02-05 10:35       ` Henning Hraban Ramm
  2 siblings, 1 reply; 11+ messages in thread
From: Willi Egger @ 2003-02-05  8:58 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: aligned text block
  2003-02-05  8:58     ` Willi Egger
@ 2003-02-05 10:35       ` Henning Hraban Ramm
  2003-02-06  3:37         ` Guy Worthington
  0 siblings, 1 reply; 11+ messages in thread
From: Henning Hraban Ramm @ 2003-02-05 10:35 UTC (permalink / raw)


> 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/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: aligned text block
  2003-02-05 10:35       ` Henning Hraban Ramm
@ 2003-02-06  3:37         ` Guy Worthington
  2003-02-06 10:34           ` Hans Hagen
  0 siblings, 1 reply; 11+ messages in thread
From: Guy Worthington @ 2003-02-06  3:37 UTC (permalink / raw)



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 ----------------------------------------

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Re: aligned text block
  2003-02-06  3:37         ` Guy Worthington
@ 2003-02-06 10:34           ` Hans Hagen
  2003-02-06 18:40             ` Henning Hraban Ramm
  0 siblings, 1 reply; 11+ messages in thread
From: Hans Hagen @ 2003-02-06 10:34 UTC (permalink / raw)
  Cc: ntg-context

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
-------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Re: aligned text block
  2003-02-06 10:34           ` Hans Hagen
@ 2003-02-06 18:40             ` Henning Hraban Ramm
  2003-02-07 12:47               ` Guy Worthington
  0 siblings, 1 reply; 11+ messages in thread
From: Henning Hraban Ramm @ 2003-02-06 18:40 UTC (permalink / raw)


> 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/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: aligned text block
  2003-02-06 18:40             ` Henning Hraban Ramm
@ 2003-02-07 12:47               ` Guy Worthington
  0 siblings, 0 replies; 11+ messages in thread
From: Guy Worthington @ 2003-02-07 12:47 UTC (permalink / raw)


Henning Hraban Ramm wrote

> And thank you, Guy, for your endeavour!

I guess I don't make the all-American team this year :-(

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2003-02-07 12:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-02  9:11 aligned text block Henning Hraban Ramm
2003-02-02 21:56 ` Willi Egger
2003-02-03 16:33   ` Henning Hraban Ramm
2003-02-03 17:14     ` Otared Kavian
2003-02-03 17:15     ` Otared Kavian
2003-02-05  8:58     ` Willi Egger
2003-02-05 10:35       ` Henning Hraban Ramm
2003-02-06  3:37         ` Guy Worthington
2003-02-06 10:34           ` Hans Hagen
2003-02-06 18:40             ` Henning Hraban Ramm
2003-02-07 12:47               ` Guy Worthington

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).