Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fa1cceb

Browse files
committed
Make \var work correctly in math mode.
1 parent 87dfd3c commit fa1cceb

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

Doc/texinputs/python.sty

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,8 +626,14 @@
626626
\newcommand{\samp}[1]{`\code{#1}'}
627627
% This weird definition of \var{} allows it to always appear in roman
628628
% italics, and won't get funky in code fragments when we play around
629-
% with fonts.
630-
\newcommand{\var}[1]{\normalsize\textrm{\textit{#1\/}}}
629+
% with fonts. This also works directly in math mode.
630+
\newcommand{\var}[1]{%
631+
\ifmmode%
632+
\hbox{\normalsize\textrm{\textit{#1\/}}}%
633+
\else%
634+
\normalsize\textrm{\textit{#1\/}}%
635+
\fi%
636+
}
631637
\renewcommand{\emph}[1]{{\em #1}}
632638
\newcommand{\dfn}[1]{\emph{#1}}
633639
\newcommand{\strong}[1]{{\bf #1}}

0 commit comments

Comments
 (0)