如何设置不斜体或者不粗体?

如何设置不斜体或者不粗体?

众所周知,您可以使用 \textit{} 或 \textbf{} 将字体设为斜体或粗体。但是,如果我有斜体或粗体字体,我可以使用什么命令将其设为非斜体或非粗体?

答案1

您可以使用\normalfont

\documentclass{book}
\begin{document}
 \textit{Some italic and {\normalfont non italic} text}

 \textbf{Some bold and {\normalfont non bold} text}

 \emph{Some italic and {\normalfont non italic} text}
\end{document}

在此处输入图片描述

答案2

为了便于讨论,我假设您使用或\textbf{...}{\bfseries ...}生成加粗字体,以及\textit{...}\emph{...}{\itshape ...}来生成斜体文字. 这些方法可以结合起来得到粗斜体文字,即\textbf{\textit{...}}{\bfseries\itshape ...}

  • 要取消/覆盖斜体字体形状,同时保留(大胆的或非粗体)字体粗细不变,使用\textup{...}{\upshape ...}

      \textit{Some italic and some \textup{non italic} text}
    
      {\itshape Some italic and some {\upshape non italic} text}
    

    \emph{...}方法可以嵌套:

      \emph{Some italic and some \emph{non italic} text}
    

    请注意,和\textit{...}方法\emph{...}会小心地插入所谓的斜体修正在从斜体文本到非斜体文本的转换中,该{\upshape ...}方法不起作用。

  • 要仅覆盖粗体字体粗细,同时保留(斜体或直立)字体形状不变,使用\textmd{...}{\mdseries ...}

      \textbf{Some bold and some \textmd{non bold} text}
    
      {\bfseries Some bold and some {\mdseries non bold} text}
    
  • 强制使用普通字体重量和正常字体形状同时,也可以将以上几种方法结合起来。除非字体默认设置已提前重置(例如,\ttfamily\sffamily;参见下面@JonathanLandrum的评论),也可以使用或\textnormal{...}{\normalfont ...}强制正常字体粗细和形状:

      \textbf{\textit{Some bold-italic, \textmd{non-bold italic}, \textup{non-italic bold}, and \textmd{\textup{{upright\slash non-bold} text}}.}
    
      {\itshape\bfseries Some bold-italic, {\mdseries non-bold italic}, {\upshape non-italic bold}, and {\mdseries\upshape upright\slash non-bold} text.}
    

这些方法生成的结果在以下 MWE 中进行了说明:

在此处输入图片描述

\documentclass{article}
\usepackage{geometry}
\begin{document}

Some normal, i.e., upright and non-bold, text.
 
\medskip
\textit{Some italic and some \textup{upright} text.}

\emph{Some italic and some \emph{upright} text.}

{\itshape Some italic and some {\upshape upright} text.}


\medskip
\textbf{Some bold and some \textmd{non-bold} text.}

{\bfseries Some bold and some {\mdseries non-bold} text.}

\medskip
\textbf{\textit{Some bold-italic, \textmd{non-bold italic}, \textup{non-italic bold}, and \textmd{\textup{upright\slash non-bold}} text}.}

{\itshape\bfseries Some bold-italic, {\mdseries non-bold italic}, {\upshape non-italic bold}, and {\mdseries\upshape upright\slash non-bold} text.}

\end{document}

相关内容