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

LaTeX will use pre-existing "notebook.tex" file #750

Closed
t-makaro opened this issue Feb 2, 2018 · 7 comments
Closed

LaTeX will use pre-existing "notebook.tex" file #750

t-makaro opened this issue Feb 2, 2018 · 7 comments

Comments

@t-makaro
Copy link
Contributor

t-makaro commented Feb 2, 2018

I noticed that if a file with the name "notebook.tex" already exists in the current directory, then the conversion to pdf will not overwrite this file (probably good) and it will use that file to produce a (possibly completely different) pdf as the net result.

I've noticed a similar issue with using template files named "notebook.tplx" too.

@takluyver
Copy link
Member

The intermediate tex file should always be written to a temporary directory, so that it doesn't interfere with anything in your working directory. If latex then uses notebook.tex from the cwd in preference to our temporary file, that is indeed a problem.

@t-makaro
Copy link
Contributor Author

t-makaro commented Feb 2, 2018

Yes, latex is preferring the wrong file.

@mpacer
Copy link
Member

mpacer commented Feb 3, 2018

can you give a directory structure & a sequence of commands (noting your working directory) that exhibits this pattern so I can try to reproduce it?

@t-makaro
Copy link
Contributor Author

t-makaro commented Feb 3, 2018

I'm on windows 10, using nbconvert 5.3.1 and MikTex-XeTeX 2.9.6501.

A directory like:

test/
    analysis.ipynb
    notebook.tex

then running:

D:\test> jupyter nbconvert --to pdf analysis.ipynb

results in the file analysis.pdf compiled from the pre-existing notebook.tex. I also found that the download as pdf (via LaTeX) from within Jupyter notebook (running "analysis.ipynb") also resulted in the use of the wrong tex file.

@takluyver
Copy link
Member

I suspect that the culprit is one of the environment variables we set, like TEXINPUTS. We do that so that if the notebook references another file in its directory, such as an image, it will be found when running latex.

Maybe if we also add the temporary directory to the search path in TEXINPUTS, we can ensure that the right file is found.

@haraldschilly
Copy link

I just helped someone who got bitten by that. Maybe when the latex compiler is invoked, the filename to the temporary notebook.tex file should be an absolute path? Just a quick thought … no idea if that wouldn't break other situations.

@t-makaro
Copy link
Contributor Author

I think this might get fixed by #768 since the notebook.tex file that nbconvert uses will always be from the temp directory.

@t-makaro t-makaro closed this as completed Sep 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants