Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XeLaTeX support #291

Merged
merged 3 commits into from
May 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/src/man/save.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ PGFPlotsX.CLASS_OPTIONS

## Choosing the LaTeX engine used

Thee are two different choices for latex engines, `PDFLATEX`, `LUALATEX`.
By default, `LUALATEX` is used if it was available during `Pkg.build()`. The active engine can be retrieved with the `latexengine()` function and be set with `latexengine!(engine)` where `engine` is one of the two previously mentioned engines (e.g. `PGFPlotsX.PDFLATEX`).
Thee are three different choices for latex engines, `PDFLATEX`, `LUALATEX` and `XELATEX`.
By default, `LUALATEX` is used if it was available during `Pkg.build()`. The active engine can be retrieved with the `latexengine()` function and be set with `latexengine!(engine)` where `engine` is one of the three previously mentioned engines (i.e. `PGFPlotsX.PDFLATEX` or `PGFPlotsX.XELATEX`).

## Custom flags

Expand Down
6 changes: 3 additions & 3 deletions src/build.jl
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
################
# LaTeX-engine #
################
@enum(LaTeXEngine, LUALATEX, PDFLATEX)
@enum(LaTeXEngine, LUALATEX, PDFLATEX, XELATEX)

"""
The active LaTeX engine. Initialized the first time [`latexengine`](@ref) is called.
"""
const ACTIVE_LATEX_ENGINE = Ref{Union{Nothing, LaTeXEngine}}(nothing)
function latexengine()
if ACTIVE_LATEX_ENGINE[] === nothing
for (engine, enum) in zip(("lualatex", "pdflatex"), (LUALATEX, PDFLATEX))
for (engine, enum) in zip(("lualatex", "pdflatex", "xelatex"), (LUALATEX, PDFLATEX, XELATEX))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to pick xelatex over pdflatex if we find it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know much about XeLaTeX, so I would stick with the ordering above and leave it to the user to request something else.

@debug "latexengine: looking for latex engine $engine"
if Sys.which(engine) !== nothing
@debug "latexengine: found latex engine $engine, using it"
return ACTIVE_LATEX_ENGINE[] = enum
end
end
throw(MissingExternalProgramError("No LaTeX installation found, figures will not be generated. ",
"Make sure either pdflatex or lualatex are installed and that ",
"Make sure either pdflatex, xelatex or lualatex are installed and that ",
"the PATH variable is correctly set."))
end
return ACTIVE_LATEX_ENGINE[]
Expand Down