Merge pull request #3466 from jfbu/lualatexsettings

same default settings for lualatex as for xelatex
This commit is contained in:
Jean-François B 2017-02-27 12:19:32 +01:00 committed by GitHub
commit 56d446cb42
5 changed files with 21 additions and 1 deletions

View File

@ -37,6 +37,7 @@ addons:
- texlive-latex-extra - texlive-latex-extra
- texlive-fonts-recommended - texlive-fonts-recommended
- texlive-fonts-extra - texlive-fonts-extra
- texlive-luatex
- texlive-xetex - texlive-xetex
- lmodern - lmodern
install: install:

View File

@ -18,6 +18,9 @@ Incompatible changes
relative (refs #3412) relative (refs #3412)
* ``literalinclude`` directive does not allow the combination of ``:diff:`` * ``literalinclude`` directive does not allow the combination of ``:diff:``
option and other options (refs: #3416) option and other options (refs: #3416)
* Default config for LuaLaTeX engine uses ``fontspec`` hence needs TeXLive 2013
or more recent TeX installation for compatibility. This also means that the
fonts used by default have changed to the defaults as chosen by ``fontspec``.
Features removed Features removed
---------------- ----------------
@ -62,6 +65,8 @@ Features added
headers) (refs: #3422) headers) (refs: #3422)
* Emit warning if over dedent has detected on ``literalinclude`` directive * Emit warning if over dedent has detected on ``literalinclude`` directive
(refs: #3416) (refs: #3416)
* Use for LuaLaTeX same default settings as for XeLaTeX (i.e. ``fontspec`` and
``polyglossia``).
Bugs fixed Bugs fixed
---------- ----------

View File

@ -1665,6 +1665,8 @@ These options influence LaTeX output. See further :doc:`latex`.
.. versionchanged:: 1.5 .. versionchanged:: 1.5
For :confval:`latex_engine` set to ``'xelatex'``, the default For :confval:`latex_engine` set to ``'xelatex'``, the default
is ``'\\usepackage{polyglossia}\n\\setmainlanguage{<language>}'``. is ``'\\usepackage{polyglossia}\n\\setmainlanguage{<language>}'``.
.. versionchanged:: 1.6
``'lualatex'`` uses same default setting as ``'xelatex'``
``'fontpkg'`` ``'fontpkg'``
Font package inclusion, default ``'\\usepackage{times}'`` (which uses Font package inclusion, default ``'\\usepackage{times}'`` (which uses
Times and Helvetica). You can set this to ``''`` to use the Computer Times and Helvetica). You can set this to ``''`` to use the Computer
@ -1675,6 +1677,8 @@ These options influence LaTeX output. See further :doc:`latex`.
script. script.
.. versionchanged:: 1.5 .. versionchanged:: 1.5
Defaults to ``''`` when :confval:`latex_engine` is ``'xelatex'``. Defaults to ``''`` when :confval:`latex_engine` is ``'xelatex'``.
.. versionchanged:: 1.6
Defaults to ``''`` also with ``'lualatex'``.
``'fncychap'`` ``'fncychap'``
Inclusion of the "fncychap" package (which makes fancy chapter titles), Inclusion of the "fncychap" package (which makes fancy chapter titles),
default ``'\\usepackage[Bjarne]{fncychap}'`` for English documentation default ``'\\usepackage[Bjarne]{fncychap}'`` for English documentation
@ -1740,6 +1744,8 @@ These options influence LaTeX output. See further :doc:`latex`.
.. versionchanged:: 1.5 .. versionchanged:: 1.5
Defaults to ``'\\usepackage{fontspec}'`` when Defaults to ``'\\usepackage{fontspec}'`` when
:confval:`latex_engine` is ``'xelatex'``. :confval:`latex_engine` is ``'xelatex'``.
.. versionchanged:: 1.6
``'lualatex'`` also uses ``fontspec`` per default.
``'geometry'`` ``'geometry'``
"geometry" package inclusion, the default definition is: "geometry" package inclusion, the default definition is:

View File

@ -120,6 +120,10 @@ ADDITIONAL_SETTINGS = {
}, },
'lualatex': { 'lualatex': {
'latex_engine': 'lualatex', 'latex_engine': 'lualatex',
'polyglossia': '\\usepackage{polyglossia}',
'babel': '',
'fontenc': '\\usepackage{fontspec}',
'fontpkg': '',
'utf8extra': ('\\catcode`^^^^00a0\\active\\protected\\def^^^^00a0' 'utf8extra': ('\\catcode`^^^^00a0\\active\\protected\\def^^^^00a0'
'{\\leavevmode\\nobreak\\ }'), '{\\leavevmode\\nobreak\\ }'),
}, },
@ -577,7 +581,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
# set up multilingual module... # set up multilingual module...
# 'babel' key is public and user setting must be obeyed # 'babel' key is public and user setting must be obeyed
if self.elements['babel']: if self.elements['babel']:
# this branch is not taken for xelatex with writer default settings # this branch is not taken for xelatex/lualatex if default settings
self.elements['multilingual'] = self.elements['babel'] self.elements['multilingual'] = self.elements['babel']
if builder.config.language: if builder.config.language:
self.elements['shorthandoff'] = self.babel.get_shorthandoff() self.elements['shorthandoff'] = self.babel.get_shorthandoff()

View File

@ -14,6 +14,7 @@ import os
import re import re
from itertools import product from itertools import product
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
from shutil import copyfile
from six import PY3 from six import PY3
import pytest import pytest
@ -67,6 +68,9 @@ def compile_latex_document(app):
with cd(app.outdir): with cd(app.outdir):
try: try:
ensuredir(app.config.latex_engine) ensuredir(app.config.latex_engine)
# keep a copy of latex file for this engine in case test fails
copyfile('SphinxTests.tex',
app.config.latex_engine + '/SphinxTests.tex')
p = Popen([app.config.latex_engine, p = Popen([app.config.latex_engine,
'--interaction=nonstopmode', '--interaction=nonstopmode',
'-output-directory=%s' % app.config.latex_engine, '-output-directory=%s' % app.config.latex_engine,