ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* A label question
@ 2001-05-18 16:18 David Arnold
  2001-05-18 19:22 ` Tarik Kara
  2001-05-19  8:41 ` Hans Hagen
  0 siblings, 2 replies; 4+ messages in thread
From: David Arnold @ 2001-05-18 16:18 UTC (permalink / raw)


All,

This is a Metapost labeling question.

I have two points z0 and z1 and a segment connecting them.

draw z0--z1;

I'd like to put a TeX label to the left of the segment, but I want to
format it as follows.

The vertical
deflection of
the center of
gravity $y(t)$

That's four lines.

I tried:

label.lft(btex The vertical\par deflection of\par the center of\par gravity
$y(t)$ etex, 0.5[z0,z1]);

to no avail. Any suggestions?

-
David Arnold
College of the Redwoods
Mathematics Department
7351 Tompkins Hill Rd
Eureka, CA 95501
(707) 476-4222 Office
(707) 476-4424 Fax
http://online.redwoods.cc.ca.us/instruct/darnold/

Ordinary Differential Equations Using MATLAB, 2/e
http://www.prenhall.com/books/esm_0130113816.html


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

* Re: A label question
  2001-05-18 16:18 A label question David Arnold
@ 2001-05-18 19:22 ` Tarik Kara
  2001-05-19  9:18   ` Hans Hagen
  2001-05-19  8:41 ` Hans Hagen
  1 sibling, 1 reply; 4+ messages in thread
From: Tarik Kara @ 2001-05-18 19:22 UTC (permalink / raw)
  Cc: ntg-context

I think the problem is with the \par command. I am not sure
how you would like to align the label, but the following looks
ok for me:

label.ulft(btex \vbox{\hbox{The vertical}%
\hbox{deflection of}%
\hbox{the center of}%
\hbox{gravity $y(t)$}} etex, 0.5[z0,z1]); 

The following also works (with the LaTeX switch of mpost)

label.ulft(btex \begin{tabular}{l}The vertical \\%
deflection of \\%
the center of \\%
gravity $y(t)$ \end{tabular} etex, 0.5[z0,z1]); 

But the tabular environment adds a little space to the begining of the
first column which might be undesirable. Hope this help.

Tar{\i}k Kara

On Fri, 18 May 2001, David Arnold wrote:

> All,
> 
> This is a Metapost labeling question.
> 
> I have two points z0 and z1 and a segment connecting them.
> 
> draw z0--z1;
> 
> I'd like to put a TeX label to the left of the segment, but I want to
> format it as follows.
> 
> The vertical
> deflection of
> the center of
> gravity $y(t)$
> 
> That's four lines.
> 
> I tried:
> 
> label.lft(btex The vertical\par deflection of\par the center of\par gravity
> $y(t)$ etex, 0.5[z0,z1]);
> 
> to no avail. Any suggestions?
> 
> 
> -
> David Arnold
> College of the Redwoods
> Mathematics Department
> 7351 Tompkins Hill Rd
> Eureka, CA 95501
> (707) 476-4222 Office
> (707) 476-4424 Fax
> http://online.redwoods.cc.ca.us/instruct/darnold/
> 
> Ordinary Differential Equations Using MATLAB, 2/e
> http://www.prenhall.com/books/esm_0130113816.html
> 
> 


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

* Re: A label question
  2001-05-18 16:18 A label question David Arnold
  2001-05-18 19:22 ` Tarik Kara
@ 2001-05-19  8:41 ` Hans Hagen
  1 sibling, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2001-05-19  8:41 UTC (permalink / raw)
  Cc: ntg-context

At 09:18 AM 5/18/01 -0700, David Arnold wrote:
>All,
>
>This is a Metapost labeling question.
>
>I have two points z0 and z1 and a segment connecting them.
>
>draw z0--z1;
>
>I'd like to put a TeX label to the left of the segment, but I want to
>format it as follows.
>
>The vertical
>deflection of
>the center of
>gravity $y(t)$
>
>That's four lines.
>
>I tried:
>
>label.lft(btex The vertical\par deflection of\par the center of\par gravity
>$y(t)$ etex, 0.5[z0,z1]);

btex \vbox{\raggedright The vertical \par ....}\etex 

or in context: 

btex \framed[align=right,frame=off,ofset=overlay]{bla\\bla\\bla} etex 

this will give you a raggedright tight box and also permits some tracing
{turn frame on]; the \framed macro will make the box as small as possible. 

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


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

* Re: A label question
  2001-05-18 19:22 ` Tarik Kara
@ 2001-05-19  9:18   ` Hans Hagen
  0 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2001-05-19  9:18 UTC (permalink / raw)
  Cc: David Arnold, ntg-context

At 10:22 PM 5/18/01 +0300, Tarik Kara wrote:
>I think the problem is with the \par command. I am not sure
>how you would like to align the label, but the following looks
>ok for me:
>
>label.ulft(btex \vbox{\hbox{The vertical}%
>\hbox{deflection of}%
>\hbox{the center of}%
>\hbox{gravity $y(t)$}} etex, 0.5[z0,z1]); 

This is indeed the most texie way to do it; the stuff between btex/etex is
normally copied to a temp tex file and ends up like : 

\shipout
  \vbox 
     \hbox 
        your stuff 

with some pseudo strut added for spacing. Then tex is run on it, and the
output (dvi) is converted into some metapost pictures (actually strings
drawn infont ...). So, the stuff becomes a hbox and in order to get lines
you need to add a vbox inside the btex/etex. The four \hbox's here make
sure that the lines don't become \hsize. If you use the tex alignment
primitives, you need to nill the tabskip. 

In context, it's far better to use the "textext" macro or to move the tex
code outside the graphic and just call it by name in the mp graphic. That
way you nicely isolate the code. 

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


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

end of thread, other threads:[~2001-05-19  9:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-18 16:18 A label question David Arnold
2001-05-18 19:22 ` Tarik Kara
2001-05-19  9:18   ` Hans Hagen
2001-05-19  8:41 ` Hans Hagen

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