[dev-context] PATCH: fix meta-pdf.lua choking on grayscale metapost output

Sanjoy Mahajan sanjoy at olin.edu
Thu Apr 11 21:34:45 CEST 2013

I am converting myself to MkIV, and ran into the following error:

  ! LuaTeX error /usr/share/texmf/tex/context/base/meta-pdf.lua:355: attempt to call global 'pdfgrayliteral' (a nil value)
  stack traceback:
          /usr/share/texmf/tex/context/base/meta-pdf.lua:355: in function </usr/share/texmf/tex/context/base/meta-pdf.lua:353>
          [C]: in function 'lpegmatch'
          /usr/share/texmf/tex/context/base/meta-pdf.lua:519: in function 'parse'
          /usr/share/texmf/tex/context/base/meta-pdf.lua:539: in function 'convertmpstopdf'
          <main ctx instance>:1: in main chunk.

It was during converting metapost to pdf.  The metapost source

  defaultcolormodel := 3;  % grayscale

which may be why this problem wasn't noticed before.  But the patch
below fixes it for me (after regenerating the format, which took me a
while to realize):

--- /usr/share/texmf/tex/context/base/meta-pdf.lua	2012-05-14 13:38:55.000000000 -0400
+++ /usr/share/texmf/tex/context/base/meta-pdf.lua	2013-04-11 14:54:45.000000000 -0400
@@ -352,7 +352,7 @@
 function mps.setgray(s)
-    pdfcode(pdfgrayliteral(mps.colormodel,s))
+    pdfcode(pdfgraycode(mps.colormodel,s))
 function mps.specials(version,signal,factor) -- 2.0 123 1000

More information about the dev-context mailing list