summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>1998-11-30 14:42:59 (GMT)
committerFred Drake <fdrake@acm.org>1998-11-30 14:42:59 (GMT)
commitfa1cceb91f7e701248f38f6608bbae4de7adc4f6 (patch)
tree9c6793e197dc085e0863f49b0a6fba1b44110513 /Doc
parent87dfd3cfbf902774ca824f23af67f25ad25a2b59 (diff)
downloadcpython-fa1cceb91f7e701248f38f6608bbae4de7adc4f6.zip
cpython-fa1cceb91f7e701248f38f6608bbae4de7adc4f6.tar.gz
cpython-fa1cceb91f7e701248f38f6608bbae4de7adc4f6.tar.bz2
Make \var work correctly in math mode.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/texinputs/python.sty10
1 files changed, 8 insertions, 2 deletions
diff --git a/Doc/texinputs/python.sty b/Doc/texinputs/python.sty
index c49e7bf..c579adc 100644
--- a/Doc/texinputs/python.sty
+++ b/Doc/texinputs/python.sty
@@ -626,8 +626,14 @@
\newcommand{\samp}[1]{`\code{#1}'}
% This weird definition of \var{} allows it to always appear in roman
% italics, and won't get funky in code fragments when we play around
-% with fonts.
-\newcommand{\var}[1]{\normalsize\textrm{\textit{#1\/}}}
+% with fonts. This also works directly in math mode.
+\newcommand{\var}[1]{%
+ \ifmmode%
+ \hbox{\normalsize\textrm{\textit{#1\/}}}%
+ \else%
+ \normalsize\textrm{\textit{#1\/}}%
+ \fi%
+}
\renewcommand{\emph}[1]{{\em #1}}
\newcommand{\dfn}[1]{\emph{#1}}
\newcommand{\strong}[1]{{\bf #1}}