我有一个定义,写如下:
\begin{definition}
This is a definition, in which I would like to have a few normal words.
\end{definition}
通常,整个定义都以斜体。但我想删除“正常”格式,使其看起来没有斜体。有没有什么快捷的方法可以实现这个目的?
答案1
您可以使用 手动更改字体形状\upshape
。或者,您可以重新定义\itshape
(切换到斜体字体)意味着将其默认为\upshape
。后者可以使用 [etoolbox
软件包 ][etoolbox-pkg] 提供的补丁来实现。但是,即使更改仅限于环境,其他\itshape
用途也会对 进行更改\upshape
。在这种情况下,也许这不是问题。
\documentclass{article}
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\newenvironment{definition}%
{\itshape}% \begin{definition}
{}% \end{definition}
\begin{document}
% Normal definition
\begin{definition}
This is a definition, in which I would like to have a few normal words.
\end{definition}
% Manually corrected definition
\begin{definition}
\upshape This is a definition, in which I would like to have a few normal words.
\end{definition}
\AtBeginEnvironment{definition}{\renewcommand{\itshape}{\upshape}}% You can also place this in your document preamble
% Automatically corrected definition
\begin{definition}
This is a definition, in which I would like to have a few normal words.
\end{definition}
\end{document}