[Tex/LaTex] How to display the text in a new environment italic

environmentsitalic

I created a new environment:

\usepackage[dvipsnames]{xcolor}
\usepackage{mdframed}

\newenvironment{test}
{\begin{mdframed}[backgroundcolor=gray, linewidth=1pt]}
{\end{mdframed}}

I'd like to display the text inside the environment italic.

How can I do that?

Best Answer

Credits to ChrisS, who answered this in the comments:

“Add \itshape to the end of your begin environment specification; after the closing bracket for the options to mdframed.”

\newenvironment{test}
{\begin{mdframed}[backgroundcolor=gray, linewidth=1pt]\itshape}
{\end{mdframed}}
Related Question