Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDF generation can be thwarted by a global .latexmrc file. #1855

Open
mforbes opened this issue Feb 11, 2025 · 3 comments
Open

PDF generation can be thwarted by a global .latexmrc file. #1855

mforbes opened this issue Feb 11, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@mforbes
Copy link

mforbes commented Feb 11, 2025

Description

If the user has a .latexmkrc file somewhere in a parent directory, then this will be included, potentially breaking the LaTeX build.

For example, when trying to build the quickstart guide, I ended up with an error:

$ myst build --pdf
...
Error: ENOENT: no such file or directory, open '.../mystmd-quickstart/_build/temp/mystSIQlNp/paper.log'

The issue is that my global .latexmkrc file was found with contains $out_dir = "/tmp/...";. This puts all latex compilation products in /tmp/..., and hence myst cannot find the final .pdf file. (In this case, I think something else was wrong with the build too which I will track down later, because I include a command to copy the final pdf back up...).

$ myst --version
v1.3.23

Proposed solution

I will have to explore how to do this, but for automated builds, latexmk should probably be told to ignore global configurations. This can be done with latexmk>=v. 4.27a by passing the -norc flag.

@mforbes mforbes added the bug Something isn't working label Feb 11, 2025
@mforbes
Copy link
Author

mforbes commented Feb 11, 2025

It looks like the latexmk command line is fairly hard-coded:

const baseCommand = `latexmk -f ${engine} -synctex=1 -interaction=batchmode -file-line-error -latexoption="-shell-escape" ${texFile}`;

There should probably be a configuration variable allowing for customizations like included -norc (although, this should probably be the default). I am not sure if there is a suitable use-case where global latexmkrc customizations would be important for mystmd generation, but I expect there are cases, so there should be some option for doing this.

@rowanc1
Copy link
Member

rowanc1 commented Feb 11, 2025

If you add that -norc flag in the dev version (or just the compiled javascript which you can find under which myst and search for latexmk in any text editor, which might be easier for you to test?!). Does that fix the problem for you?

@mforbes
Copy link
Author

mforbes commented Feb 11, 2025

Yes. I installed the sources and ran from that, and adding -norc works for this particular issue. I expect this should be the default, but am trying to better understand the structure of the code so I can submit a PR because it should probably be configurable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants