как изменить шрифт числа после теоремы

как изменить шрифт числа после теоремы

Я хочу изменить шрифт числа на \itshape, например, я хочу получить Теорему {\itshape 1.1}. Есть ли способ сделать это в среде теоремы

решение1

Предположим, что вы используете amsthmпакет только в своем документе. Вот как это можно сделать.

Если вы хотите, чтобы такое поведение применялось только к «простому» стилю теорем, добавьте в преамбулу следующие строки, чтобы переопределить простой стиль:

\makeatletter
\renewcommand{\th@plain}{%
  \renewcommand\@upn{\textit}%
  \itshape%
}
\makeatother

и вы сделали.

МВЭ

\documentclass{article}
\usepackage{amsthm}

\makeatletter
\renewcommand{\th@plain}{%
  \renewcommand\@upn{\textit}%
  \itshape%
}
\makeatother

\newtheorem{thm}{Theorem}[section]

\begin{document}

\section{Test}

\begin{thm}
This is a theorem.
\end{thm}

\end{document} 

Выход

введите описание изображения здесь

Вместо этого, если вы хотите, чтобы это поведение применялось ко всем стилям теорем, замените приведенный выше код на

\makeatletter
  \renewcommand\@upn{\textit}
\makeatother

МВЭ

\documentclass{article}
\usepackage{amsthm}

\makeatletter
  \renewcommand\@upn{\textit}
\makeatother

\newtheorem{thm}{Theorem}[section]
\theoremstyle{remark}
\newtheorem{rmk}[thm]{Remark}

\begin{document}

\section{Test}

\begin{thm}
This is a theorem.
\end{thm}

\begin{rmk}
And this is a remark.
\end{rmk}

\end{document} 

Выход

введите описание изображения здесь

решение2

Вот способ с ntheoremпакетом. Я переопределяю plainстиль:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage[amsthm, thmmarks, thref]{ntheorem}
\usepackage{cleveref}

\makeatletter
\renewtheoremstyle{plain}%
{\item[\hskip\labelsep \theorem@headerfont ##1\ \textit{##2}\theorem@separator]}%
{\item[\hskip\labelsep \theorem@headerfont ##1\ \textit{##2}\ (##3)\theorem@separator]}
\makeatother
\newtheorem{thm}{Theorem}[section]

\begin{document}

\section{A first section}
\begin{thm}\label{testthm}
This is a test theorem.
\end{thm}
We see in \cref{testthm}…

\end{document} 

введите описание изображения здесь

решение3

Если вы не используете пакет, специализирующийся на теоремах, вы можете сделать следующее:

\documentclass{article}
\usepackage{etoolbox}

\makeatletter
\patchcmd{\@opargbegintheorem}{#2}{\textit{#2}}{}{}
\patchcmd{\@begintheorem}{#2}{\textit{#2}}{}{}
\makeatother

\newtheorem{thm}{Theorem}

\begin{document}
\begin{thm}
Something
\end{thm}
\end{document}

введите описание изображения здесь

Связанный контент