2

How to set theorem header font to be normal+bold and theorem body font to be normal+italic in the example below? If I remove the lines starting with \usepackage{fontspec} and ending with \newfontfamily{\serbianfonttt}{DejaVu Serif}, then I get what I need.

\documentclass[10pt, b5paper]{book}

\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage[Script=Cyrillic]{serbian}
\setotherlanguage{english}

\newfontfamily{\serbianfont}[Mapping=ascii-to-serbian, Script=Cyrillic, Language=Serbian]{DejaVu Serif}
\newfontfamily{\serbianfonttt}{DejaVu Serif}

\usepackage{amssymb, amsmath} 


\usepackage{ntheorem}  
\usepackage[framemethod=default]{mdframed}   


\theoremheaderfont{\normalfont\bfseries}
\theorembodyfont{\slshape}
\theoremseparator{.}
\newtheorem{teorema}{Teorema}[section]

\begin{document}
    \begin{teorema}
        ssssssddd
    \end{teorema}
\end{document}
1

Set the main and mono font instead. If you want italics, use \itshape rather than \slshape.

\documentclass[10pt, b5paper]{book}

\usepackage{amssymb, amsmath} 

\usepackage{fontspec}
\usepackage{polyglossia}

\usepackage{ntheorem}  
\usepackage[framemethod=default]{mdframed}   

\setmainlanguage[Script=Cyrillic]{serbian}
\setotherlanguage{english}

\setmainfont{DejaVu Serif}[
  Mapping=ascii-to-serbian,
  Script=Cyrillic,
  Language=Serbian,
]
\setmonofont{DejaVu Serif}

\theoremheaderfont{\normalfont\bfseries\upshape}
\theorembodyfont{\itshape}
\theoremseparator{.}
\newtheorem{teorema}{Teorema}[section]

\begin{document}

\begin{teorema}
abcde fghijk lmnop qrstu vwxyz
č ć š ž dj 
\end{teorema}

\end{document}

enter image description here

  • Thx! But now if I insert sections, like \section{Sec}, I receive Package polyglossia Error: The current roman font does not contain the Cyrill(polyglossia) Please define \cyrillicfont with \newfontfamily. \section{Sec} . In addition, after applying your suggestion,I have noticed a long time for compiling the whole document (200 pages) counting around 50 sec. – Zoran Aug 18 '17 at 16:30
  • Me again. It seems that if I remove \usepackage{fancyvrb} and \usepackage{inconsolata}, then it compiles without errors (I did not inspect which of them caused the problem). But still, compiling procedure is too long, which is very unplesent (before I applied your suggestion, it took around 7-8 sec). – Zoran Aug 18 '17 at 16:47
  • @Zoran Your code loads neither fancyvrb nor Inconsolata. I get no error about \cyrillicfont. – egreg Aug 18 '17 at 17:11
  • I am speaking about the code in the whole document not in a short example. Anyway, I also noticed that if I insert \DeclareMathAlphabet{\mathgot}{U}{euf}{m}{n} in the shortcode preamble, and $$\lim$$ in the document body, then I get lim written cyrilic (contrary to the previous situation). – Zoran Aug 18 '17 at 17:41
  • @Zoran I understand that, but I can't see your bigger document. – egreg Aug 18 '17 at 17:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.