ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Re: Multi-line labels in MetaPost
       [not found] <mailman.1061.1250104783.3069.ntg-context@ntg.nl>
@ 2009-08-13  8:34 ` richard.stephens
  2009-08-13 13:15   ` Aditya Mahajan
  0 siblings, 1 reply; 9+ messages in thread
From: richard.stephens @ 2009-08-13  8:34 UTC (permalink / raw)
  To: ntg-context

[-- Attachment #1: Type: text/html, Size: 1985 bytes --]

[-- Attachment #2: Type: text/plain, Size: 487 bytes --]

___________________________________________________________________________________
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: Multi-line labels in MetaPost
  2009-08-13  8:34 ` Multi-line labels in MetaPost richard.stephens
@ 2009-08-13 13:15   ` Aditya Mahajan
  2009-08-22 19:07     ` Michail Vidiassov
  0 siblings, 1 reply; 9+ messages in thread
From: Aditya Mahajan @ 2009-08-13 13:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1000 bytes --]

On Thu, 13 Aug 2009, richard.stephens@converteam.com wrote:

> 
> 
> > > Hello,
> > >
> > > Is it possible to generate multi-line labels in MetaPost?  I have  
> > > naively tried the following hoping to get a line feed between the  
> > > two words, but it doesn't work!
> > >
> > > label.rt( btex One \crlf Two etex, (0,0));
> >
> > \defineframed[mplabel][frame=off,align=right,width=fit]
> >
> > label.rt(textext("\mplabel{One\\Two}"),origin) ;
> >
> > Wolfgang
> 
> Thank-you for a very elegant solution, Wolfgang, unfortunately I get an error:
> 
> ! Argument of \dododefinecolor has an extra }.
> 
> I have fixed this by using:
> 
> label.rt(textext("\framed[frame=off,align=right]{One\\Two}"),origin);
> 
> which works okay. It's not as elegant but as the code is generated
> automatically it does not require any more typing on my part!

Section 4.2 of Mojca's MyWay on sometxt
http://dl.contextgarden.net/myway/sometxt.pdf provides another solution.

Aditya

[-- Attachment #2: Type: text/plain, Size: 487 bytes --]

___________________________________________________________________________________
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: Multi-line labels in MetaPost
  2009-08-13 13:15   ` Aditya Mahajan
@ 2009-08-22 19:07     ` Michail Vidiassov
  2009-08-22 19:30       ` Aditya Mahajan
  0 siblings, 1 reply; 9+ messages in thread
From: Michail Vidiassov @ 2009-08-22 19:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear All,

>> I have fixed this by using:
>> 
>> label.rt(textext("\framed[frame=off,align=right]{One\\Two}"),origin);
>>

And what about proper tables there?
Replacing One\\Two in the above code with
$ \startmathmatrix \NC 1 \NC 1 \NR \NC 1 \NC  1 \NR \stopmathmatrix $
or
\starttable{|cm|cm|} \NC 1 \NC 1 \NC \NR \NC 1 \NC 1 \NC \NR \stoptable
does not work for me.
It complains about "dotripletestemptyx",
but that seems to be some low level utility code and the error messages 
say nothing to me :(

ConTeXt  ver: 2009.08.14 10:48 MKIV

         Sincerely, Michail
___________________________________________________________________________________
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: Multi-line labels in MetaPost
  2009-08-22 19:07     ` Michail Vidiassov
@ 2009-08-22 19:30       ` Aditya Mahajan
  2009-08-22 20:09         ` Hans Hagen
  0 siblings, 1 reply; 9+ messages in thread
From: Aditya Mahajan @ 2009-08-22 19:30 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sat, 22 Aug 2009, Michail Vidiassov wrote:

> Dear All,
>
>>> I have fixed this by using:
>>> 
>>> label.rt(textext("\framed[frame=off,align=right]{One\\Two}"),origin);
>>> 
>
> And what about proper tables there?
> Replacing One\\Two in the above code with
> $ \startmathmatrix \NC 1 \NC 1 \NR \NC 1 \NC  1 \NR \stopmathmatrix $

All metapost environments expand their arguments, so anything looking for 
an optional argument fails. There are workarounds, though

\unexpanded\def\MYMATRIX%
   {$\startmathmatrix \NC 1 \NC 1 \NR \NC 1 \NC  1 \NR \stopmathmatrix$}

\starttext
\startMPcode
   label.rt(\sometxt{\MYMATRIX},   origin) ;
   label.rt(textext ("\MYMATRIX"), (5cm,0)) ;
\stopMPcode
\stoptext

And if you really want it to work, we need to make cetrain things 
unexpandable

\unprotect
\def\dodefinemathmatrix[#1]% [#2]%
   {\unexpanded\setvalue{\e!start#1}{\dodoubleempty\dostartmathmatrix[#1]}%
    \unexpanded\setvalue{\e!stop #1}{\dostopmathmatrix}%
    \setupmathmatrix[#1]}% [#2]

\definemathmatrix[matrix]
\definemathmatrix[\v!mathmatrix]

\unexpanded\def\dodomatrixNC
   {\gdef\domatrixNC{\endmath&}}

% To avoid errors in expansion
\let\NC\relax
\let\NR\relax

\protect

Now this works

\starttext
\startMPcode
   label.rt(\sometxt{$\startmathmatrix \NC 1 \NC 1 \NR \NC 1 \NC  1 \NR 
\stopmathmatrix$},   origin) ;
\stopMPcode

\stoptext


Hans, should we add this to strc-ali?

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: Multi-line labels in MetaPost
  2009-08-22 19:30       ` Aditya Mahajan
@ 2009-08-22 20:09         ` Hans Hagen
  0 siblings, 0 replies; 9+ messages in thread
From: Hans Hagen @ 2009-08-22 20:09 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Aditya Mahajan wrote:

> Hans, should we add this to strc-ali?

sure, i'll also do the same with getbuffer, as often using buffere is 
convenient in such cases:

\unexpanded\def\getbuffer
   {\dodoubleempty\dogetbuffer}

\starttext

\startbuffer[a]
     $\startmathmatrix \NC 1 \NC 1 \NR \NC 1 \NC  1 \NR \stopmathmatrix$
\stopbuffer

\startMPcode
     label.rt("\getbuffer[a]",origin) ;
\stopMPcode

\stoptext



-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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: Multi-line labels in MetaPost
  2009-08-14  8:54 ` richard.stephens
@ 2009-08-14  9:37   ` Thomas A. Schmitz
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas A. Schmitz @ 2009-08-14  9:37 UTC (permalink / raw)
  To: mailing list for ConTeXt users


On Aug 14, 2009, at 10:54 AM, richard.stephens@converteam.com wrote:

>
> For the record, after reading Mojca's MyWay, and noting that textext  
> is deprecated
> except in certain circumstances,

Well, it's a bit more complicated: in mkii, sometxt was the easiest  
solution because it was flexible and allowed to include all sorts of  
ConTeXt code. In mkiv, textext can do about anything that sometxt can,  
and then some more, so in mkiv, sometxt was deprecated. But I think  
Mojca has nagged Hans into re-implementing sometxt into mkiv as well.  
Complicated, but there you go...

All best

Thomas
___________________________________________________________________________________
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: Multi-line labels in MetaPost
       [not found] <mailman.1077.1250181719.3069.ntg-context@ntg.nl>
@ 2009-08-14  8:54 ` richard.stephens
  2009-08-14  9:37   ` Thomas A. Schmitz
  0 siblings, 1 reply; 9+ messages in thread
From: richard.stephens @ 2009-08-14  8:54 UTC (permalink / raw)
  To: ntg-context

[-- Attachment #1: Type: text/html, Size: 2753 bytes --]

[-- Attachment #2: Type: text/plain, Size: 487 bytes --]

___________________________________________________________________________________
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: Multi-line labels in MetaPost
  2009-08-12 16:09 richard.stephens
@ 2009-08-12 16:15 ` Wolfgang Schuster
  0 siblings, 0 replies; 9+ messages in thread
From: Wolfgang Schuster @ 2009-08-12 16:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 12.08.2009 um 18:09 schrieb richard.stephens@converteam.com:

>
> Hello,
>
> Is it possible to generate multi-line labels in MetaPost?  I have  
> naively tried the following hoping to get a line feed between the  
> two words, but it doesn't work!
>
> label.rt( btex One \crlf Two etex, (0,0));

\defineframed[mplabel][frame=off,align=right,width=fit]

label.rt(textext("\mplabel{One\\Two}"),origin) ;

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

* Multi-line labels in MetaPost
@ 2009-08-12 16:09 richard.stephens
  2009-08-12 16:15 ` Wolfgang Schuster
  0 siblings, 1 reply; 9+ messages in thread
From: richard.stephens @ 2009-08-12 16:09 UTC (permalink / raw)
  To: ntg-context

[-- Attachment #1: Type: text/html, Size: 1219 bytes --]

[-- Attachment #2: Type: text/plain, Size: 487 bytes --]

___________________________________________________________________________________
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-08-22 20:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.1061.1250104783.3069.ntg-context@ntg.nl>
2009-08-13  8:34 ` Multi-line labels in MetaPost richard.stephens
2009-08-13 13:15   ` Aditya Mahajan
2009-08-22 19:07     ` Michail Vidiassov
2009-08-22 19:30       ` Aditya Mahajan
2009-08-22 20:09         ` Hans Hagen
     [not found] <mailman.1077.1250181719.3069.ntg-context@ntg.nl>
2009-08-14  8:54 ` richard.stephens
2009-08-14  9:37   ` Thomas A. Schmitz
2009-08-12 16:09 richard.stephens
2009-08-12 16:15 ` Wolfgang Schuster

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