彩色定理,标题加粗,第一段前有垂直间距

彩色定理,标题加粗,第一段前有垂直间距

我有 David Carlisle 建议的以下代码。我没有看到带有粗体字体的定理头。我还想在定理头后添加一些垂直间距,而不仅仅是换行符。

如何为定理字符串和章节编号添加颜色?


    \newtheoremstyle{naiad}%
    {3pt}         % space measure above theorem
    {3pt}         % space measure below theorem
    {\itshape}    % name of font for body of theorem
    {}            % space measure to indent
    {\bfseries}   % name of head font
    {}            % punctuation between head and body
    {\newline}    % space after theorem head
    {}            % 

    \theoremstyle{naiad}
    \newtheorem{theorem}{Theorem}[section]

答案1

以下 MWE 显示了如何编辑\thmname\thmnumber以及\thmnote更改字体的字型和颜色。颜色仅作为示例插入,请不要将其视为美观。

\documentclass{article}
\usepackage{xcolor}
\usepackage{amsthm}

\newtheoremstyle{myExample}% name of the style to be used
{} % {\topsep}% measure of space to leave above the theorem. E.g.: 3pt
{} % {\topsep}% measure of space to leave below the theorem. E.g.: 3pt
{\itshape} % {\itshape}% name of font to use in the body of the theorem
{} % {0pt}% measure of space to indent
{} %{\bfseries}% name of head font
{.}% punctuation between head and body
{ }% space after theorem head; " " = normal interword space
{{\thmname{\textbf{\textit{#1}}}} \textcolor{orange}{\textbf{\thmnumber{#2}}}\thmnote{ \textit{\texttt{\textsf{({#3})}}}}}

\theoremstyle{myExample}
\newtheorem{example}{\textcolor[rgb]{0.00,0.50,0.00}{Example}}[section]

\newtheoremstyle{naiad}%
{3pt}         % space measure above theorem
{3pt}         % space measure below theorem
{\itshape}    % name of font for body of theorem
{}            % space measure to indent
{\bfseries}   % name of head font
{}            % punctuation between head and body
{\newline}    % space after theorem head
{{\thmname{\textbf{\textit{#1}}}} \textcolor{purple}{\textbf{\thmnumber{#2}}}\thmnote{ \textsf{({#3})}}}            % 

\theoremstyle{naiad}
\newtheorem{theorem}{\textcolor[rgb]{0.30,0.30,1}{Theorem}}[section]

\begin{document}
\section{S1}
\begin{example}[Name of the example]
  Text of the example
\end{example}

\begin{theorem}[Name of the theorem]
  Text of the theorem
\end{theorem}

\section{S2}
\begin{example}[Name of the example]
Text of the example
\end{example}

\begin{theorem}[Name of the theorem]
Text of the theorem
\end{theorem}

\end{document}

在此处输入图片描述

您可能会看到更多使用的示例amsthm 这里。可能还有有趣的事情要看thm工具

相关内容