[Tex/LaTex] How to change text to normal font inside \itshape

italictext-decorations

I have the following code:

\documentclass[11pt]{article}

\usepackage{enumerate}
\usepackage{amsmath}
\newenvironment{italic}{\begin{quote}\itshape}{\end{quote}}
\DeclareMathOperator{\rad}{rad}

\begin{document}

\begin{italic}
blablabla
    \begin{displaymath}
    \rad(R)=\{x\in R\mid x^n=0 \text{ where we consider } n\geq 1\}
    \end{displaymath}
more blablabla

    \begin{enumerate}
        \item $x^n$ with $n=1$
        \item $y^m$ with $m=2$
    \end{enumerate}

\end{italic}

\end{document}

I'd like the blablabla to be italic, but the text in the mathematical environment (for example "where we consider" and "with") shouldn't be. In my document, I have quite a lot of these blablabla's between mathematical environments, so that's the reason why I use the self-defined italic environment: to save some time and don't have to use \textit or \itshape all the time.

How can I solve this? Is this a good approach?


Edit: I've updated my question and changed the title, because the code I gave in the beginning didn't really reflect my situation. My mistake… I've used the tip to declare rad as a mathematical operator.

Best Answer

The \textit macro does not generally control the appearance of the text in the math environment. That's done separately.

In math mode you can use

\mathrm{rad}

Or if this is to be the name of a function you can load the amsmath package in the preamble

\usepackage{amsmath}

and then in the body of the text call

\operatorname{rad}

If this is something you will want to call repeatedly you can define a command to accomplish this:

\usepackage{amsmath}
\DeclareMathOperator{\rad}{rad}

and then in the body of the document you can write

\[
  \rad(R)=\{x\in R\mid x^n=0 \text{ with }n\geq 1\}
\]

If additionally you wish the with not to be set in italics, you can do something like

\text{\normalfont\ with }

or

\textnormal{ with }

You need to make this change within \text{...} because it inherits the style of the fonts outside of the math environment.

enter image description here

You should notice that \normalfont is a switch command like \bfseries which remains in effect until the end of the current group. As \textbf{...} corresponds to {\bfseries ....}, \textnormal{...} corresponds to {\normalfont ...}.

Related Question