我希望使用 lyx beamer 文档类型,但在文档中使用中文。也许可以使用 CJK,但不确定如何操作。
有人可以分享您的建议吗?
答案1
我不知道这是否是正确的方法(我不知道如何用中文书写),但它似乎对我有用。请注意,我在使用 TeX Live 2014 的 Ubuntu 上使用 LyX 2.1.1。在尝试此操作之前,首先确保您可以导出 LyX 的中文手册,以测试您已满足所有先决条件。打开 doc/zh_CN/Intro.lyx 和 doc/zh_CN/Tutorial.lyx。您能成功将它们导出为 PDF(pdflatex)吗?如果可以,请对 Beamer 进行以下操作(带中文):
在文档 > 设置中,将语言更改为“中文(简体)”,将编码更改为“其他:Unicode(CJK)(utf8)”
在文档 > 设置中的字体下将“CJK:”更改为“gbsn”。
查看 PDF (pdftex)
下面是一个示例(至少需要 LyX 2.1.0 才能运行)。请注意,我仅取了英语帮助 > Beamer 手册的第一帧,并在该帧中的条目的第二项中添加了一些中文文本。
.lyx 文件:
#LyX 2.2 created this file. For more info see http://www.lyx.org/
\lyxformat 474
\begin_document
\begin_header
\textclass beamer
\begin_preamble
% We use the "Berkeley" theme with a 3.45em-wide side bar on the left
\usetheme[left,width=3.45em]{Berkeley}
\end_preamble
\use_default_options true
\maintain_unincluded_children false
\language chinese-simplified
\language_package default
\inputencoding utf8-cjk
\fontencoding global
\font_roman default
\font_sans default
\font_typewriter default
\font_math auto
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100
\font_cjk gbsn
\graphics default
\default_output_format pdf2
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry true
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 0
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 0
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Title
Presentations with Beamer and LyX
\end_layout
\begin_layout Subtitle
An Introduction to the Basics
\end_layout
\begin_layout Author
The LyX Team
\end_layout
\begin_layout Date
V.
2.1
\end_layout
\begin_layout Frame
\end_layout
\begin_deeper
\begin_layout FrameTitle
\begin_inset Argument 1
status open
\begin_layout Plain Layout
presentation
\end_layout
\end_inset
Contents
\end_layout
\begin_layout Standard
\begin_inset CommandInset toc
LatexCommand tableofcontents
\end_inset
\end_layout
\end_deeper
\begin_layout Section
Purposes
\end_layout
\begin_layout Frame
\begin_inset Argument 2
status open
\begin_layout Plain Layout
+-
\end_layout
\end_inset
\begin_inset Argument 4
status open
\begin_layout Plain Layout
Purpose of the Beamer class
\end_layout
\end_inset
\end_layout
\begin_layout Frame
With the
\begin_inset Flex Structure
status open
\begin_layout Plain Layout
Beamer
\end_layout
\end_inset
class, you can produce presentation slides, which
\end_layout
\begin_deeper
\begin_layout Itemize
are visually highly customizable
\end_layout
\begin_layout Itemize
是一个文档写作系统
\end_layout
\begin_layout Itemize
can be constructed step-by-step (
\begin_inset Quotes eld
\end_inset
overlay
\begin_inset Quotes erd
\end_inset
concept)
\end_layout
\begin_layout Itemize
may contain different navigation paths (note that the slides contain all
sorts of hyperlinks)
\end_layout
\begin_layout Itemize
use LaTeX's superb output quality
\end_layout
\begin_layout Itemize
might embed multimedia content (audio, video)
\end_layout
\begin_layout Itemize
can easily be transformed to accompanying material (such as an article-like
handout)
\end_layout
\begin_layout Itemize
and much more \SpecialChar \ldots{}
\end_layout
\end_deeper
\end_body
\end_document
导出(使用 LaTeX(pdflatex)).tex 文件:
%% LyX 2.2.0dev created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass{beamer}
\usepackage[T1]{fontenc}
\usepackage{CJKutf8}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\providecommand{\LyX}{L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\@}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
% this default might be overridden by plain title style
\newcommand\makebeamertitle{\frame{\maketitle}}%
% (ERT) argument for the TOC
\AtBeginDocument{%
\let\origtableofcontents=\tableofcontents
\def\tableofcontents{\@ifnextchar[{\origtableofcontents}{\gobbletableofcontents}}
\def\gobbletableofcontents#1{\origtableofcontents}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
% We use the "Berkeley" theme with a 3.45em-wide side bar on the left
\usetheme[left,width=3.45em]{Berkeley}
\makeatother
\begin{document}
\begin{CJK}{UTF8}{gbsn}%
\title{Presentations with Beamer and \LyX{}}
\subtitle{An Introduction to the Basics}
\author{The \LyX{} Team}
\date{V. 2.1}
\makebeamertitle
\begin{frame}
\frametitle<presentation>{Contents}
\tableofcontents{}
\end{frame}
\section{Purposes}
\begin{frame}[<+->]{Purpose of the Beamer class}
With the \structure{Beamer} class, you can produce presentation slides,
which
\begin{itemize}
\item are visually highly customizable
\item 是一个文档写作系统
\item can be constructed step-by-step (``overlay'' concept)
\item may contain different navigation paths (note that the slides contain
all sorts of hyperlinks)
\item use \LaTeX{}'s superb output quality
\item might embed multimedia content (audio, video)
\item can easily be transformed to accompanying material (such as an article-like
handout)
\item and much more \ldots{}
\end{itemize}
\end{frame}
\end{CJK}
\end{document}
输出(一张幻灯片):