SublimeText / LaTeXTools

LaTeX plugin for Sublime Text
https://latextools.readthedocs.io/
2k stars 364 forks source link

Program selection does not work #1455

Closed slhck closed 4 years ago

slhck commented 4 years ago

I am using a document starting with:

%!TEX program = xelatex
%!TEX encoding = UTF-8 Unicode

When I hit Cmd-B, the log shows:

TraditionalBuilder: Engine: pdflatex. Invoking latexmk... done.

Errors:

/usr/local/texlive/2019/texmf-dist/tex/latex/fontspec/fontspec.sty:45: Fatal Package fontspec Error: The fontspec package requires either XeTeX or [\msg_fatal:nn {fontspec} {cannot-use-pdftex}]

In the documentation, it says:

If the first line of the current file consists of the text %!TEX program = <program>, where program is pdflatex, lualatex or xelatex, the corresponding engine is selected. If no such directive is specified, pdflatex is the default. Multi-file documents are supported: the directive must be in the root (i.e. master) file. Also, for compatibility with TeXshop, you can use TS-program instead of program.

So I would assume that it should automatically compile with XeLaTeX.

I have not modified my user settings for LaTeXTools.

Here's the output of the system check. Interestingly it says "LaTeX Engine: xelatex"…

Variable   Value
--------   -----
PATH       /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/TeX/texbin:/usr/texbin:/usr/local/bin:/opt/local/bin
TEXINPUTS  <shortened>

Program      Location                       Status     Version
-------      --------                       ------     -------
latexmk      /Library/TeX/texbin/latexmk    available  Latexmk, John Collins, 18 June 2019. Version 4.65
pdflatex     /Library/TeX/texbin/pdflatex   available  pdfTeX 3.14159265-2.6-1.40.20 (TeX Live 2019)
xelatex      /Library/TeX/texbin/xelatex    available  XeTeX 3.14159265-2.6-0.999991 (TeX Live 2019)
lualatex     /Library/TeX/texbin/lualatex   available  This is LuaTeX, Version 1.10.0 (TeX Live 2019)
biber        /Library/TeX/texbin/biber      available  biber version: 2.12
bibtex       /Library/TeX/texbin/bibtex     available  BibTeX 0.99d (TeX Live 2019)
bibtex8      /Library/TeX/texbin/bibtex8    available  This is 8-bit Big BibTeX version 0.99d
kpsewhich    /Library/TeX/texbin/kpsewhich  available  kpathsea version 6.3.1
magick       /usr/local/bin/magick          available  ImageMagick 7.0.9-8 Q16 x86_64 2019-12-09 https://imagemagick.org
ghostscript  /usr/local/bin/gs              available  GPL Ghostscript 9.50 (2019-10-15)

Packages for equation preview  Status
-----------------------------  ------
standalone                     available
preview                        available
xcolor                         available
amsmath                        available
amssymb                        available
latexsym                       available
mathtools                      available

Builder      Status
-------      ------
traditional  available

Builder Setting  Value
---------------  -----
display_log      False
linux            {}   
osx              {}   
windows          {}   

TeX Root
--------
<redacted>

LaTeX Engine
------------
xelatex     

Viewer  Status     Location
------  ------     --------
skim    available  /Applications/Skim.app
r-stein commented 4 years ago

Could it be the case, that you have selected the builder in the builder panel, i.e. LaTeX - PdfLaTeX?

Press C-shift-b and just select LaTeX, this should hopefully solve the issue.

The precedence should be selected builder > %!TEX program > configuration.

slhck commented 4 years ago

Yes, that did the trick, thank you! I didn't know I could select a builder. Where is this stored? Is it a per-project setting?

r-stein commented 4 years ago

The builder selection is a built-in sublime text feature, which is stored in sublime text itself. I don't know exactly in which scope the selection is stored, just that the selection also pops up with C-b if no entry has been selected before.

ig0774 commented 4 years ago

Last time I looked, this was stored in ST’s workspace tracking file(s) and not exposed through the APIs, so there’s no way for a plug-in to know which builder variant is selected.