Formatting references in PDF

33 views
Skip to first unread message

Jeff Larson

unread,
Oct 4, 2019, 1:51:23 PM10/4/19
to sphinx-users
Sphinx references within a PDF are formatted as italics. How can I change this to fixed width font? 

The word "link: in a reference such as 
:ref:`link<my-reference-label>`
will be italicized. Inspecting the generated .tex source shows that such references are a sphinxcrossref, which is not a package that I know how to access, for example, with the passoptionstopackages.

jfbu

unread,
Oct 4, 2019, 3:40:12 PM10/4/19
to sphinx...@googlegroups.com
Hi,
\sphinxcrossref is a LaTeX macro defined in sphinx.sty to be

\protected\def\sphinxcrossref#1{\emph{#1}}


You can add to the latex_elements dictionary this

latex_elements = {
'preamble': r"""
\protected\def\sphinxcrossref#1{#1}
""",
}

in your conf.py to suppress the \emph which gives the italic font

Cheers,

Jean-François

Reply all
Reply to author
Forward
0 new messages