在 \declaretheorem 中更改为西里尔编码

在 \declaretheorem 中更改为西里尔编码

我按照这个例子

\documentclass[12pt,a4paper]{report}
\usepackage[framemethod=TikZ]{mdframed}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{lipsum}% just to generate text for the example
\usepackage[T1,T2A]{fontenc}
\usepackage[cp1251]{inputenc}
\usepackage[serbianc,english]{babel}
% example style
\declaretheoremstyle[
headfont=\bfseries, 
notebraces={[}{]},
bodyfont=\normalfont\itshape,
headpunct={},
postheadspace=\newline,
postheadhook={\textcolor{red}{\rule[.6ex]{\linewidth}{0.4pt}}\\},
spacebelow=\parsep,
spaceabove=\parsep,
mdframed={
    backgroundcolor=red!20, 
        linecolor=red!30, 
        innertopmargin=6pt,
        roundcorner=5pt, 
        innerbottommargin=6pt, 
        skipabove=\parsep, 
        skipbelow=\parsep } 
]{myexamplestyle}

% example environment - thmtools
\declaretheorem[
  style=myexamplestyle,
  name=Примјер,
  numberwithin=chapter
]{example}

\begin{document}
\chapter{Test}
\begin{example}[Additional text]
\lipsum[4]
\end{example}
\end{document}

尝试将西里尔文名称“Примјер”作为“示例”的名称,但不起作用。我不知道如何在 \declaretheorem 中允许 T2A 编码。有人能帮助我吗?

答案1

感谢@egreg,我现在有了完整、可用的代码。

\documentclass[12pt,a4paper]{report}
\usepackage[framemethod=TikZ]{mdframed}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{lipsum}% just to generate text for the example
\usepackage[T1,T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[serbianc,english]{babel}
% example style
\declaretheoremstyle[
    headfont=\bfseries, 
    notebraces={[}{]},
    bodyfont=\normalfont\itshape,
    headpunct={},
    postheadspace=\newline,
    postheadhook={\textcolor{red}{\rule[.6ex]{\linewidth}{0.4pt}}\\},
    spacebelow=\parsep,
    spaceabove=\parsep,
    mdframed={
        backgroundcolor=red!20, 
            linecolor=red!30, 
            innertopmargin=6pt,
            roundcorner=5pt, 
            innerbottommargin=6pt, 
            skipabove=\parsep, 
            skipbelow=\parsep } 
    ]{myexamplestyle}

    % example environment - thmtools
    \declaretheorem[
      style=myexamplestyle,
      name=Примјер,
      numberwithin=chapter
    ]{example}

    \begin{document}
    \chapter{Test}
    \begin{example}[Additional text]
    \lipsum[4]
    \end{example}
    \end{document}

相关内容