From 44f595a63f94e9e83c477125fb4c725a21a6a72c Mon Sep 17 00:00:00 2001 From: jfbu Date: Wed, 5 Oct 2016 10:48:54 +0200 Subject: [PATCH] Fix #3009: Bad rendering of parsed-literals in LaTeX This reverts the ``\scantokens`` added (commit 86083875) to ``\code`` (aka ``\sphinxcode``), in case it is encountered inside a parsed-literal directive. Indeed strange interference arise then. The problem would occur in Verbatim too, but I think ``\sphinxcode`` is not encountered there. --- sphinx/texinputs/sphinx.sty | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty index e74f00225..2a212d6b9 100644 --- a/sphinx/texinputs/sphinx.sty +++ b/sphinx/texinputs/sphinx.sty @@ -163,7 +163,9 @@ % let \sphinxcode and \sphinxbfcode use straight quotes. \@noligs patched by upquote, % but needs protection in "moving arguments" such as for captions. % Use \scantokens to handle e.g. \item[{\sphinxcode{'fontenc'}}] -\DeclareRobustCommand{\sphinxcode}[1]{{\@noligs\scantokens{\texttt{#1}\relax}}} +\DeclareRobustCommand{\sphinxcode}[1]{{\def\@tempa{alltt}% + \ifx\@tempa\@currenvir\else\@noligs\endlinechar\m@ne\everyeof{\noexpand}% + \expandafter\scantokens\fi {\texttt{#1}}}} \newcommand{\sphinxbfcode}[1]{\sphinxcode{\bfseries#1}} \newcommand{\sphinxemail}[1]{\textsf{#1}} \newcommand{\sphinxtablecontinued}[1]{\textsf{#1}} @@ -1008,7 +1010,9 @@ } % robustified case needs special treatment \newcommand\code{}\let\code\relax - \DeclareRobustCommand{\code}[1]{{\@noligs\scantokens{\texttt{#1}\relax}}} + \DeclareRobustCommand{\code}[1]{{\def\@tempa{alltt}% + \ifx\@tempa\@currenvir\else\@noligs\endlinechar\m@ne\everyeof{\noexpand}% + \expandafter\scantokens\fi {\texttt{#1}}}} \def\sphinxcode{\code}% \fi