TeXstudio locale issues with LuaLaTeX

512 views Asked by At

I am having trouble running lualatex from TeXstudio, seemingly due to issues with some locale settings. My environment is a pretty stock Fedora 37 with a local TeXLive installation (using the TeXLive installer instead of distribution repository).

When I try to run the default Latexmk command (e.g. via Tools->Commands->Latexmk) I get the following output:

Process started: latexmk -lualatex -silent -synctex=1 "Document"

perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LC_MEASUREMENT = "de_DE.UTF-8", LC_MONETARY = "de_DE.UTF-8", LANG = "Default.UTF-8" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C").
Unable to read environment locale: exit now.
Latexmk: fls file doesn't appear to have been made. Latexmk: Couldn't read log file 'Dissertation.log': No such file or directory ---------------------- This message may duplicate earlier message. Latexmk: Failure in processing file 'Dissertation': *LaTeX didn't generate the expected log file 'Dissertation.log' ---------------------- Latexmk: If appropriate, the -f option can be used to get latexmk to try to force complete processing.
Process exited with error(s)

Note that I have changed the configuration of the Latexmk command to use lualatex (I replaced the -pdf option by -lualatex). The issue does not occur when using pdflatex. I am pretty sure the issue is not related to latexmk (it just prints more information), but to lualatex, since a simple call of the builtin LuaLaTeX command (e.g. via Tools->Commands->LuaLaTeX) results in an error as well.

Interestingly, when I configured a custom user command to read the locale settings (just executing locale), I get the following output:

Process started: locale

LANG=Default.UTF-8
LC_CTYPE="Default.UTF-8"
LC_NUMERIC="Default.UTF-8"
LC_TIME="Default.UTF-8"
LC_COLLATE="Default.UTF-8"
LC_MONETARY=de_DE.UTF-8
LC_MESSAGES="Default.UTF-8"
LC_PAPER="Default.UTF-8"
LC_NAME="Default.UTF-8"
LC_ADDRESS="Default.UTF-8"
LC_TELEPHONE="Default.UTF-8"
LC_MEASUREMENT=de_DE.UTF-8
LC_IDENTIFICATION="Default.UTF-8"
LC_ALL=
/usr/bin/locale: Cannot set LC_CTYPE to default locale: No such file or directory /usr/bin/locale: Cannot set LC_MESSAGES to default locale: No such file or directory /usr/bin/locale: Cannot set LC_ALL to default locale: No such file or directory
Process exited normally

While all those Default.UTF-8 entries seem to make sense, the error/warning message at the end confuses me. I have no clue, why reading the locale settings implies setting something, and I have also no idea, why only LC_CTYPE, LC_MESSAGES and LC_ALL are affected.

For comparison, this is the output I get when running locale in a terminal (including the TeXstudio integrated terminal):

LANG=en_US.UTF-8
LC_CTYPE=C.UTF-8
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=de_DE.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT=de_DE.UTF-8
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

My current workaround is to run latexmk in an external terminal (which works fine), but this is not only cumbersome (switching between windows), but I also don't get the nicely parsed error messages and other convenience features of TeXstudio. I would definitive prefer to build the document via TeXstudio as well.

1

There are 1 answers

0
Thargon On

For anyone interested, I have found a workaround by using a tiny bash script:

# make sure environment variables are correct (especially locales)
source ${HOME}/.bashrc

# just run make and forward any arguments
make $@

The last line calls make, which eventually calls latexmk in my case.

Now I have defined some custom build commands:

  • 'user0:build': sh tiny_bash_script.sh all
  • 'user1:forccebuild': sh tiny_bash_script.sh all -B
  • 'user2:clean': sh tiny_bash_script.sh clean
  • 'user3:wipe': sh tiny_bash_script.sh wipe

Each command executes the above bash script and passes some arguments to make, which then does its thing according to the Makefile located in the same folder.

These commands can be executed using the TeXstudio GUI (via Tools->User). Most importantly, however, such a command can be set as default compilation command in the Build configuration menu (Options->Configure TeXstudio) by setting the "Default Compiler" option to txs:///user0, for example.

When compiling the project (e.g. by hitting F5), the expected output is printed in the "Messages" tab and the Log is also parsed automatically, so you get a nice overview of all warnings & errors and can click-jump to the according lines in the project - just as it's supposed to work.