[texworks] LaTeXmk issue with Mac OS X Yosemite (new OS)

Stefan Löffler st.loeffler at gmail.com
Sun Oct 19 17:07:44 CEST 2014


Hi,

On 19.10.2014 16:53, Guillaume Cabanac wrote:
>> Sigh... there is definitely something wrong with TeXworks under Yosemite! I have had no problem with TeXShop using it's latexmk engines.
> I wanted to check that the environment of the process launched by TeXworks is OK.  So I added a Processing tool called env that launches the env command.  Here is the result
> The PATH does not reflect what I find in the "Paths for TeX and related programs" area under the "Typesetting" tab in the settings of TexWorks.  The path "/usr/texbin" shows up in the GUI but it seems not to be passed to the process.

The paths in the preferences are used by Tw (in addition to $PATH) to
find the primary typesetting program (in your case: latexmk). It is not
passed on to the program itself. If the program itself needs additional
programs, they should be in $PATH (which *should* be passed on to the
program, but apparently isn't).

As apparently it isn't, please try sourcing .bashrc and/or .profile
and/or other relevant files as I pointed out in my other post.

> I had a look into the TWSystemCmd.cpp class in the TeXworks repository:
>   https://code.google.com/p/texworks/source/browse/trunk/src/TWSystemCmd.h
>   https://code.google.com/p/texworks/source/browse/trunk/src/TWSystemCmd.cpp
>
> As I am not knowledgeable about Qt, I wondered how the process knows about the environment to set up?
>
> "Certain processes need special environment settings in order to operate. You can set environment variables for your process by calling setEnvironment(). To set a working directory, call setWorkingDirectory(). By default, processes are run in the current working directory of the calling process."  --  http://qt-project.org/doc/qt-5/qprocess.html
>
> Could it be that one needs to specify the environment of the process in the code? (http://qt-project.org/doc/qt-5/qprocess.html#setProcessEnvironment)
>
> If yes, why did LaTeXmk in TeXworks worked fine until this Yosemite OS came out?  How could Qt be affected by this update?

You're right, the environment needs to be passed on to QProcess. The
main part of the typesetting code is in TeXDocument::typeset()
(src/TeXDocument.cpp at 2559). Indeed, the system environment is queried at
src/TeXDocument.cpp at 2599 and is passed on to the typesetting process at
src/TeXDocument.cpp at 2653. So I see two possibilities: either
QProcess::systemEnvironment() returns a default environment, or
setEnvironment() does not work as expected.

Does Tw still find latexmk if you remove all paths from the preferences
(it should, if it picks up $PATH correctly).

Best,
Stefan


More information about the texworks mailing list