LaTeX制作幻灯片

LaTeX \LaTeX 幻灯片制作采用的是beamer类。beamer类默认使用sans serif family,和article不同,article默认是roman font family。所以如果我要实现幻灯片的标题和正文字体的设置可以通过下面的命令:

\setsansfont{TeX Gyre Termes}		%设置西文字体为times new roman
\setCJKsansfont{SimSun}				%设置中文字体为宋体
\setCJKmonofont{STKaiti}            %设置typewriter family中文字体为楷体
\setmonofont{TeX Gyre Termes}	    %设置typewriter family西文字体为times new roman
\setbeamerfont{frametitle}{family=\ttfamily} %设置标题字体为typewriter family

大体思路就是把字体族的字体类型修改掉,因为beamer默认字体为sans serif family ,那我就让这个字体族的中文字体为宋体,西文字体为times new roman。


补充一下:

字体族 声明 f o n t s p e c fontspec 宏包对应命令 效果
罗马 \rmfamily \setmainfont R o m a n   f o n t   f a m i l y Roman~font~family
无衬线 \sffamily \setsansfont S a n s   s e r i f   f o n t   f a m i l y Sans~serif~font~family
打字机 \ttfamily \setmonofont T y p e w r i t e r   f o n t   f a m i l y Typewriter~font~family

即:如果你用 f o n t s p e c fontspec 宏包设置了\setmainfont的字体,那么\rmfamily的字体效果也会跟着改变。
此外还应注意,我的系统是Linux,所以我系统的times new roman字体名字为TeX Gyre Termes,这是我安装TeX Live的时候安装的,所以名字和windows系统的不一样,win下直接用Times New Roman就可以。

下面说一些beamer主题设置的问题:
beamer主题设置用\usetheme命令,Warsaw、PaloAlto、AnnArbor 、Malmoe、Boadilla这些都是主题,可以任意选择,本文采用的是Boadilla主题,但是默认的Boadilla主题没有sidebar(边栏),这时候我们可以使用\useoutertheme命令设置外部主题。
\useoutertheme[height=0\textwidth,width=0.18\textwidth,hideothersubsections]{sidebar}
上面这一条命令是设置一个占页面宽度0.18的侧边栏,0\textwidth是设置页面上方没有边栏。
此外,我们还可以用\useinnertheme命令改变幻灯片的内部主题,(内部主题主要是设置列表环境,定理环境,图表环境等环境的内容格式)\usecolortheme命令改变幻灯片的颜色主题。
接下来是这个幻灯片示例的效果图:


幻灯片首页

目录页

公式

最后附上 LaTeX \LaTeX 的代码:

\documentclass{beamer}
\usepackage[UTF8,noindent]{ctexcap}
% Warsaw
% PaloAlto
% AnnArbor
% Malmoe
\usetheme{Boadilla}
\useinnertheme{circles}
\useoutertheme[height=0\textwidth,width=0.18\textwidth,hideothersubsections]{sidebar}
% \useoutertheme{default}
\usecolortheme{whale}

\newfontfamily\kaisu{STKaiti}		%定义华文楷体为\kaisu
\setsansfont{TeX Gyre Termes}		%设置西文字体为times new roman
\setCJKsansfont{SimSun}				%设置中文字体为宋体
\setCJKmonofont{STKaiti}
\setmonofont{TeX Gyre Termes}	
\setbeamerfont{frametitle}{family=\ttfamily}

\title{\LaTeX \texttt{幻灯片示例}}
\subtitle{\textsc{Beamer}}
\author{\texttt{倔强的贝吉塔}}
\institute{Canaan Academy}
\date{\texttt{\today}}
\begin{document}

\frame{\titlepage}

\begin{frame}{\textsc{Contents}}
	\tableofcontents
\end{frame}

\begin{frame}{帧标题1}{子帧标题1}
	\section{帧标题1}
	\subsection{子帧标题1} 

	\begin{block}{这是一个公式}
		$$f(x)=\sum_{x=1}^N{\dfrac{1}{e^x(x+1)}}$$
	\end{block}
	在这里输入你要写的内容
\end{frame}

\begin{frame}{帧标题2}
	\section{帧标题2}
	\begin{proof}
		这里写你的证明过程
	\end{proof}
	在这里输入你要写的内容+1
\end{frame}

\begin{frame}{帧标题3}
	\section{帧标题3}
	在这里输入你要写的内容+1\par
	\begin{enumerate}
		\item<1->列出你的条目1
		\item<2->列出你的条目2
	\end{enumerate}
\end{frame}

\end{document}
发布了46 篇原创文章 · 获赞 19 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/l_changyun/article/details/98893477