LaTeX: revert in index entries to \textbar{} not \sphinxtextbar{}

This is because of case of an index directive or role in a table cell.
For the same reason tabulary is not compatible with code-cells,
it affects index entries. The escaping of | char by a LaTeX macro
needed to be by a "robus" or "protected" one, or by string like {"|}.
This was not the choice of previous commit, by oversight.

By reverting to \textbar{} (which is a "robust" command) we also
maintain maximal backwards compatibility for the sorting in the
index done by the makeindex program.
This commit is contained in:
jfbu 2019-11-18 21:15:35 +01:00
parent e720f0a1a2
commit 30c7af788c
3 changed files with 3 additions and 4 deletions

View File

@ -1881,10 +1881,9 @@
\let\sphinxtermref \@firstofone
}}
% For curly braces and vertical bar inside \index macro
% For curly braces inside \index macro
\def\sphinxleftcurlybrace{\{}
\def\sphinxrightcurlybrace{\}}
\def\sphinxverticalbar{|}
% Declare Unicode characters used by linux tree command to pdflatex utf8/utf8x
\def\spx@bd#1#2{%

View File

@ -109,7 +109,6 @@
(merge-rule "\sphinxleftcurlybrace{}" "{" :string)
(merge-rule "\sphinxrightcurlybrace{}" "}" :string)
(merge-rule "\sphinxverticalbar{}" "|" :string)
(merge-rule "\_" "_" :string)
(merge-rule "{[}" "[" :string)
(merge-rule "{]}" "]" :string)
@ -127,6 +126,7 @@
(merge-rule "\(\rightarrow\)" "→" :string)
(merge-rule "\(\checkmark\)" "✓" :string)
(merge-rule "\textendash{}" "" :string)
(merge-rule "\textbar{}" "|" :string)
(merge-rule "\(\sp{\text{0}}\)" "⁰" :string)
(merge-rule "\(\sp{\text{1}}\)" "¹" :string)
(merge-rule "\(\sp{\text{2}}\)" "²" :string)

View File

@ -1816,7 +1816,7 @@ class LaTeXTranslator(SphinxTranslator):
value = value.replace('"', '""')
value = value.replace('@', '"@')
value = value.replace('!', '"!')
value = value.replace('|', r'\sphinxverticalbar{}')
value = value.replace('|', r'\textbar{}')
return value
def style(string):