[metapost] Multiple line LaTeX

Hans Hagen pragma at wxs.nl
Sun Feb 22 13:35:17 CET 2009


Stephan Hennig wrote:
> Steve Checkoway schrieb:
>> As an example of the usage, foo.mp contains:
>>
>> input latexmp;
>> input latexmphelper;% The above code and a call to setupLaTeXMP
>> prologues:=3;
>> beginfig(0);
>> % The vbox is because \shipout\hbox is used to write the text.
>> label( texmultiline("\vbox{\begin{verbatim}",
>> 		    "This is some",
>> 		    "verbatim text.",
>> 		    "\end{verbatim}",
>> 		    "}"), (0,100) );
>> label( texmultiline("\begin{lstlisting}",
>> 		    "ld sp,hl",
>> 		    "ret",
>> 		    "\end{lstlisting}"), (0,50) );
>> label( texmultiline("\def\blah{4}%",
>> 		    "\ifnum\blah=0 zero\else nonzero\fi"), origin );
>> endfig;
>> end
> 
> Nice!
> 
> Jens-Uwe, would it be possible to add this to the latexmp package?
> 
> Taco et al., does mplib offer better ways to handle this situation?

dealing with line endings (and esp in macro packages when verbatim shows 
  up) is always kind of special (add to that dealing with " in mp)

as mplib and metapost are the same you need to take similar measures

when you pipe data from tex to mp or some file - i assume that this is 
which is what latexmp does - you can probably deal with it at the macro 
package level

Hans


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


More information about the metapost mailing list