Use \sphinxcite instead of \cite

This commit is contained in:
Takeshi KOMIYA
2018-04-28 18:09:33 +09:00
parent 34b6bea6a8
commit 8bc136a9cb
5 changed files with 14 additions and 8 deletions

View File

@@ -28,7 +28,7 @@ Incompatible changes
* #789: ``:samp:`` role supports to escape curly braces with backslash
* #4811: The files under :confval:`html_static_path` are excluded from source
files.
* latex: Use ``\cite`` for citation references instead ``\hyperref``
* latex: Use ``\sphinxcite`` for citation references instead ``\hyperref``
Deprecated
----------

View File

@@ -397,6 +397,8 @@ Macros
formerly, the meaning of ``\tableofcontents`` was modified by Sphinx.
- the ``\maketitle`` command is redefined by the class files
:file:`sphinxmanual.cls` and :file:`sphinxhowto.cls`.
- the citation reference is typeset via ``\sphinxcite`` which is a wrapper
of standard ``\cite``.
Environments
~~~~~~~~~~~~

View File

@@ -663,6 +663,10 @@
\belowcaptionskip\smallskipamount}
%% CITATIONS
%
\protected\def\sphinxcite{\cite}
%% FOOTNOTES
%
% Support large numbered footnotes in minipage

View File

@@ -2161,7 +2161,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
if self.in_title:
pass
else:
self.body.append('\\cite{%s:%s}' % (node['docname'], node['refname']))
self.body.append('\\sphinxcite{%s:%s}' % (node['docname'], node['refname']))
raise nodes.SkipNode
def depart_citation_reference(self, node):

View File

@@ -590,7 +590,7 @@ def test_footnote(app, status, warning):
assert ('\\begin{footnote}[2]\\sphinxAtStartFootnote\nauto numbered\n%\n'
'\\end{footnote}') in result
assert '\\begin{footnote}[3]\\sphinxAtStartFootnote\nnamed\n%\n\\end{footnote}' in result
assert '\\cite{footnote:bar}' in result
assert '\\sphinxcite{footnote:bar}' in result
assert ('\\bibitem[bar]{footnote:bar}\ncite\n') in result
assert '\\sphinxcaption{Table caption \\sphinxfootnotemark[4]' in result
assert ('\\hline%\n\\begin{footnotetext}[4]\\sphinxAtStartFootnote\n'
@@ -613,7 +613,7 @@ def test_reference_in_caption_and_codeblock_in_footnote(app, status, warning):
print(status.getvalue())
print(warning.getvalue())
assert ('\\caption{This is the figure caption with a reference to '
'\\cite{index:authoryear}.}' in result)
'\\sphinxcite{index:authoryear}.}' in result)
assert '\\chapter{The section with a reference to {[}AuthorYear{]}}' in result
assert ('\\sphinxcaption{The table title with a reference'
' to {[}AuthorYear{]}}' in result)
@@ -661,7 +661,7 @@ def test_latex_show_urls_is_inline(app, status, warning):
'{\\hyperref[\\detokenize{index:the-section'
'-with-a-reference-to-authoryear}]'
'{\\sphinxcrossref{The section with a reference to '
'\\cite{index:authoryear}}}}') in result
'\\sphinxcite{index:authoryear}}}}') in result
assert ('\\phantomsection\\label{\\detokenize{index:id33}}'
'{\\hyperref[\\detokenize{index:the-section-with-a-reference-to}]'
'{\\sphinxcrossref{The section with a reference to }}}' in result)
@@ -705,7 +705,7 @@ def test_latex_show_urls_is_footnote(app, status, warning):
assert ('\\phantomsection\\label{\\detokenize{index:id32}}'
'{\\hyperref[\\detokenize{index:the-section-with-a-reference-to-authoryear}]'
'{\\sphinxcrossref{The section with a reference '
'to \\cite{index:authoryear}}}}') in result
'to \\sphinxcite{index:authoryear}}}}') in result
assert ('\\phantomsection\\label{\\detokenize{index:id33}}'
'{\\hyperref[\\detokenize{index:the-section-with-a-reference-to}]'
'{\\sphinxcrossref{The section with a reference to }}}') in result
@@ -759,7 +759,7 @@ def test_latex_show_urls_is_no(app, status, warning):
assert ('\\phantomsection\\label{\\detokenize{index:id32}}'
'{\\hyperref[\\detokenize{index:the-section-with-a-reference-to-authoryear}]'
'{\\sphinxcrossref{The section with a reference '
'to \\cite{index:authoryear}}}}') in result
'to \\sphinxcite{index:authoryear}}}}') in result
assert ('\\phantomsection\\label{\\detokenize{index:id33}}'
'{\\hyperref[\\detokenize{index:the-section-with-a-reference-to}]'
'{\\sphinxcrossref{The section with a reference to }}}' in result)
@@ -1244,4 +1244,4 @@ def test_latex_thebibliography(app, status, warning):
'\\bibitem[AuthorYear]{index:authoryear}\n'
'Author, Title, Year\n'
'\\end{sphinxthebibliography}\n' in result)
assert '\\cite{index:authoryear}' in result
assert '\\sphinxcite{index:authoryear}' in result