diff options
-rw-r--r-- | Master/texmf-dist/doc/luatex/luamplib/NEWS | 3 | ||||
-rw-r--r-- | Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf | bin | 149386 -> 149508 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/luatex/luamplib/luamplib.dtx | 24 | ||||
-rw-r--r-- | Master/texmf-dist/tex/luatex/luamplib/luamplib.lua | 24 |
4 files changed, 31 insertions, 20 deletions
diff --git a/Master/texmf-dist/doc/luatex/luamplib/NEWS b/Master/texmf-dist/doc/luatex/luamplib/NEWS index f1813b925e0..338804cbd70 100644 --- a/Master/texmf-dist/doc/luatex/luamplib/NEWS +++ b/Master/texmf-dist/doc/luatex/luamplib/NEWS @@ -1,5 +1,8 @@ History of the luamplib package +2019/11/14 2.20.3 + * fix issue #86 (LaTeX command inside metapost label) + 2019/10/11 2.20.2 * fix issue #84 (pgf package hinders \mpcolor process) diff --git a/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf b/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf Binary files differindex 246a6517879..8d3fc8f72b0 100644 --- a/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf +++ b/Master/texmf-dist/doc/luatex/luamplib/luamplib.pdf diff --git a/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx b/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx index 0ca8f9dbc5d..c93ff8c8290 100644 --- a/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx +++ b/Master/texmf-dist/source/luatex/luamplib/luamplib.dtx @@ -1158,22 +1158,22 @@ luamplib.verbatiminput = false % \begin{macrocode} local function protect_expansion (str) if str then - str = str:gsub("\\","\1Control\1") - :gsub("%%","\1Comment\1") - :gsub("#", "\1HashSign\1") - :gsub("{", "\1LBrace\1") - :gsub("}", "\1RBrace\1") + str = str:gsub("\\","!!!Control!!!") + :gsub("%%","!!!Comment!!!") + :gsub("#", "!!!HashSign!!!") + :gsub("{", "!!!LBrace!!!") + :gsub("}", "!!!RBrace!!!") return format("\\unexpanded{%s}",str) end end local function unprotect_expansion (str) if str then - return str:gsub("\1Control\1", "\\") - :gsub("\1Comment\1", "%%") - :gsub("\1HashSign\1","#") - :gsub("\1LBrace\1", "{") - :gsub("\1RBrace\1", "}") + return str:gsub("!!!Control!!!", "\\") + :gsub("!!!Comment!!!", "%%") + :gsub("!!!HashSign!!!","#") + :gsub("!!!LBrace!!!", "{") + :gsub("!!!RBrace!!!", "}") end end @@ -1210,7 +1210,11 @@ local function process_mplibcode (data) % \begin{macrocode} if not luamplib.verbatiminput then data = data:gsub("\".-\"", protect_expansion) + + data = data:gsub("\\%%", "\0PerCent\0") data = data:gsub("%%.-\n","") + data = data:gsub("%zPerCent%z", "\\%%") + run_tex_code(format("\\mplibtmptoks\\expanded{{%s}}",data)) data = texgettoks"mplibtmptoks" % \end{macrocode} diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua b/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua index ac47afc42b3..69ab5cef027 100644 --- a/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua +++ b/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua @@ -580,22 +580,22 @@ luamplib.verbatiminput = false local function protect_expansion (str) if str then - str = str:gsub("\\","\1Control\1") - :gsub("%%","\1Comment\1") - :gsub("#", "\1HashSign\1") - :gsub("{", "\1LBrace\1") - :gsub("}", "\1RBrace\1") + str = str:gsub("\\","!!!Control!!!") + :gsub("%%","!!!Comment!!!") + :gsub("#", "!!!HashSign!!!") + :gsub("{", "!!!LBrace!!!") + :gsub("}", "!!!RBrace!!!") return format("\\unexpanded{%s}",str) end end local function unprotect_expansion (str) if str then - return str:gsub("\1Control\1", "\\") - :gsub("\1Comment\1", "%%") - :gsub("\1HashSign\1","#") - :gsub("\1LBrace\1", "{") - :gsub("\1RBrace\1", "}") + return str:gsub("!!!Control!!!", "\\") + :gsub("!!!Comment!!!", "%%") + :gsub("!!!HashSign!!!","#") + :gsub("!!!LBrace!!!", "{") + :gsub("!!!RBrace!!!", "}") end end @@ -622,7 +622,11 @@ local function process_mplibcode (data) if not luamplib.verbatiminput then data = data:gsub("\".-\"", protect_expansion) + + data = data:gsub("\\%%", "\0PerCent\0") data = data:gsub("%%.-\n","") + data = data:gsub("%zPerCent%z", "\\%%") + run_tex_code(format("\\mplibtmptoks\\expanded{{%s}}",data)) data = texgettoks"mplibtmptoks" data = data:gsub("##", "#") |