1. 程式人生 > >LaTeX幻燈片通用簡潔模板(Beamer)

LaTeX幻燈片通用簡潔模板(Beamer)

LaTeX幻燈片通用簡潔模板(Beamer)

提供一個Ctex套裝下使用WinEdt編輯器的xelatex編譯可以通過的一個LaTex幻燈Beamer模板,使用方法為將程式碼拷貝進WinEdt文件,使用xelatex編譯(一般Beamer都用這個編譯,不用多想和嘗試),點選選單欄中的pdf檢視按鈕,可以看見效果。然後,如果想使用某些功能,比如說插圖,可以把程式碼滑到底部,找到註釋中相關內容,複製黏貼到主文件中修改使用即可,不用再另外百度查詢怎麼插圖什麼的。

幻燈片的製作,我個人的感覺,不考慮特殊情況,一般來說是他們的好用程度是:keynote > Microsoft的PPT > Beamer,這說的是整體,當然,也是個人感覺,你要扣區域性哪裡好好我也沒有辦法。

keynote有一些特色,比如說magic move,用起來很方便。術業有專攻,PPT作為專業的幻燈製作工具,功能強大,操作簡單,很容易就能做出一些炫酷的切換和動畫效果,但是對公式的支援不太好,需要在公式編輯器中編輯,可遷移性差,如果不生成PDF,在一臺電腦上調好的版面,換一臺電腦可能就亂了。

Beamer雖然在版面上千篇一律,靈活性差,要做一些動畫效果或者實現一些其他功能很不容易,而且要消耗不少的slides頁數。然而,它在數學公式編輯上藉助LaTex的強大後臺,極具優勢。它編譯生成的導航條和數學符號,在PPT上做起來也很不容易,需要用到各種超連結。

可以說,不同的幻燈片製作工具各有優勢吧,我個人還是更偏向於PPT的,畫圖、動畫、切換以及插入本地檔案的超連結等,用起來都很輕便。

下面是一個LaTex的幻燈片模板,用的是Ctex套裝環境下的WinEdt編譯的,如果出現編碼錯誤問題,比如說tex檔案打不開,中文顯示亂碼(原始碼中中文亂碼、編譯後中文亂碼等),可以使用notepad++開啟tex修改編碼格式,使用UTF-8編碼。

% !Mode::"TeX:UTF-8"
% !Mode:: "TeX:UTF-8"
\documentclass[xcolor=svgnames,serif,table,10pt]{beamer}
\mode<presentation>{
% Setup appearance:
\useoutertheme{infolines}
\usetheme{Darmstadt}
\setbeamercovered{transparent}
\setbeamertemplate{caption}[numbered]
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{blocks}[rounded][shadow=true]
\setbeamertemplate{enumerate items}[circle]

% 修改樣式
\setbeamercolor{box}{bg=black!20!orange,fg=white}
\setbeamercolor{block title}{use=sidebar,fg=sidebar.fg!10!white,bg=orange!70!black}
\setbeamercolor{block title example}{use=sidebar,fg=sidebar.fg!10!white,bg=black!60!green}
\setbeamercolor{block title alerted}{use=sidebar,fg=sidebar.fg!10!white,bg=black!50!red}

\setbeamertemplate{headline}
{%
  \begin{beamercolorbox}[shadow=true]{section in head/foot}
  \vskip2pt\insertnavigation{\paperwidth}\vskip2pt
  \end{beamercolorbox}%
}
}
\usepackage{url}
\usepackage{animate}
\usepackage[english]{babel}
\usepackage{times}
\usepackage[T1]{fontenc}
\usepackage{multirow,multicol,longtable}
\usepackage{graphics}
\usepackage{xcolor}
\usepackage[no-math]{fontspec}%-------------------------------------------------- 提供字型選擇命令
\usepackage{xunicode}%----------------------------------------------------------- 提供Unicode字元巨集
\usepackage{xltxtra}%------------------------------------------------------------ 提供了針對XeTeX的改進並且加入了XeTeX的LOGO
\usepackage[BoldFont,SlantFont,CJKchecksingle]{xeCJK}%--------------------------- 使用xeCJK巨集包
%================================== 設定中文字型 ================================%
\setCJKmainfont{Adobe Heiti Std}%------------------------------------------------設定正文為黑體
\setCJKmonofont{Adobe Song Std}%-------------------------------------------------設定等距字型
\setCJKsansfont{Adobe Kaiti Std}%------------------------------------------------設定無襯線字型
% \setCJKfamilyfont{zxzt}{FZShouJinShu-S10S}
% \setCJKfamilyfont{FZDH}{FZDaHei-B02S}
%================================== 設定中文字型 ================================%

%================================== 設定英文字型 ================================%
\setmainfont[Mapping=tex-text]{Times New Roman}%--------------------------------英文襯線字型
\setsansfont[Mapping=tex-text]{Arial}%------------------------------------英文無襯線字型
\setmonofont[Mapping=tex-text]{Courier New}%-------------------------------------英文等寬字型
\newfontfamily\Arial{Arial}
%================================== 設定英文字型 ================================%

%================================== 設定數學字型 ================================%
%\setmathsfont(Digits,Latin,Greek)[Numbers={Lining,Proportional}]{Minion Pro}
%================================== 設定數學字型 ================================%
\punctstyle{kaiming}%------------------------------------------------------------ 開明式標點格式
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{positioning,backgrounds}
\usetikzlibrary{fadings}
\usetikzlibrary{patterns}
\usetikzlibrary{calc}
\usetikzlibrary{shadings}
\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}
\usepackage{xifthen}
\usepackage{colortbl,dcolumn}
\usepackage{enumerate}
\usepackage{pifont}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{hyperref}
%=================================== 數學符號 =================================%
\newcommand{\rtn}{\mathrm{\mathbf{R}}}
\newcommand{\N}{\mathrm{\mathbf{N}}}
\newcommand{\As}{\mathrm{a.s.}}
\newcommand{\Ae}{\mathrm{a.e.}}
\newcommand*{\PR}{\mathrm{\mathbf{P}}}
\newcommand*{\EX}{\mathrm{\mathbf{E}}}
\newcommand{\EXlr}[1]{\mathrm{\mathbf{E}}\left[#1\right]}
\newcommand*{\dif}{\,\mathrm{d}}
\newcommand*{\F}{\mathcal{F}}
\newcommand*{\h}{\mathcal{H}}
\newcommand*{\vp}{\varepsilon}
\newcommand*{\prs}{\dif\PR-\As}
\newcommand*{\dte}{\dif t-\Ae}
\newcommand*{\pts}{\dif\PR\times\dif t-\Ae}
\newcommand{\Ito}{It\^{o}}
\newcommand{\tT}[1][0]{[#1,T]}
\newcommand{\intT}[2][T]{\int^{#1}_{#2}}
\newcommand{\intTe}[1][t]{\intT[t+\varepsilon]{#1}}
\newcommand{\s}{\mathcal{S}}
\newcommand{\me}{\mathrm{e}}
\newcommand{\one}[1]{{\bf 1}_{#1}}
\renewcommand{\M}{{\rm M}}
\newcommand{\Me}[1][t]{M^{\varepsilon}_{#1}}
\newcommand{\Ne}[1][t]{N^{\varepsilon}_{#1}}
\newcommand{\Pe}[1][t]{P^{\varepsilon}_{#1}}
\DeclareMathOperator*{\sgn}{sgn}
% =================================== 數學符號 =================================%

% 定義羅馬數字
\makeatletter
\newcommand{\rmnum}[1]{\romannumeral #1}
\newcommand{\Rmnum}[1]{\expandafter\@slowromancap\romannumeral #
[email protected]
} \makeatother % 定義破折號 \newcommand{\pozhehao}{\kern0.3ex\rule[0.8ex]{2em}{0.1ex}\kern0.3ex} % 中文日期 \def\[email protected]{\the\year 年 \the\month 月} \newcommand\zhtoday{\[email protected]} % 中文圖表 \renewcommand\figurename{圖} \renewcommand\tablename{表} \graphicspath{{./}} % Author, Title, etc. \title{一個簡單的彙報} %% \subtitle{Foreground-constrained Eulerian Video Motion Magnification} \author[陸嵩]{陸嵩 \\中國科學院數學與系統科學研究院 \\計算數學與科學工程計算研究所 \\科學工程計算國家重點實驗室} \institute[LSEC,AMSS,CAS]{\includegraphics[height=1cm]{logo.jpg}} \date{\zhtoday} \setlength{\baselineskip}{22pt} \renewcommand{\baselinestretch}{1.4} % The main document \begin{document} \setlength{\abovedisplayskip}{1ex}%------------------------------------------ 公式前的距離 \setlength{\belowdisplayskip}{1ex}%------------------------------------------ 公式後的距離 \begin{frame} \titlepage \end{frame} \begin{frame} \frametitle{主要內容} \tableofcontents[hideallsubsections] \end{frame} \section{第一部分} \begin{frame} 一些內容 \end{frame} \begin{frame} 一些內容 \end{frame} \section{第二部分} \begin{frame} 一些內容 \end{frame} \begin{frame} 一些內容 \end{frame} \section{第三部分} \begin{frame} 一些內容 \end{frame} \begin{frame} 一些內容 \end{frame} \begin{frame}[plain]{} \begin{center} \begin{tikzpicture} \node[above,xscale=1.2,yscale=1.2]{\Huge 歡迎批評指正!}; \end{tikzpicture} \end{center} \end{frame} \end{document} %%%%下面的內容不參與文件的編譯。使用者在想用某個東西時直接可通過查閱,並複製黏貼和修改使用。 \iffalse  %註釋開始 %垂直居中 \begin{frame} \begin{center} 需要居中的內容! \end{center} \end{frame} 或者 \begin{frame} \centering 一些內容 \end{frame} %幻燈片標題的使用 \begin{frame} \frametitle{第一部分第一張幻燈} 一些內容 \end{frame} %專案編號的使用 \begin{frame} \frametitle{條目} \begin{itemize} \item 專案1 \item 專案2 \item 專案3 \item 專案4 \begin{itemize} \item 二級專案1 \item 二級專案2 \end{itemize} \end{itemize} \end{frame} %表格的使用 \begin{frame} \frametitle{表格} \begin{table}[htbp!] \centering \caption{主流機器學習框架} \begin{tabular}{c|c|c|c|c} \toprule[1pt] 機器學習庫 & 機構 & 支援語言 & 平臺 & Tensor \\ \toprule[1pt] TensorFlow & Google & C++,Python &跨平臺 & Good \\ \hline Pytorch & Facebook& Python & 跨平臺 & Good \\ \bottomrule[1pt] \end{tabular} \end{table} \end{frame} %區塊的使用 \begin{frame} \frametitle{分析} \begin{block}{XXX 演算法} \begin{itemize} \item 步驟1 \item 步驟2 \item 步驟3 \end{itemize} \end{block} \end{frame} %使用區塊來強調內容 \begin{frame} \frametitle{強調} \begin{itemize} \item 這是內容 \end{itemize} \only<1>\begin{block}{} 這裡蹦出來一個強調! \end{block} \end{frame} %section中目錄的使用 \begin{frame} \frametitle{技術影響力} \tableofcontents[currentsection,hideallsubsections] \end{frame} %插入圖片 \begin{frame} \begin{figure}[!h] \centering % Requires \usepackage{graphicx} \includegraphics[width=2cm]{pics/logo.jpg}\\ \caption{logo圖片樣例}\label{pic6} \end{figure} \end{frame} %分欄實現圖文混排 \begin{frame} 分欄前面的一些內容!! \begin{columns}%0.6 0.4表示相對比例 \column{0.6\textwidth}%<1-> 分欄的左側,文字敘述。 \column{0.4\textwidth}%<1-> 分欄的右側插入了圖片。 \begin{figure}[!h] \centering % Requires \usepackage{graphicx} \includegraphics[width=4cm]{pics/logo.jpg}\\ \caption{logo圖片樣例}\label{pic6} \end{figure} \end{columns} 分欄後面的一些內容!! \end{frame} \fi   %註釋結束

如果編譯錯誤提示缺圖片,可以隨便找一個圖片重新命名放入。一些基本的常用到Beamer或者說LaTex用法,放到了原始碼底部註釋,需要的時候可以從下面查詢複製黏貼使用,很方便。然後,你需要修改的就是

\begin{document}
\end{document}

之間的內容。