ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Linebreak in Metapost/Metafun Label
@ 2009-03-27 20:52 CuriousLearn
  2009-03-27 21:02 ` Aditya Mahajan
  0 siblings, 1 reply; 9+ messages in thread
From: CuriousLearn @ 2009-03-27 20:52 UTC (permalink / raw)
  To: ntg-context

Hi,

Is it possible to break labels in two lines if needed? 

For example, suppose I have

label.rt(textext("Do you see this label text. Quite long. Need to break it 
across lines"),(3,5));

Can I have it appear in the figure as

Do you see this label text.
Quite long. Need to break 
it across lines.


Thank you in advance for your help.




___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Linebreak in Metapost/Metafun Label
  2009-03-27 20:52 Linebreak in Metapost/Metafun Label CuriousLearn
@ 2009-03-27 21:02 ` Aditya Mahajan
  2009-03-27 22:55   ` CuriousLearn
  0 siblings, 1 reply; 9+ messages in thread
From: Aditya Mahajan @ 2009-03-27 21:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Fri, 27 Mar 2009, CuriousLearn wrote:

> Hi,
>
> Is it possible to break labels in two lines if needed?
>
> For example, suppose I have
>
> label.rt(textext("Do you see this label text. Quite long. Need to break it
> across lines"),(3,5));

label.rt(textext("\framed[frame=no,width=5cm]{....}", (3,5)) ;

Aditya


> Can I have it appear in the figure as
>
> Do you see this label text.
> Quite long. Need to break
> it across lines.
>
>
> Thank you in advance for your help.
>
>
>
>
> ___________________________________________________________________________________
> 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  : https://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
>
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Linebreak in Metapost/Metafun Label
  2009-03-27 21:02 ` Aditya Mahajan
@ 2009-03-27 22:55   ` CuriousLearn
  2009-03-27 23:45     ` Aditya Mahajan
  0 siblings, 1 reply; 9+ messages in thread
From: CuriousLearn @ 2009-03-27 22:55 UTC (permalink / raw)
  To: ntg-context

Aditya Mahajan <adityam <at> umich.edu> writes:


> > For example, suppose I have
> >
> > label.rt(textext("Do you see this label text. Quite long. Need to break it
> > across lines"),(3,5));
> 
> label.rt(textext("\framed[frame=no,width=5cm]{....}", (3,5)) ;
> 
> Aditya
> 

Thanks Aditya. Sorry but that does not work. The text line just starts shifting
to the left for me. It spills outside the frame.

I tried with both MKIV and MKII. The MKIV version I tried with is 

ConTeXt  ver: 2009.03.18 21:58 MKIV 

Any ideas why it may not be working for me? 

Thanks.

___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Linebreak in Metapost/Metafun Label
  2009-03-27 22:55   ` CuriousLearn
@ 2009-03-27 23:45     ` Aditya Mahajan
  2009-03-28  0:17       ` CuriousLearn
  0 siblings, 1 reply; 9+ messages in thread
From: Aditya Mahajan @ 2009-03-27 23:45 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Fri, 27 Mar 2009, CuriousLearn wrote:

> Aditya Mahajan <adityam <at> umich.edu> writes:
>
>
>>> For example, suppose I have
>>>
>>> label.rt(textext("Do you see this label text. Quite long. Need to break it
>>> across lines"),(3,5));
>>
>> label.rt(textext("\framed[frame=no,width=5cm]{....}", (3,5)) ;
>>
>> Aditya
>>
>
> Thanks Aditya. Sorry but that does not work. The text line just starts shifting
> to the left for me. It spills outside the frame.
>
> I tried with both MKIV and MKII. The MKIV version I tried with is
>
> ConTeXt  ver: 2009.03.18 21:58 MKIV
>
> Any ideas why it may not be working for me?

Because I did not test before posting :)

Try \framed[align=normal, width=5cm, frame=no]{....}

Aditya
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Linebreak in Metapost/Metafun Label
  2009-03-27 23:45     ` Aditya Mahajan
@ 2009-03-28  0:17       ` CuriousLearn
  2009-03-28  0:33         ` Aditya Mahajan
  0 siblings, 1 reply; 9+ messages in thread
From: CuriousLearn @ 2009-03-28  0:17 UTC (permalink / raw)
  To: ntg-context

Aditya Mahajan <adityam <at> umich.edu> writes:


> >
> > Any ideas why it may not be working for me?
> 
> Because I did not test before posting :)
> 
> Try \framed[align=normal, width=5cm, frame=no]{....}
> 
> Aditya

Awesome! That works great. Before asking I tried searching a lot in metafun
manual and on the web but could not find anything. I am not yet clear about the
logic. When I saw that I could color labels using the \color[red]{red} command
by putting it between btex...etex, it seemed to me that any context command
would work if put in there. So I tried \crlf to get a linebreak and that did not
work. So I thought maybe only very few specific commands work. Now after seeing
your solution, again I am wondering, what determines which commands work and
which do not. Anyhow, I am not asking for an explanation, because it will most
probably beyond me and may be a long one for someone to explain. But I
appreciate the solution.

Thanks again.


___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Linebreak in Metapost/Metafun Label
  2009-03-28  0:17       ` CuriousLearn
@ 2009-03-28  0:33         ` Aditya Mahajan
  2009-03-28  0:49           ` Wolfgang Schuster
  2009-03-28  1:09           ` CuriousLearn
  0 siblings, 2 replies; 9+ messages in thread
From: Aditya Mahajan @ 2009-03-28  0:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sat, 28 Mar 2009, CuriousLearn wrote:

> Aditya Mahajan <adityam <at> umich.edu> writes:
>
>
>>>
>>> Any ideas why it may not be working for me?
>>
>> Because I did not test before posting :)
>>
>> Try \framed[align=normal, width=5cm, frame=no]{....}
>>
>> Aditya
>
> Awesome! That works great. Before asking I tried searching a lot in metafun
> manual and on the web but could not find anything. I am not yet clear about the
> logic. When I saw that I could color labels using the \color[red]{red} command
> by putting it between btex...etex, it seemed to me that any context command
> would work if put in there. So I tried \crlf to get a linebreak and that did not
> work. So I thought maybe only very few specific commands work. Now after seeing
> your solution, again I am wondering, what determines which commands work and
> which do not. Anyhow, I am not asking for an explanation, because it will most
> probably beyond me and may be a long one for someone to explain. But I
> appreciate the solution.

Here is a simplified picture. Basically, anything inside btex ... etex (or 
textext(...) or \sometxt{...}) is in what is known as TeX's horizontal 
mode. Think of this as what you will get if you put the same argument in a 
\hbox (see the TeXbook or TeX for the impatient for details). To get 
multiple lines you need tex to be in the vertical mode, a \vbox. A vanilla 
\framed is like a \hbox. Framed with align=normal is like a \vbox. So, for 
most purposes you can you \framed. There are some commands that need to 
know the width of the box (like \start stop formula). In those cases you 
need to specify width=something to \framed.

Of course, certain objects like floats, footnotes, marginpars, will never 
work inside metapost. (I think you can get floats and footnotes to work, 
but that will require some hackery)

Aditya
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Linebreak in Metapost/Metafun Label
  2009-03-28  0:33         ` Aditya Mahajan
@ 2009-03-28  0:49           ` Wolfgang Schuster
  2009-03-28  2:09             ` Aditya Mahajan
  2009-03-28  1:09           ` CuriousLearn
  1 sibling, 1 reply; 9+ messages in thread
From: Wolfgang Schuster @ 2009-03-28  0:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 28.03.2009 um 01:33 schrieb Aditya Mahajan:

> Of course, certain objects like floats, footnotes, marginpars, will  
> never work inside metapost. (I think you can get floats and  
> footnotes to work, but that will require some hackery)

You could use streams and local footnotes.

Wolfgang

___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Linebreak in Metapost/Metafun Label
  2009-03-28  0:33         ` Aditya Mahajan
  2009-03-28  0:49           ` Wolfgang Schuster
@ 2009-03-28  1:09           ` CuriousLearn
  1 sibling, 0 replies; 9+ messages in thread
From: CuriousLearn @ 2009-03-28  1:09 UTC (permalink / raw)
  To: ntg-context

Aditya Mahajan <adityam <at> umich.edu> writes:


> Here is a simplified picture. Basically, anything inside btex ... etex (or 
> textext(...) or \sometxt{...}) is in what is known as TeX's horizontal 
> mode. Think of this as what you will get if you put the same argument in a 
> \hbox (see the TeXbook or TeX for the impatient for details). To get 
> multiple lines you need tex to be in the vertical mode, a \vbox. A vanilla 
> \framed is like a \hbox. Framed with align=normal is like a \vbox. So, for 
> most purposes you can you \framed. There are some commands that need to 
> know the width of the box (like \start stop formula). In those cases you 
> need to specify width=something to \framed.
> 
> Of course, certain objects like floats, footnotes, marginpars, will never 
> work inside metapost. (I think you can get floats and footnotes to work, 
> but that will require some hackery)
> 
> Aditya

Thanks very much for the explanation. Now I understand much better. I remember
reading about the importance of horizontal mode and vertical mode in the Seroul
and Levy's book I think.





___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Linebreak in Metapost/Metafun Label
  2009-03-28  0:49           ` Wolfgang Schuster
@ 2009-03-28  2:09             ` Aditya Mahajan
  0 siblings, 0 replies; 9+ messages in thread
From: Aditya Mahajan @ 2009-03-28  2:09 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sat, 28 Mar 2009, Wolfgang Schuster wrote:

>
> Am 28.03.2009 um 01:33 schrieb Aditya Mahajan:
>
>> Of course, certain objects like floats, footnotes, marginpars, will never 
>> work inside metapost. (I think you can get floats and footnotes to work, 
>> but that will require some hackery)
>
> You could use streams and local footnotes.

As always, Hans has already done the hackery.

Aditya
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2009-03-28  2:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-27 20:52 Linebreak in Metapost/Metafun Label CuriousLearn
2009-03-27 21:02 ` Aditya Mahajan
2009-03-27 22:55   ` CuriousLearn
2009-03-27 23:45     ` Aditya Mahajan
2009-03-28  0:17       ` CuriousLearn
2009-03-28  0:33         ` Aditya Mahajan
2009-03-28  0:49           ` Wolfgang Schuster
2009-03-28  2:09             ` Aditya Mahajan
2009-03-28  1:09           ` CuriousLearn

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