我正在尝试在 Beamer 演示文稿中使用西里尔无衬线字体。我使用 LyX 2.0.0 制作。LyX 生成的代码(导出为纯 LaTeX)是
%% LyX 2.0.0 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[russian]{beamer}
\usepackage[T1]{fontenc}
\usepackage[koi8-r]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{graphicx}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\DeclareRobustCommand{\cyrtext}{%
\fontencoding{T2A}\selectfont\def\encodingdefault{T2A}}
\DeclareRobustCommand{\textcyr}[1]{\leavevmode{\cyrtext #1}}
\AtBeginDocument{\DeclareFontEncoding{T2A}{}{}}
%% A simple dot to overcome graphicx limitations
\newcommand{\lyxdot}{.}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
% this default might be overridden by plain title style
\newcommand\makebeamertitle{\frame{\maketitle}}%
\AtBeginDocument{
\let\origtableofcontents=\tableofcontents
\def\tableofcontents{\@ifnextchar[{\origtableofcontents}{\gobbletableofcontents}}
\def\gobbletableofcontents#1{\origtableofcontents}
}
\long\def\lyxframe#1{\@lyxframe#1\@lyxframestop}%
\def\@lyxframe{\@ifnextchar<{\@@lyxframe}{\@@lyxframe<*>}}%
\def\@@lyxframe<#1>{\@ifnextchar[{\@@@lyxframe<#1>}{\@@@lyxframe<#1>[]}}
\def\@@@lyxframe<#1>[{\@ifnextchar<{\@@@@@lyxframe<#1>[}{\@@@@lyxframe<#1>[<*>][}}
\def\@@@@@lyxframe<#1>[#2]{\@ifnextchar[{\@@@@lyxframe<#1>[#2]}{\@@@@lyxframe<#1>[#2][]}}
\long\def\@@@@lyxframe<#1>[#2][#3]#4\@lyxframestop#5\lyxframeend{%
\frame<#1>[#2][#3]{\frametitle{#4}#5}}
\def\lyxframeend{} % In case there is a superfluous frame end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{listings}
\usetheme{Warsaw}
%\usepackage{helvet}
% or ...
%\usetheme{Antibes} % tree outline, neat
%\usetheme{JuanLesPins} % like Antibes, with shading
%\usetheme{Bergen} % outline on side
%\usetheme{Luebeck} % like Warsaw, square sides
%\usetheme{Berkeley} % interesting left bar outline
%\usetheme{Madrid} % clean, nice. 7/12 page numbers
%\usetheme{Berlin} % dots show slide number
%\usetheme{Malmoe} % OK, plain, unshaded
%\usetheme{Boadilla} % nice, white bg, no top bar
%\usetheme{Marburg} % nice, outline on right
%\usetheme{boxes} % ???
%\usetheme{Montpellier} % tree outline on top, plainish white
%\usetheme{Copenhagen} % like Warsaw
%\usetheme{PaloAlto} % looks good
%\usetheme{Darmstadt} % like Warsaw with circle outline
%\usetheme{Pittsburgh}
%\usetheme{default}
%\usetheme{Rochester} % like boxy, unshaded warsaw
%\usetheme{Dresden} % circle outline on top
%\usetheme{Singapore} % purple gradient top
%\usetheme{Frankfurt} % like Warsaw with circle outline on top
%\usetheme{Szeged}
%\usetheme{Goettingen} % light purple right bar outline
%\usetheme{Warsaw}
%\usetheme{Hannover} % like Goett with bar on left
%\usetheme{compatibility}
%\usetheme{Ilmenau}
\setbeamercovered{transparent}
% or whatever (possibly just delete it)
%\usecolortheme{seahorse}
%\usecolortheme{rose}
% seems to fix typewriter font in outline header:
\usepackage{ae,aecompl}
\beamertemplatenavigationsymbolsempty
%\pgfdeclareimage[height=1cm]{institution-logo}{hint-logo-mn.jpg}
\makeatother
\usepackage{babel}
\begin{document}
\title[Высокогорные леса]{Историческое использование\\высокогорных лесов}
\subtitle{современное значение\\на государственном и местном уровнях}
\author[S\o{}veig; Наумов]{Robert S\o{}veig, Владимир Наумов}
\institute{Niht}
\date{5 сентября 2012}
\makebeamertitle
%\beamerdefaultoverlayspecification{<+->}
\lyxframeend{}\lyxframe{Robert S\o{}veig}
\begin{center}
\par\end{center}
\begin{block}
{}
\begin{itemize}
\item место работы:
\item специализация:
\item опыт:
\end{itemize}
\end{block}
\note[item]{Начало доклада}
\note[item]{Теперь я перейду собственно к нашему докладу.}
\lyxframeend{}
\end{document}
问题是输出中的字体不是无衬线字体,尽管我知道默认情况下 beamer 使用无衬线字体。例如,此代码:
\documentclass[russian]{beamer}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\begin{document}
\begin{frame}
ПРИВЕТ! Этот текст написан шрифтом без засечек.
\end{frame}
\end{document}
在纯 LaTeX 中完美运行。
我认为问题出在字体编码上。
如何强制 LyX 使用正确的字体编码,例如使用无衬线西里尔字体制作投影仪演示文稿?
答案1
第一个代码示例相当混乱,但在我看来,它很好地说明了为什么 LyX 应该不是使用它,因为它会使事情复杂化而不是简化。
在第二个代码中你忘记加载babel
\documentclass{beamer}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}
\begin{document}
\begin{frame}
ПРИВЕТ! Этот текст написан шрифтом без засечек.
\end{frame}
\end{document}
一般来说,我更喜欢将语言选项传递给babel
而不是传递给班级(如果您想使用多种语言,您可能会感到惊讶)。
这是第一个代码的“更正确”版本(我用utf8
它来代替koi8-r
)。ae
和aecompl
包已经过时了。
\documentclass{beamer}
\usepackage[T1,T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}
% \usepackage{listings}
\usetheme{Warsaw}
\setbeamercovered{transparent}
\beamertemplatenavigationsymbolsempty
\begin{document}
\title[Высокогорные леса]{Историческое использование\\высокогорных лесов}
\subtitle{современное значение\\на государственном и местном уровнях}
\author[S\o{}veig; Наумов]{Robert S\o{}veig, Владимир Наумов}
\institute{Niht}
\date{5 сентября 2012}
\begin{frame}
\maketitle
\end{frame}
%\beamerdefaultoverlayspecification{<+->}
\begin{frame}
\frametitle{Robert S\o{}veig}
\begin{block}{}
\begin{itemize}
\item место работы:
\item специализация:
\item опыт:
\end{itemize}
\end{block}
\note[item]{Начало доклада}
\note[item]{Теперь я перейду собственно к нашему докладу.}
\end{frame}
\end{document}