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

Consider adding XeTeX support in LaTeX generation in quickstart mode for a better support for East Asian languages. #894

Closed
shimizukawa opened this issue Jan 3, 2015 · 15 comments
Labels
builder:latex type:enhancement enhance or introduce a new feature
Milestone

Comments

@shimizukawa
Copy link
Member

It's easy to generate pdf from xetex.

$ xelatex SomeBook.tex

and the minimal template looks like below:

\documentclass[a4paper,10pt]{article}
\usepackage{fontspec}
\setmainfont{AR PL UMing TW} % specify a font here since the default font does not support Chinese or Japanese 
\XeTeXlinebreaklocale "zh" % or ja for Japanese but very similar
\XeTeXlinebreakskip = 0pt plus 1pt
\begin{document}
% text goes here.
\end{document}

and the problem with latex's babel, Chinese and Japanese don't need it and are not supported.


@shimizukawa shimizukawa added this to the some future version milestone Jan 3, 2015
@shimizukawa shimizukawa added type:enhancement enhance or introduce a new feature builder:latex labels Jan 3, 2015
@shimizukawa
Copy link
Member Author

From Jan Ulrich Hasecke on 2014-01-29 16:58:59+00:00

I would appreciate an option to have a XeLaTeX or LuaLaTeX option in the Makefile. This would make it easy to use many more system fonts like OpenType Fonts etc.

@frol
Copy link

frol commented Jan 30, 2015

I've added these lines into the Makefile and it works for me:

xelatex:
    $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
    @echo "Running XeLaTeX files through xelatex..."
    sed -i s/pdflatex/xelatex/ $(BUILDDIR)/latex/Makefile
    $(MAKE) -C $(BUILDDIR)/latex all-pdf
    @echo "xelatex finished; the PDF files are in $(BUILDDIR)/latex."

@ghost
Copy link

ghost commented Jun 8, 2015

You can get better utf-8 support and better font support with a little more work, for example:
#1923 gives some ideas for setting up a more modern and featureful xelatex; note it works with sphinx 1.2.3 but is broken in 1.3.x.

Having such support enabled by default with sphinx would be a great improvement; currently many unicode characters in the sphinx text render fine as HTML but are mangled by pdflatex; with the above you get much better support.

@asr
Copy link

asr commented Dec 5, 2015

I would appreciate an option to have a XeLaTeX or LuaLaTeX option in the Makefile.

👍

@nowox
Copy link

nowox commented Apr 19, 2016

+1

@tk0miya tk0miya modified the milestones: 1.5, some future version Apr 20, 2016
@tk0miya
Copy link
Member

tk0miya commented Apr 20, 2016

I added lualatexpdf and xelatexpdf to Makefile.
These will be released at next major release (v1.5).

@asr
Copy link

asr commented Apr 20, 2016

Great! Thanks!

asr added a commit to agda/agda that referenced this issue Apr 22, 2016
@nowox
Copy link

nowox commented Apr 22, 2016

Not sure if adding static entries on the Makefile is a good solution make latex and make ldflatex should be the only rules to make a LaTeX2e output. Choosing between different engines such as lualatex or xelatex could be done from the config file.

I think the best solution would be to use latexmk for any cases.

@asr
Copy link

asr commented Apr 22, 2016

What about if you want to use/test the different LaTeX engines?

The xelatexpdf rule is working very well for generating the Agda documentation (we use a lot Unicode characters).

I think the best solution would be to use latexmk for any cases.

+1

@tk0miya
Copy link
Member

tk0miya commented Apr 23, 2016

That sounds good. But it requires much refactoring to do that.
Please send us new pull request if possible:-)

@nowox
Copy link

nowox commented Apr 25, 2016

I looked at the LaTeX writer/builder and I think I can do some rework, but I need some time to understand the code (which is not very documented). Here what I would like to improve:

  • The LaTeX Makefile is not very written in a make way. The for loop on the recipes should be implemented using patten rules (%.dvi: %.tex)
  • An option should be available to put the figures into a figure directory
  • I think to write a generic Makefile using jinja2 where the engine is configured from the sphinx conf. There is no point to have the choice, if the code generated is only compatible with xelatex, why offering an option to use lualatex?
  • On writers/latex.py the LaTeX header is hard-coded into HEADER variable. It is the same for the body and the footer. I would prefer using a template using jinja. It can be more convenient for the user to customize its own template rather than playing with the conf.py latex rules.
  • Configure the default LaTeX engine to be latexmk if installed on the system. Otherwise I may advise the user to install it and switch to xelatex or pdflatex as a second choice.
  • I noticed the figures and the texfiles are always recopied after each make. This is not good for the Makefile. So I prefer using a smart_copy method that check first if the destination file need to be updated.

I am not sure I can keep it fully backward compatible, but I can do my best...

So about the Makefile, I would keep the original sphinx makefile with two rules: latex and pdflatex and possibly just pdf since the final user does not need to know what engine is used make a pdf.

When is the 1.5 milestone expected?

@tk0miya
Copy link
Member

tk0miya commented Apr 26, 2016

I'm glad to hear that. We always needs your help :-)

Yes, there are many things we have to do.
To improve step by step, it would be better to file these idea as a issue and fix them one by one.
Could you file them please?

When is the 1.5 milestone expected?

Sorry, I don't know that. @shimizukawa Do you have any plan to 1.5?

@cpitclaudel
Copy link
Contributor

I'm confused by this change: although this adds a rule to call xelatex, the generated .tex files are not xelatex-compatible, are they? They use inputenc, fontenc, and babel instead of polyglossia. Did I miss something?

@shimizukawa
Copy link
Member Author

For now, I have no idea for about 1.5 release. I want to release this autumn.

@tk0miya
Copy link
Member

tk0miya commented May 24, 2016

@cpitclaudel I don't know what is xelatex-compatible. but now we can build the generated .tex files using xelatex command, and can customize the settings using conf.py.

$ cd sphinx
$ sphinx-build -b latex doc/ build
$ cd build
$ make PDFLATEX=xelatex

Of course, I know the generated .tex file is not optimized for XeTeX as you said. So we have to discuss about it and become it better.
If you have any ideas, please post it to #2513 or new issues. Any opinions and PRs are welcome.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
builder:latex type:enhancement enhance or introduce a new feature
Projects
None yet
Development

No branches or pull requests

6 participants