Tell me more ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to use the development version of metapost with luamplib. I've switched over the executable mpost.exe which is presumable called by luamplib somewhere along the line. Now, I would like to pass the option --math=double to mpost.exe so that I can perform calculations on numbers larger than 4096. Is this possible and, if so, then how can it be done? I run Windows 7 and miktex 2.9 if it's relevant.

Edit, the question above is based on a misunderstanding of how this worked, Khaled cleared that up in the first comment below: What I have done so far (thanks Khaled):

  1. Downloaded the latest luatex from here
  2. Replaced the binary in my miktex folder with the downloaded version (and updated formats and FNDB just in case).
  3. Downloaded the mplib source from here and searched through the file mplibapi.pdf.
  4. Found reference to mp_math_double_mode on page 7.
  5. Looked through luamplib.lua, and inferred that options could be passed in the function

function load()
    local mpx = mplib.new {
        find_file   = finder,
        ini_version = true,
        math_mode = mp_math_double_mode,<--edit here
    }
    mpx:execute(format("input %s ;", currentformat))
    return mpx
end

to which I added the indicated line. Still no luck.

share|improve this question
2  
Luamplib calls the MataPost library embedded in LuaTeX, so you will need to use a new LuaTeX that has the new MataPost. – Khaled Hosny Feb 20 at 7:53
@KhaledHosny Thanks Khaled, that definitely answers part of my question. If I use a newer luatex, is the higher precision enabled by default? – Scott H. Feb 20 at 18:56
I don’t think so, the default will be the same as the standalone MetaPost, but you can set numbersystem from MetaPost code (the command line option changed to --numbersystem as well). – Khaled Hosny Feb 20 at 20:20
So within \begin{mplibcode} and \end{mplibcode} I can use numbersystem=double; and that should work? – Scott H. Feb 20 at 20:24
I think so, but note that I know near nothing about MetaPost, this is what I gather from reading MetaPost release note. – Khaled Hosny Feb 20 at 23:37
show 1 more comment

1 Answer

up vote 3 down vote accepted

The problem is not with the command above (i.e. one of the commented lines in the code below should work) but rather that MikTex runs an older version of the luatex binary (beta-0.70...) that cannot be updated by simply replacing the binary.

function load()
    local mpx = mplib.new {
        find_file   = finder,
        ini_version = true,
        --math_mode = 1,
        --math_mode = double,
        --math_mode = mp_math_mode_double,
    }
    mpx:execute(format("input %s ;", currentformat))
    return mpx
end
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.