mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
no need to pass truedimen as class option, package option is enough
This commit is contained in:
parent
9c6a071572
commit
451115f2d1
@ -1733,11 +1733,15 @@ These options influence LaTeX output. See further :doc:`latex`.
|
||||
``'geometry'``
|
||||
"geometry" package inclusion, the default definition is:
|
||||
|
||||
``'\\usepackage{geometry}'`` (with ``[dvipdfm]`` for Japanese documents)
|
||||
``'\\usepackage{geometry}'``
|
||||
|
||||
and :file:`sphinx.sty` executes a ``\PassOptionsToPackages`` with
|
||||
``hmargin=1in,vmargin=1in,marginparwidth=0.5in``. See :doc:`latex`
|
||||
for the corresponding ``'sphinxsetup'`` options.
|
||||
with an additional ``[dvipdfm]`` for Japanese documents.
|
||||
The Sphinx LaTeX style file executes:
|
||||
|
||||
``\PassOptionsToPackage{hmargin=1in,vmargin=1in,marginpar=0.5in}{geometry}``
|
||||
|
||||
which can be customized via corresponding ``'sphinxsetup'`` options.
|
||||
See :doc:`latex`.
|
||||
|
||||
.. versionadded:: 1.5
|
||||
|
||||
@ -1745,24 +1749,20 @@ These options influence LaTeX output. See further :doc:`latex`.
|
||||
``dvipdfm`` option if :confval:`latex_engine` is ``'platex'``.
|
||||
|
||||
.. versionadded:: 1.5.3
|
||||
The ``'sphinxsetup'`` margin keys. See :doc:`latex`.
|
||||
The ``'sphinxsetup'`` keys for ``hmargin, ...``.
|
||||
|
||||
.. versionchanged:: 1.5.3
|
||||
The key is executed after the ``\sphinxsetup`` which follows
|
||||
The execution has been moved to after the ``\sphinxsetup`` which follows
|
||||
immediately the loading of :file:`sphinx.sty`. This is in order
|
||||
to handle the paper layout options in a special way for Japanese
|
||||
documents: the text width will be set to an integer multiple of the
|
||||
*zenkaku* width, and the text height to an integer multiple
|
||||
of the baseline.
|
||||
|
||||
Further, as the ``jsbook`` Japanese standard document class handles
|
||||
pointsize other than ``10pt`` in a special manner, Sphinx uses then
|
||||
as first document class option ``truedimen``: this will be received
|
||||
by ``geometry`` package and help it interpret correctly further
|
||||
class options such as ``letterpaper`` or ``a4paper``.
|
||||
|
||||
For ``jreport`` (Japanese ``'howto'`` documents), the situation is
|
||||
otherwise, and the ``truedimen`` must not be used for ``geometry``.
|
||||
For Japanese ``'manual'`` documents, Sphinx passes additionally to
|
||||
``geometry`` the ``truedimen`` option for compatibility with the way
|
||||
the ``jsbook`` class handles dimensions when the pointsize is not
|
||||
``10pt``.
|
||||
|
||||
``'babel'``
|
||||
"babel" package inclusion, default ``'\\usepackage{babel}'`` (the
|
||||
|
@ -14,13 +14,19 @@ The *latex* target does not benefit from pre-prepared themes like the
|
||||
.. raw:: latex
|
||||
|
||||
\begingroup
|
||||
\sphinxsetup{verbatimwithframe=false,%
|
||||
VerbatimColor={named}{OldLace}, TitleColor={named}{DarkGoldenrod},%
|
||||
hintBorderColor={named}{LightCoral}, attentionBgColor={named}{LightPink},%
|
||||
attentionborder=3pt, attentionBorderColor={named}{Crimson},%
|
||||
noteBorderColor={named}{Olive}, noteborder=2pt,%
|
||||
cautionBorderColor={named}{Cyan}, cautionBgColor={named}{LightCyan},%
|
||||
cautionborder=3pt}
|
||||
\sphinxsetup{%
|
||||
verbatimwithframe=false,
|
||||
VerbatimColor={named}{OldLace},
|
||||
TitleColor={named}{DarkGoldenrod},
|
||||
hintBorderColor={named}{LightCoral},
|
||||
attentionborder=3pt,
|
||||
attentionBorderColor={named}{Crimson},
|
||||
attentionBgColor={named}{FloralWhite},
|
||||
noteborder=2pt,
|
||||
noteBorderColor={named}{Olive},
|
||||
cautionborder=3pt,
|
||||
cautionBorderColor={named}{Cyan},
|
||||
cautionBgColor={named}{LightCyan}}
|
||||
\relax
|
||||
|
||||
|
||||
@ -109,13 +115,19 @@ If non-empty, it will be passed as argument to the ``\sphinxsetup`` command::
|
||||
dynamically the option values: this is actually what we did for the
|
||||
duration of this chapter for the PDF output, which is styled using::
|
||||
|
||||
\sphinxsetup{%
|
||||
verbatimwithframe=false,
|
||||
VerbatimColor={named}{OldLace}, TitleColor={named}{DarkGoldenrod},
|
||||
hintBorderColor={named}{LightCoral}, attentionBgColor={named}{LightPink},
|
||||
attentionborder=3pt, attentionBorderColor={named}{Crimson},
|
||||
noteBorderColor={named}{Olive}, noteborder=2pt,
|
||||
cautionBorderColor={named}{Cyan}, cautionBgColor={named}{LightCyan},
|
||||
cautionborder=3pt
|
||||
VerbatimColor={named}{OldLace},
|
||||
TitleColor={named}{DarkGoldenrod},
|
||||
hintBorderColor={named}{LightCoral},
|
||||
attentionborder=3pt,
|
||||
attentionBorderColor={named}{Crimson},
|
||||
attentionBgColor={named}{FloralWhite},
|
||||
noteborder=2pt,
|
||||
noteBorderColor={named}{Olive},
|
||||
cautionborder=3pt,
|
||||
cautionBorderColor={named}{Cyan},
|
||||
cautionBgColor={named}{LightCyan}}
|
||||
|
||||
and with the ``svgnames`` option having been passed to "xcolor" package::
|
||||
|
||||
@ -155,15 +167,15 @@ Here are the currently available options together with their default values.
|
||||
|
||||
For a ``'manual'`` type document, which by default uses the ``jsbook``
|
||||
LaTeX document class, the dimension units must be so-called "true"
|
||||
units:
|
||||
units::
|
||||
|
||||
'sphinxsetup': 'hmargin=1.5truein, vmargin=1.5truein, marginpar=2zw'
|
||||
'sphinxsetup': 'hmargin=1.5truein, vmargin=1.5truein, marginpar=5zw',
|
||||
|
||||
This is due to ``jsbook`` LaTeX class way of handling the pointsize
|
||||
when it is not ``10pt``.
|
||||
This is due to the LaTeX class ``jsbook``'s way of handling the
|
||||
pointsize when it is not ``10pt``.
|
||||
|
||||
To the contrary, the ``jreport`` class, which is used for ``'howto'``
|
||||
document must be configured with "normal" units.
|
||||
documents, must be configured with "normal" units.
|
||||
|
||||
.. versionadded:: 1.5.3
|
||||
|
||||
|
@ -1086,6 +1086,11 @@
|
||||
\newcommand*\sphinxtextlinesja[1]{%
|
||||
\numexpr\@ne+\dimexpr\paperheight-\topskip-\dimexpr#1+#1\relax\relax/
|
||||
\baselineskip\relax}%
|
||||
\ifx\@jsc@uplatextrue\undefined\else
|
||||
% the way we found in order for the papersize special written by
|
||||
% geometry in the dvi file to be correct in case of jsbook class
|
||||
\PassOptionsToPackage{truedimen}{geometry}%
|
||||
\fi
|
||||
\PassOptionsToPackage{%
|
||||
hmarginratio={1:1},%
|
||||
textwidth=\unexpanded{\sphinxtextwidthja{\spx@opt@hmargin}},%
|
||||
|
@ -436,11 +436,6 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
|
||||
# pTeX (Japanese TeX) for support
|
||||
if builder.config.language == 'ja':
|
||||
# if document uses Japanese standard document classes, then
|
||||
# geometry package needs truedimen as initial *class* option
|
||||
if docclass[:2] == 'js':
|
||||
self.elements['papersize'] = ('truedimen,' +
|
||||
self.elements['papersize'])
|
||||
# use dvipdfmx as default class option in Japanese
|
||||
self.elements['classoptions'] = ',dvipdfmx'
|
||||
# disable babel which has not publishing quality in Japanese
|
||||
|
@ -423,7 +423,7 @@ def test_babel_with_language_ja(app, status, warning):
|
||||
print(result)
|
||||
print(status.getvalue())
|
||||
print(warning.getvalue())
|
||||
assert '\\documentclass[truedimen,letterpaper,10pt,dvipdfmx]{sphinxmanual}' in result
|
||||
assert '\\documentclass[letterpaper,10pt,dvipdfmx]{sphinxmanual}' in result
|
||||
assert '\\usepackage{babel}' not in result
|
||||
assert '\\usepackage{times}' in result
|
||||
assert '\\usepackage[Sonny]{fncychap}' not in result
|
||||
|
Loading…
Reference in New Issue
Block a user