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.
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 ___________________________________________________________________________________
Aditya Mahajan
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.
On Fri, 27 Mar 2009, CuriousLearn wrote:
Aditya Mahajan
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
Aditya Mahajan
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.
On Sat, 28 Mar 2009, CuriousLearn wrote:
Aditya Mahajan
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
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
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
Aditya Mahajan
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.
participants (3)
-
Aditya Mahajan
-
CuriousLearn
-
Wolfgang Schuster