I'm having a frustrating problem compiling a file with Czech diacritics.

main.tex:

\documentclass{notes}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{pdfpages}
\usepackage{minitoc}

\begin{document}

% \includepdf{PDFs/Cover}
\clearpage
\renewcommand{\thepage}{\roman{page}}
\setcounter{page}{1}

\dominitoc
\tableofcontents
\listoffigures
\listofmyequations

\clearpage
\renewcommand{\thepage}{\arabic{page}}
\setcounter{page}{1}
\include{lecture1}

\end{document}


lecture1.tex:

\mainsection{1}{Lecture title}{dd/mm/yyy}

Hello ř


When I do not put ř into the file, it compiles fine. When added, it ends on following error message I cannot understand:

(./main.equ) [1] (./lecture1.tex
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/utf8.def)
! Missing $inserted. <inserted text>$
l.6 Hello ř


All files are saved in UTF-8 (shown by VS Code).

• Welcome to TeX SX! Try adding \usepackage[T1]{fontenc} to your preamble. – Bernard Jul 13 at 16:21
• I cannot reproduce the issue with a standard class with any version of TeX Live I have. Of course, I don't have notes.cls. Can you please give a pointer to it? – egreg Jul 13 at 19:48
• @Bernard could you reproduce the problem? I do not see how adding fontenc could change the behaviour here (but I don't see how the reported behaviour could occur either) – David Carlisle Jul 13 at 20:20
• @DavidCarlisle: I thought maybe it used by default the OT1 encoding, and that was the cause of the problem, but I've just tested, and there's no problem. However, I had to modify the code, as I don't have the notes class installed (no idea where it comes from, so I replaced it with report), and of course, I don't have the pdf file included. Might having cm-unicode` installed have helped my compilation? – Bernard Jul 13 at 21:15