1

Can't get cyrillic symbols from class file. A minimal example follows.

.cls

\ProvidesClass{class}

\renewcommand{\normalsize}{\fontsize{9}{10}\selectfont}

\RequirePackage{tempora}

\AtBeginDocument{}
\AtEndDocument{}

\def\thepage{1}
\newenvironment{proof}{%
  \subparagraph{Доведення}%
}{%
}

\def\subparagraph{\@startsection
  {subparagraph}{4}{0pt}{16pt}{-1em}{}}

.tex

\documentclass{class}
\usepackage[T1, T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english, ukrainian]{babel}

\begin{document}
\begin{proof}
proof goes here
\end{proof}
А тут працює!
\end{document}

enter image description here

6
  • 1
    Check the input encoding of the class file.
    – Johannes_B
    Commented Sep 18, 2016 at 8:19
  • 1
    If your users decide to use another encoding, they will see strange stuff. That is why class files usually are encoding independant and use the low level constructs to write predefined text strings.
    – Johannes_B
    Commented Sep 18, 2016 at 8:20
  • @Johannes_B text/x-tex; charset=us-ascii, i'm translating a book, where should i move such definitions? Create .sty for it?
    – Yola
    Commented Sep 18, 2016 at 8:25
  • @Johannes_B you can form you comments as an answer if you like
    – Yola
    Commented Sep 18, 2016 at 8:29
  • 1
    ASCII does not contain much more than the latin alphabet. You would need to encode the file in utf8 and make sure to load package inputenc before introducing non-ascii stuff. But i would rather not do that.
    – Johannes_B
    Commented Sep 18, 2016 at 8:29

1 Answer 1

1

When LaTeX is reading the class file, the inputenc package has not yet been loaded, unless you do it in the class.

Thus a solution might be (sorry for changing the class name, it's for avoiding clobbering my files):

\ProvidesClass{yola}

\renewcommand{\normalsize}{\fontsize{9}{10}\selectfont}

\RequirePackage[utf8]{inputenc}
\RequirePackage{tempora}

\AtBeginDocument{}
\AtEndDocument{}

\def\thepage{1}
\newenvironment{proof}{%
  \subparagraph{Доведення}%
}{%
}

\def\subparagraph{\@startsection
  {subparagraph}{4}{0pt}{16pt}{-1em}{}}

However, this forces users of your class to use UTF-8.

An encoding independent solution would be

\ProvidesClass{yola}

\renewcommand{\normalsize}{\fontsize{9}{10}\selectfont}

\RequirePackage{tempora}

\AtBeginDocument{}
\AtEndDocument{}

\def\thepage{1}
\newenvironment{proof}{%
  \subparagraph{\CYRD\cyro\cyrv\cyre\cyrd\cyre\cyrn\cyrn\cyrya}%
}{%
}

\def\subparagraph{\@startsection
  {subparagraph}{4}{0pt}{16pt}{-1em}{}}

enter image description here

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .