0

LaTeX fails to pass the command to bash even though PATH is specified. For example, I am trying to invoke texcount, which is in directory /Library/TeX/textbin. When I check echo $PATH, the output I get is follows:

/Library/TeX/textbin:/opt/local/bin:/opt/local/sbin:/Applications/Inkscape.app/Contents/Resources/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin

Even when I run texcount from MacOS terminal, it works fine. However, it does not work when I have my command defined as:

\NewDocumentCommand\wordcount{s}{\immediate\write18{texcount}}

Instead if I specify full PATH as \NewDocumentCommand\wordcount{s}{\immediate\write18{/Library/TeX/textbin/texcount}}, it works fine.

  • /Library/TeX/textbin would seem to be a typo. Try /Library/TeX/texbin instead. For sure, the MacTeX installation on my system has lots of files (including texcount) under /Libary/TeX/texbin... – Mico Feb 17 at 8:19
  • I do not know why, my MacTeX installation has two folders /Library/TeX/texbin and /Library/TeX/textbin. They both are equivalent and I tried with both options in my PATH. No luck though. – MahiPai Feb 17 at 8:26
  • If there are two similar-looking folder names, chances are that something went badly wrong during the installation of MacTeX. (You're on MacTeX2018, right?) I would blow away both /Library/TeX/texbin and /Library/TeX/textbin and reinstall MacTeX from scratch. Do also make sure that, from now on, the first entry in the path variable points to /Library/TeX/texbin (not textbin). – Mico Feb 17 at 8:39
  • 1
    have you used the --shell-escape option to allow calling the shell? – David Carlisle Feb 17 at 8:51
  • 1
    try \write18{echo $PATH} and see what path is being set in the tex enviornment – David Carlisle Feb 17 at 8:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.