textmate/latex.tmbundle

Pythontex not detected?

Closed this issue · 9 comments

I'm having trouble running Pythontex with the latex bundle in Textmate 2.

Notes:

  • compiling in terminal through pidflatex example.tex, pythontex example.tex, pidflatex example.tex works as expected
  • using TextMate version 2.0-rc.4
  • compiled with -shell-escape option and latexmk

Here's an example document example.tex:

\documentclass{article}
\usepackage{pythontex}
\begin{document}

Hello!
\begin{pyblock}
a = 6
\end{pyblock}

\end{document}

When I build the document, example.pytxcode is written as expected, but no pythontex-files- directory is created.

screen shot 2017-09-03 at 10 16 12 pm

Thanks for this awesome bundle!

Hi Christopher,

thank you for the detailed issue description. I translated the sample document on my account, which worked without any problems. After that I followed the steps below.

  1. Enable the Guest User inside “System Preferences“ → “Users & Groups“ → “Guest User“: “Allow guests to log in to this computer”
  2. Enable Fast User Switching in “Users & Groups“ → “Login Options“
  3. Switch to the “Guest User” via the “Fast User Switching Menu Item“ in the right part of menu bar
  4. Open TextMate
  5. Install the LaTeX Bundle inside “Preferences” → “Bundles”
  6. Create a new document, paste your sample code into the document and save it as Test.tex inside the folder Documents
  7. Open the bundle preferences and check “Use Latexmk”
  8. Translate the document using “Typeset & View (PDF)”.

The steps above produced a PDF containing the text

      Hello!
a = 6

. Can you please check if the procedure above works for you too?

You can also try to clean your project directory via “Bundles” → “LaTeX” → “Tools” → “Clean”. Maybe that solves your problem. If it does not help, can you please also attach the log file:

log

to this issue description?

By the way: You do not need to add the TeX Binaries to PATH. If some of the commands do not work without changing $PATH, then please file an new issue about this problem. Thank you.

Thanks for the swift response! I tried this from the guest account as you suggested, but seem to be having the same issue: the document compiles, but without pythontex content and the pythontex-files directory is never created. (I did use a clean project directory).

The log file is attached.

example.log.txt

I just copied the contents of latex.tmbundle/Support/config/latexmkrc to the project directory and ran latexmk by command line. Everything works fine.

Could it be that Textmate is using a different installation latexmk on my machine?

It looks like Latexmk is not enabled. Can you please provide the output of the following Terminal command:

defaults read com.macromates.textmate | grep -E '^\s*latex'

? It should look something like this:

    latexAutoView = 1;
    latexEngineOptions = "-shell-escape";
    latexKeepLogWin = 1;
    latexTableColumns = 3;
    latexTableRows = 1;
    latexTableTabularOnly = 0;
    latexUselatexmk = 1;
    latexVerbose = 0;
    latexViewer = Skim;
    latextTableTabularOnly = 0;

. While you are at it, can you please also check if your disk contains any bundle modifications?

Could it be that Textmate is using a different installation latexmk on my machine?

I do not think so. As far as I can tell, “Typeset & View (PDF)” does not seem to use Latexmk at all.

defaults read com.macromates.textmate | grep -E '^\s*latex' provides:

latexEngineOptions = "-shell-escape";
    latexUselatexmk = 1;
    latexViewer = Skim;

I don't believe I made any modifications to the latex tm bundle. Happy to reinstall it.

The compilation window shows

screen shot 2017-09-04 at 8 58 13 am

**Disclaimar: The log file I posted was from he Guest account, which I have since logged out of (so files deleted...). defaults read com.macromates.textmate | grep -E '^\s*latex' was run on my account, so it could be different. Log file from my account below
example.log.txt

Does the command

mdfind -name '"latex.tmbundle"c' | grep -iE '\.tmbundle$'

only print a single bundle location?

The compilation window shows…

Interesting — Does it show that error before or after you copied latex.tmbundle/Support/config/latexmkrc to the project directory? Can you please also provide the output of the Terminal command:

mdfind -name latexmk | grep '/latexmk$'

? Sorry for the many questions…

Sigh. I don't think this was a latex.tmbundle bundle issue at all. The issue seems to have been making sure that the version of Python used by latexmk had the pygments package installed.

I think what happened was:

  • on my main account cchudzicki, latexmk worked fine from terminal because my default python is Anaconda, which has pygments installed. But when Textmate called latexmk, it was using system python which had no pygments
  • on guest account, Textmate and and terminal both used system python, so neither worked.

On my main account, I resulted this by setting Textmate's path to

/anaconda/bin:$PATH:/opt/local/bin:/usr/local/bin:/usr/texbin

in order to prioritize anaconda python (which I want to be using for other reasons, anyway). Now everything works!

Thank you so much for you help—your advice to test this on Guest account was indispensable.

Edit: I'm going to close issue. Thanks again!

PS: Re your earlier comment, I am pretty sure that I did not add TeX binaries to the Textmate's PATH variable. Is it possible they were added automatically?

Thank you so much for you help—your advice to test this on Guest account was indispensable.

Glad that I was able to help you a little bit 😊.

I am pretty sure that I did not add TeX binaries to the Textmate's PATH variable. Is it possible they were added automatically?

I just checked the PATH variable in the guest account. Looks like the value in your screenshot above – including the entry /usr/texbin – is the standard one. By default the redefinition of the variable PATH is disabled though (no checkmark).