]> granicus.if.org Git - python/commitdiff
Make \var work correctly in math mode.
authorFred Drake <fdrake@acm.org>
Mon, 30 Nov 1998 14:42:59 +0000 (14:42 +0000)
committerFred Drake <fdrake@acm.org>
Mon, 30 Nov 1998 14:42:59 +0000 (14:42 +0000)
Doc/texinputs/python.sty

index c49e7bf082ad3361d5e9af175d5e0553d6eae4fe..c579adc7e9ec6e82d822518efbec9e8d38a853cf 100644 (file)
 \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}}