我昨天将我的操作系统换成了 Ubuntu 22.04,安装了 TeX Live,但不明白为什么它不能与俄语和乌克兰语言。我使用Sublime Text
编辑器
\documentclass{article}
\usepackage[T2A,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[russian,english]{babel}
\begin{document}
Текст
\end{document}
错误:
[Compiling /home/anmnv/Documents/text.tex]
TraditionalBuilder: Engine: pdflatex. Invoking latexmk... done.
Errors:
/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty:111: Package fontenc Error: Encoding file `t2aenc.def' not found. [\ProcessOptions*]
/usr/share/texlive/texmf-dist/tex/generic/babel/babel.sty:4254: Package babel Error: Unknown option 'russian'. Either you misspelled it [\ProcessOptions*]
/home/anmnv/Documents/text.tex:8: LaTeX Error: Unicode character Т (U+0422) [Т]
/home/anmnv/Documents/text.tex:8: LaTeX Error: Unicode character е (U+0435) [Те]
/home/anmnv/Documents/text.tex:8: LaTeX Error: Unicode character к (U+043A) [Тек]
/home/anmnv/Documents/text.tex:8: LaTeX Error: Unicode character с (U+0441) [Текс]
/home/anmnv/Documents/text.tex:8: LaTeX Error: Unicode character т (U+0442) [Текст]
No warnings.
/home/anmnv/Documents/text.log:1: Double-click here to open the full log.
[Done!]
答案1
感谢@DavidCarlisle 的建议”我必须安装 babel 俄语“同时还要感谢@Rmano 关于“切换T2A,T1
到T1, T2A
”的建议(它确实有效)。所以我的解决方案是:
sudo aptitude -y 安装 texlive-lang-cyrillic
\documentclass{article}
\usepackage[T1, T2A]{fontenc}
\usepackage[russian,english]{babel}
\begin{document}
Текст
\end{document}
答案2
这对我来说在 TL 2022 上有效(Windows 10,但仍然有效):
\documentclass{article}
\usepackage[english]{babel}
\usepackage{fontspec}
\setmainfont{cmunrm.otf}
\begin{document}
Hello, world! Привет, мир!
\end{document}