1

I was following this example

\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}

where trying to put Cyrillic name "Примјер" as a name for the 'example', but it does not work. I don't know how to allow T2A encoding within \declaretheorem. Could someone assist me?

David Carlisle
  • 757,742

1 Answers1

0

Thanks to @egreg, I have now complete, working code.

\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}