From: Fred Drake Date: Mon, 30 Nov 1998 14:42:59 +0000 (+0000) Subject: Make \var work correctly in math mode. X-Git-Tag: v1.5.2b1~171 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fa1cceb91f7e701248f38f6608bbae4de7adc4f6;p=python Make \var work correctly in math mode. --- diff --git a/Doc/texinputs/python.sty b/Doc/texinputs/python.sty index c49e7bf082..c579adc7e9 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}}