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'``
|
||||||
"geometry" package inclusion, the default definition is:
|
"geometry" package inclusion, the default definition is:
|
||||||
|
|
||||||
``'\\usepackage{geometry}'`` (with ``[dvipdfm]`` for Japanese documents)
|
``'\\usepackage{geometry}'``
|
||||||
|
|
||||||
and :file:`sphinx.sty` executes a ``\PassOptionsToPackages`` with
|
with an additional ``[dvipdfm]`` for Japanese documents.
|
||||||
``hmargin=1in,vmargin=1in,marginparwidth=0.5in``. See :doc:`latex`
|
The Sphinx LaTeX style file executes:
|
||||||
for the corresponding ``'sphinxsetup'`` options.
|
|
||||||
|
``\PassOptionsToPackage{hmargin=1in,vmargin=1in,marginpar=0.5in}{geometry}``
|
||||||
|
|
||||||
|
which can be customized via corresponding ``'sphinxsetup'`` options.
|
||||||
|
See :doc:`latex`.
|
||||||
|
|
||||||
.. versionadded:: 1.5
|
.. versionadded:: 1.5
|
||||||
|
|
||||||
@ -1745,24 +1749,20 @@ These options influence LaTeX output. See further :doc:`latex`.
|
|||||||
``dvipdfm`` option if :confval:`latex_engine` is ``'platex'``.
|
``dvipdfm`` option if :confval:`latex_engine` is ``'platex'``.
|
||||||
|
|
||||||
.. versionadded:: 1.5.3
|
.. versionadded:: 1.5.3
|
||||||
The ``'sphinxsetup'`` margin keys. See :doc:`latex`.
|
The ``'sphinxsetup'`` keys for ``hmargin, ...``.
|
||||||
|
|
||||||
.. versionchanged:: 1.5.3
|
.. 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
|
immediately the loading of :file:`sphinx.sty`. This is in order
|
||||||
to handle the paper layout options in a special way for Japanese
|
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
|
documents: the text width will be set to an integer multiple of the
|
||||||
*zenkaku* width, and the text height to an integer multiple
|
*zenkaku* width, and the text height to an integer multiple
|
||||||
of the baseline.
|
of the baseline.
|
||||||
|
|
||||||
Further, as the ``jsbook`` Japanese standard document class handles
|
For Japanese ``'manual'`` documents, Sphinx passes additionally to
|
||||||
pointsize other than ``10pt`` in a special manner, Sphinx uses then
|
``geometry`` the ``truedimen`` option for compatibility with the way
|
||||||
as first document class option ``truedimen``: this will be received
|
the ``jsbook`` class handles dimensions when the pointsize is not
|
||||||
by ``geometry`` package and help it interpret correctly further
|
``10pt``.
|
||||||
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``.
|
|
||||||
|
|
||||||
``'babel'``
|
``'babel'``
|
||||||
"babel" package inclusion, default ``'\\usepackage{babel}'`` (the
|
"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
|
.. raw:: latex
|
||||||
|
|
||||||
\begingroup
|
\begingroup
|
||||||
\sphinxsetup{verbatimwithframe=false,%
|
\sphinxsetup{%
|
||||||
VerbatimColor={named}{OldLace}, TitleColor={named}{DarkGoldenrod},%
|
verbatimwithframe=false,
|
||||||
hintBorderColor={named}{LightCoral}, attentionBgColor={named}{LightPink},%
|
VerbatimColor={named}{OldLace},
|
||||||
attentionborder=3pt, attentionBorderColor={named}{Crimson},%
|
TitleColor={named}{DarkGoldenrod},
|
||||||
noteBorderColor={named}{Olive}, noteborder=2pt,%
|
hintBorderColor={named}{LightCoral},
|
||||||
cautionBorderColor={named}{Cyan}, cautionBgColor={named}{LightCyan},%
|
attentionborder=3pt,
|
||||||
cautionborder=3pt}
|
attentionBorderColor={named}{Crimson},
|
||||||
|
attentionBgColor={named}{FloralWhite},
|
||||||
|
noteborder=2pt,
|
||||||
|
noteBorderColor={named}{Olive},
|
||||||
|
cautionborder=3pt,
|
||||||
|
cautionBorderColor={named}{Cyan},
|
||||||
|
cautionBgColor={named}{LightCyan}}
|
||||||
\relax
|
\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
|
dynamically the option values: this is actually what we did for the
|
||||||
duration of this chapter for the PDF output, which is styled using::
|
duration of this chapter for the PDF output, which is styled using::
|
||||||
|
|
||||||
|
\sphinxsetup{%
|
||||||
verbatimwithframe=false,
|
verbatimwithframe=false,
|
||||||
VerbatimColor={named}{OldLace}, TitleColor={named}{DarkGoldenrod},
|
VerbatimColor={named}{OldLace},
|
||||||
hintBorderColor={named}{LightCoral}, attentionBgColor={named}{LightPink},
|
TitleColor={named}{DarkGoldenrod},
|
||||||
attentionborder=3pt, attentionBorderColor={named}{Crimson},
|
hintBorderColor={named}{LightCoral},
|
||||||
noteBorderColor={named}{Olive}, noteborder=2pt,
|
attentionborder=3pt,
|
||||||
cautionBorderColor={named}{Cyan}, cautionBgColor={named}{LightCyan},
|
attentionBorderColor={named}{Crimson},
|
||||||
cautionborder=3pt
|
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::
|
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``
|
For a ``'manual'`` type document, which by default uses the ``jsbook``
|
||||||
LaTeX document class, the dimension units must be so-called "true"
|
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
|
This is due to the LaTeX class ``jsbook``'s way of handling the
|
||||||
when it is not ``10pt``.
|
pointsize when it is not ``10pt``.
|
||||||
|
|
||||||
To the contrary, the ``jreport`` class, which is used for ``'howto'``
|
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
|
.. versionadded:: 1.5.3
|
||||||
|
|
||||||
|
@ -1086,6 +1086,11 @@
|
|||||||
\newcommand*\sphinxtextlinesja[1]{%
|
\newcommand*\sphinxtextlinesja[1]{%
|
||||||
\numexpr\@ne+\dimexpr\paperheight-\topskip-\dimexpr#1+#1\relax\relax/
|
\numexpr\@ne+\dimexpr\paperheight-\topskip-\dimexpr#1+#1\relax\relax/
|
||||||
\baselineskip\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{%
|
\PassOptionsToPackage{%
|
||||||
hmarginratio={1:1},%
|
hmarginratio={1:1},%
|
||||||
textwidth=\unexpanded{\sphinxtextwidthja{\spx@opt@hmargin}},%
|
textwidth=\unexpanded{\sphinxtextwidthja{\spx@opt@hmargin}},%
|
||||||
|
@ -436,11 +436,6 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
|
|
||||||
# pTeX (Japanese TeX) for support
|
# pTeX (Japanese TeX) for support
|
||||||
if builder.config.language == 'ja':
|
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
|
# use dvipdfmx as default class option in Japanese
|
||||||
self.elements['classoptions'] = ',dvipdfmx'
|
self.elements['classoptions'] = ',dvipdfmx'
|
||||||
# disable babel which has not publishing quality in Japanese
|
# 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(result)
|
||||||
print(status.getvalue())
|
print(status.getvalue())
|
||||||
print(warning.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{babel}' not in result
|
||||||
assert '\\usepackage{times}' in result
|
assert '\\usepackage{times}' in result
|
||||||
assert '\\usepackage[Sonny]{fncychap}' not in result
|
assert '\\usepackage[Sonny]{fncychap}' not in result
|
||||||
|
Loading…
Reference in New Issue
Block a user