# [dev-context] how to \obeyMPlines?

Taco Hoekwater taco at elvenkind.com
Thu Feb 15 10:36:48 CET 2007

Mojca Miklavec wrote:
> If I leave the \obeyMPlines there, I get spurious characters (probably
> because TeX adds some character codes which correspond to \r or \n).

Yes. The ^M in the file is \catcode 13, and gets turned into
\obeyedline. \obeyedline, it seems, contains a carriage return with
\catcode 12.

> If I comment out the \obeyMPlines it works OK, but longer graphics
> fail.

\def\processMYfile[#1][#2]{%
\def\startMYgraphic
{\obeyMPlines % <- no longer a problem
\def\obeyedline{}% <- thanks to this
\dosingleargument\dostartMYgraphic}
\long\def\dostartMYgraphic[##1]##2\stopMYgraphic
{\startreusableMPgraphic{#1 ##1}##2\stopreusableMPgraphic}

> Also, sometimes it fails because of TeX memory limit exceeded. (If
> gnuplot wants to draw a 100x100 grid, it needs 10.000 lines of code
> times three - one for color, one for shape, one for actually
> drawing/filling it, that makes it some 31.000 lines of code, and TeX
> cannot handle that. Will there be any possibility for a solution to it
> any time in the future except fixing gnuplot itself? It's not that
> important, but I would just like to know if that issue is solvable at
> all from within TeX or not.)

Not right now. Hopefully the next metapost version (1.1, due out
in late spring/summer) will allow you to 'store' a set of the grid
boxes and call for it, so you could for example save a 10x10 square
and execute it 100 times.

Best,
Taco