diff --git a/CHANGES b/CHANGES index 522213fe2..9955865de 100644 --- a/CHANGES +++ b/CHANGES @@ -52,6 +52,7 @@ Bugs fixed * #1540: Fix RuntimeError with circular referenced toctree * #1983: i18n translation feature breaks references which uses section name. * #1990: Use caption of toctree to title of \tableofcontents in LaTeX +* #1987: Fix ampersand is ignored in ``:menuselection:`` and ``:guilabel:`` on LaTeX builder Release 1.3.1 (released Mar 17, 2015) diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index 920df5940..d82e7dd76 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -1713,6 +1713,9 @@ class LaTeXTranslator(nodes.NodeVisitor): if classes in [['menuselection'], ['guilabel']]: self.body.append(r'\emph{') self.context.append('}') + elif classes in [['accelerator']]: + self.body.append(r'\underline{') + self.context.append('}') elif classes and not self.in_title: self.body.append(r'\DUspan{%s}{' % ','.join(classes)) self.context.append('}') diff --git a/tests/test_markup.py b/tests/test_markup.py index e741571fb..a5804366f 100644 --- a/tests/test_markup.py +++ b/tests/test_markup.py @@ -109,7 +109,7 @@ def test_inline(): yield (verify, ':guilabel:`&Foo -&&- &Bar`', u'
Foo ' '-&- Bar
', - r'\emph{\DUspan{accelerator}{F}oo -\&- \DUspan{accelerator}{B}ar}') + r'\emph{\underline{F}oo -\&- \underline{B}ar}') # non-interpolation of dashes in option role yield (verify_re, ':option:`--with-option`',