Commit e2a91f4f authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab Committed by Jonathan Corbet

docs-rst: fix LaTeX \DURole renewcommand with Sphinx 1.3+

PDF build on Kernel 4.9-rc? returns an error with Sphinx 1.3.x
and Sphinx 1.4.x, when trying to solve some cross-references.

The solution is to redefine the \DURole macro.

However, this is redefined too late. Move such redefinition to
LaTeX preamble and bind it to just the Sphinx versions where the
error is known to be present.

Tested by building the documentation on interactive mode:
	make PDFLATEX=xelatex -C Documentation/output/./latex

Fixes: e61a39ba ("[media] index.rst: Fix LaTeX error in interactive mode on Sphinx 1.4.x")
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent f5ff9b63
...@@ -37,7 +37,7 @@ from load_config import loadConfig ...@@ -37,7 +37,7 @@ from load_config import loadConfig
extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include', 'cdomain'] extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include', 'cdomain']
# The name of the math extension changed on Sphinx 1.4 # The name of the math extension changed on Sphinx 1.4
if minor > 3: if major == 1 and minor > 3:
extensions.append("sphinx.ext.imgmath") extensions.append("sphinx.ext.imgmath")
else: else:
extensions.append("sphinx.ext.pngmath") extensions.append("sphinx.ext.pngmath")
...@@ -332,6 +332,10 @@ latex_elements = { ...@@ -332,6 +332,10 @@ latex_elements = {
''' '''
} }
# Fix reference escape troubles with Sphinx 1.4.x
if major == 1 and minor > 3:
latex_elements['preamble'] += '\\renewcommand*{\\DUrole}[2]{ #2 }\n'
# Grouping the document tree into LaTeX files. List of tuples # Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, # (source start file, target name, title,
# author, documentclass [howto, manual, or own class]). # author, documentclass [howto, manual, or own class]).
......
Linux Media Subsystem Documentation Linux Media Subsystem Documentation
=================================== ===================================
.. Sphinx 1.4.x has a definition for DUrole that doesn't work on alltt blocks
.. raw:: latex
\renewcommand*{\DUrole}[2]{ #2 }
Contents: Contents:
.. toctree:: .. toctree::
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment