2011年5月20日 星期五

LaTeX 與 Beamer

最近因為一些需要,必需使用 LaTeX 製作投影片,所以研究了一下 Beamer 的使用方法。其實寫起來並不困難,和一般的 LaTeX article 差不多。Beamer 的 document structure 如下:

\documentclass{beamer}
\usetheme{Singapore} %% 這一個是佈景主題 (選用)
\begin{document}

\title{Title}
\author{Author Name}
\institute{Institute}

\frame{\titlepage} %% 顯示標題頁面

%% ... 其他內容 ...

\end{document}

接下來和 article 一樣,可以分為 section 與 subsection,而每一個 section 和 subsection 可以由若干個 frame 組成。

\section{Section 1}
%% 如果你有需要,可以在這裡加上 \subsection{Subsection 1.1} 
\begin{frame}
  \frametitle{Frame 1.1}
  \begin{itemize}
    \item{Item 1}
    \item{Item 2}
  \end{itemize}
\end{frame}

我們可以看到每個 frame 都會有一個 frametitle,也就是每一頁上方的標題。而下面就是該頁的內容。如果你要條列出各個要點,可以使用 itemize。

最後如果你需要顯示大綱,可以在 titlepage 下面加上:

\section*{Outlines}
\begin{frame}
  \frametitle{Outlines}
  \tableofcontents
\end{frame}

不過因為要建立 tableofcontents 所以要執行 pdflatex 編譯你的投影片二次。這樣你就可以得到一個精美的投影片了。你可以在這裡下載到範例投影片與原始檔