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

Is it possible to add an options to use other latex engines? #1341

Open
likanzhan opened this issue Jun 16, 2020 · 9 comments · May be fixed by #2350
Open

Is it possible to add an options to use other latex engines? #1341

likanzhan opened this issue Jun 16, 2020 · 9 comments · May be fixed by #2350
Labels
Format: LaTeX Related to the LaTeX / PDF output help wanted Type: Enhancement

Comments

@likanzhan
Copy link
Contributor

My documents include Mandarin Chinese characters.
So I'm wondering whether it is possible to add an argument to allowing switching latex engines?

Thanks.

@mortenpi
Copy link
Member

What exactly would you like to change about the LaTeX call? If Chinese characters are not getting rendered it might actually be a font issue?

@likanzhan
Copy link
Contributor Author

@mortenpi

  1. In a normal .tex file, I need to load the \usepackage{ctex} in the preamble and
    use the xelatex engine to compile the file.

  2. I intend to test whether engine xelatex works or not. I change the peperun from lualatex to xelatex:

piperun(`latexmk -f -interaction=nonstopmode -view=none -xelatex -shell-escape $texfile`)

  1. But I get the following error
localhost:~ lzhan$ julia /Users/lzhan/Downloads/ZL/docs/make.jl

[ Info: SetupBuildDirectory: setting up build directory.
[ Info: Doctest: running doctests.
[ Info: ExpandTemplates: expanding markdown templates.
[ Info: CrossReferences: building cross-references.
[ Info: CheckDocument: running document checks.
[ Info: Populate: populating indices.
[ Info: RenderDocument: rendering document.
[ Info: LaTeXWriter: rendering PDF.
[ Info: LaTeXWriter: using latexmk to compile tex.
localhost:~ lzhan$ julia /Users/lzhan/Downloads/ZL/docs/make.jl
[ Info: SetupBuildDirectory: setting up build directory.
[ Info: Doctest: running doctests.
[ Info: ExpandTemplates: expanding markdown templates.
[ Info: CrossReferences: building cross-references.
[ Info: CheckDocument: running document checks.
[ Info: Populate: populating indices.
[ Info: RenderDocument: rendering document.
[ Info: LaTeXWriter: rendering PDF.
[ Info: LaTeXWriter: using latexmk to compile tex.
┌ Error: LaTeXWriter: failed to compile tex with latexmk. Logs and partial output can be found in /var/folders/qz/0srg88cd2459h1cbn623wrt00000gq/T/jl_e3R1H8.
│   exception =
│    failed process: Process(`latexmk -f -interaction=nonstopmode -view=none -xelatex -shell-escape TEST.tex`, ProcessExited(12)) [12]
│
└ @ Main ~/Downloads/ZL/contrib/LaTeXWriter.jl:19
ERROR: LoadError: Compiling the .tex file failed. See logs for more information.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] (::Documenter.Writers.LaTeXWriter.var"#5#8"{Documenter.Documents.Document,Documenter.Writers.LaTeXWriter.LaTeX})() at /Users/lzhan/.julia/packages/Documenter/PLD7m/src/Writers/LaTeXWriter.jl:153
 [3] cd(::Documenter.Writers.LaTeXWriter.var"#5#8"{Documenter.Documents.Document,Documenter.Writers.LaTeXWriter.LaTeX}, ::String) at ./file.jl:104
 [4] (::Documenter.Writers.LaTeXWriter.var"#4#7"{Documenter.Documents.Document,Documenter.Writers.LaTeXWriter.LaTeX})(::String) at /Users/lzhan/.julia/packages/Documenter/PLD7m/src/Writers/LaTeXWriter.jl:100
 [5] mktempdir(::Documenter.Writers.LaTeXWriter.var"#4#7"{Documenter.Documents.Document,Documenter.Writers.LaTeXWriter.LaTeX}, ::String; prefix::String) at ./file.jl:682
 [6] mktempdir at ./file.jl:680 [inlined] (repeats 2 times)
 [7] render(::Documenter.Documents.Document, ::Documenter.Writers.LaTeXWriter.LaTeX) at /Users/lzhan/.julia/packages/Documenter/PLD7m/src/Writers/LaTeXWriter.jl:98
 [8] runner(::Type{Documenter.Writers.LaTeXFormat}, ::Documenter.Writers.LaTeXWriter.LaTeX, ::Documenter.Documents.Document) at /Users/lzhan/.julia/packages/Documenter/PLD7m/src/Writers/Writers.jl:41
 [9] dispatch(::Type{Documenter.Writers.FormatSelector}, ::Documenter.Writers.LaTeXWriter.LaTeX, ::Vararg{Any,N} where N) at /Users/lzhan/.julia/packages/Documenter/PLD7m/src/Utilities/Selectors.jl:167
 [10] render(::Documenter.Documents.Document) at /Users/lzhan/.julia/packages/Documenter/PLD7m/src/Writers/Writers.jl:107
 [11] runner(::Type{Documenter.Builder.RenderDocument}, ::Documenter.Documents.Document) at /Users/lzhan/.julia/packages/Documenter/PLD7m/src/Builder.jl:245
 [12] dispatch(::Type{Documenter.Builder.DocumentPipeline}, ::Documenter.Documents.Document) at /Users/lzhan/.julia/packages/Documenter/PLD7m/src/Utilities/Selectors.jl:167
 [13] #2 at /Users/lzhan/.julia/packages/Documenter/PLD7m/src/Documenter.jl:240 [inlined]
 [14] cd(::Documenter.var"#2#3"{Documenter.Documents.Document}, ::String) at ./file.jl:104
 [15] #makedocs#1 at /Users/lzhan/.julia/packages/Documenter/PLD7m/src/Documenter.jl:239 [inlined]
 [16] top-level scope at /Users/lzhan/Downloads/ZL/docs/make.jl:7
 [17] include(::Module, ::String) at ./Base.jl:377
 [18] exec_options(::Base.JLOptions) at ./client.jl:288
 [19] _start() at ./client.jl:484
in expression starting at /Users/lzhan/Downloads/ZL/docs/make.jl:7

@fredrikekre
Copy link
Member

The easiest might be to have an option to change the docker image.

@fredrikekre
Copy link
Member

See #979

@likanzhan
Copy link
Contributor Author

@fredrikekre
Thanks, if I want to the option platform = native and want to use the xelatex engine, what is the correct way to manually set this?

I've tried to edit the latexwriter.jl from

piperun(`latexmk -f -interaction=nonstopmode -view=none -lualatex -shell-escape $texfile`)

to

piperun(`latexmk -f -interaction=nonstopmode -view=none -xelatex -shell-escape $texfile`)

But I got the errors mentioned above.

Any suggestion to correct this?

Thanks.

@fredrikekre
Copy link
Member

I guess you have to look at the logs to really see what the problem was.

@mortenpi mortenpi added Format: LaTeX Related to the LaTeX / PDF output Type: Enhancement help wanted labels Jun 18, 2020
@mortenpi
Copy link
Member

mortenpi commented Jun 18, 2020

FWIW, with #1339 it will be possible to easily extract the compiled TeX files and then experiment with build commands.

Regarding the issue, I'd say that if someone needs it, it would not hurt being able to pass customized compilation commands to LaTeX. It should be reasonably straightforward to generalize compile_tex for this.

@likanzhan
Copy link
Contributor Author

@mortenpi

To extract the compile TeX files is very helpful.
And It seems that my problems is indeed related to fonts.

It is strange, however, why no error is observed when the latex engine is lualatex.

@BambOoxX
Copy link

I think I have found a way to make "native" more generic than latexmk. I will try to propose a PR this week-end.

@BambOoxX BambOoxX linked a pull request Nov 18, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Format: LaTeX Related to the LaTeX / PDF output help wanted Type: Enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants