LaTeX: `\emph replaced by \sphinxparam and \sphinxsamedocref`

This commit is contained in:
Jean-François B
2023-01-24 14:11:24 +01:00
parent a7bf030944
commit 55170d01d7
3 changed files with 10 additions and 2 deletions
+5
View File
@@ -1332,14 +1332,19 @@ Macros
- Text styling commands:
- ``\sphinxstrong``,
- ``\sphinxcode``,
- ``\sphinxbfcode``,
- ``\sphinxemail``,
- ``\sphinxtablecontinued``,
- ``\sphinxtitleref``,
- ``\sphinxmenuselection``,
- ``\sphinxguilabel``,
- ``\sphinxkeyboard``,
- ``\sphinxaccelerator``,
- ``\sphinxcrossref``,
- ``\sphinxtermref``,
- ``\sphinxsamedocref``,
- ``\sphinxparam``,
- ``\sphinxoptional``.
.. versionadded:: 1.4.5
@@ -19,6 +19,8 @@
\protected\def\sphinxaccelerator#1{\underline{#1}}
\protected\def\sphinxcrossref#1{\emph{#1}}
\protected\def\sphinxtermref#1{\emph{#1}}
\protected\def\sphinxsamedocref#1{\emph{#1}}
\protected\def\sphinxparam#1{\emph{#1}}
% \optional is used for ``[, arg]``, i.e. desc_optional nodes.
\long\protected\def\sphinxoptional#1{%
{\textnormal{\Large[}}{#1}\hspace{0.5mm}{\textnormal{\Large]}}}
@@ -68,6 +70,7 @@
\let\sphinxemail \@firstofone
\let\sphinxcrossref \@firstofone
\let\sphinxtermref \@firstofone
\let\sphinxsamedocref\@firstofone
\let\sphinxhyphen\sphinxhyphenforbookmarks
\def\PYG#1#2{#2}% (can not yet appear in section titles, but perhaps in future)
}}
+2 -2
View File
@@ -799,7 +799,7 @@ class LaTeXTranslator(SphinxTranslator):
else:
self.first_param = 0
if not node.hasattr('noemph'):
self.body.append(r'\emph{')
self.body.append(r'\sphinxparam{')
def depart_desc_parameter(self, node: Element) -> None:
if not node.hasattr('noemph'):
@@ -1597,7 +1597,7 @@ class LaTeXTranslator(SphinxTranslator):
# references to labels in the same document
id = self.curfilestack[-1] + ':' + uri[1:]
self.body.append(self.hyperlink(id))
self.body.append(r'\emph{')
self.body.append(r'\sphinxsamedocref{')
if self.config.latex_show_pagerefs and not \
self.in_production_list:
self.context.append('}}} (%s)' % self.hyperpageref(id))