Beamerを使おう
TL;DR
Beamerを使ってかっこいいスライドを作ろう。
Beamerの基本的な使い方について書きます。
Beamer is 何
プレゼン用のスライドを作ることができるのクラス。
なので、もちろん綺麗な数式が書ける。
MacTeXをインストールしていれば、既に入っているので特に環境構築は不要。
Beamer事始め
まずはシンプルなスライドを作る。ちなみに僕の好みでLuaLaTeXです。
\documentclass[unicode,12pt]{beamer} % 'unicode'が必要 \usepackage{luatexja} % 日本語したい \title[Hogehoge]{Fugafuga} %Short title,Long title \author{Taro BEAMER} %名前 \institute{HogeFuga Univ.} %所属 \date{2019/2/14} %日付 \begin{document} \maketitle \begin{frame}{Test} Hello,Beamer! \end{frame} \end{document}
コンパイルすると、こんな感じのスライドが出来上がる。
カスタマイズしていく
とりあえずスライドはできたけど、これでは味気ない。
てなわけで、カスタマイズしていく。
フォント関係
さっきのコードに追記して、
\documentclass[unicode,12pt]{beamer} \usepackage{luatexja} \usepackage[no-math]{fontspec} %追加 \usepackage[no-math]{luatexja-fontspec} %追加 \setmainfont[Ligatures=TeX,BoldFont=Helvetica Neue Medium,ItalicFont=Helvetica Neue Light Italic,BoldItalicFont=Helvetica Neue Bold Italic]{Helvetica Neue Light} %追加 \setsansfont[Ligatures=TeX,BoldFont=Helvetica Neue Medium,ItalicFont=Helvetica Neue Light Italic,BoldItalicFont=Helvetica Neue Bold Italic]{Helvetica Neue Light} %追加 \setmainjfont[BoldFont=HiraginoSans-W4]{HiraginoSans-W3} %追加 \setsansjfont[BoldFont=HiraginoSans-W4]{HiraginoSans-W3} %追加 \usefonttheme{professionalfonts} %数式のフォントをlatex文書と同じに \title[Hogehoge]{Fugafuga} \author{Taro BEAMER} \institute{HogeFuga Univ.} \date{2019/2/14} \begin{document} \maketitle \begin{frame}{Test} Hello,Beamer! \end{frame} \end{document}
通常の文章と同様にフォントを指定できます。
LuaLaTeXでのフォント指定については、LaTex事始め - 物理学徒の備忘録参照。
\usefonttheme{professionalfonts}
を追加することで、数式のフォントがHelveticaに変わってしまうのを防げます。
テーマの変更
Beamerではテーマを指定することができる。
テーマは、beamer themeとかでググるといっぱい見つかる。
今回は、僕が今気に入って使っているテーマを指定してみる。
テーマを使うためには、
\documentclass[unicode,12pt]{beamer} \usepackage{luatexja} \usepackage[no-math]{fontspec} \usepackage[no-math]{luatexja-fontspec} \setmainfont[Ligatures=TeX,BoldFont=Helvetica Neue Medium,ItalicFont=Helvetica Neue Light Italic,BoldItalicFont=Helvetica Neue Bold Italic]{Helvetica Neue Light} \setsansfont[Ligatures=TeX,BoldFont=Helvetica Neue Medium,ItalicFont=Helvetica Neue Light Italic,BoldItalicFont=Helvetica Neue Bold Italic]{Helvetica Neue Light} \setmainjfont[BoldFont=HiraginoSans-W4]{HiraginoSans-W3} \setsansjfont[BoldFont=HiraginoSans-W4]{HiraginoSans-W3} \usefonttheme{professionalfonts} \useoutertheme{infolines} %追加 \usecolortheme{dolphin} %追加 \usecolortheme[RGB={0,128,0}]{structure} %追加 \title[Hogehoge]{Fugafuga} \author{Taro BEAMER} \institute{HogeFuga Univ.} \date{2019/2/14} \begin{document} \maketitle \begin{frame}{Test} Hello,Beamer! \end{frame} \end{document}
BeamerのテーマにはOuter themeとColor themeとか色々あり、それぞれ別のものを指定できる。今回は、Outer themeとしてinfolines、Color themeとしてdolphinを指定しています。で、dolphinの色をRGBで指定し、緑に変えています。
このテーマを指定すると、勝手にヘッダーやフッターを入れてくれます。
これだけでかなりかっこよくなりました(個人的感想)。
右下のナビゲーションシンボルいらんなって人は、
\setbeamertemplate{navigation symbols}{}
を追記すると消えます。
最後に
適当に作った例を置いておきます。
\documentclass[unicode,12pt]{beamer} \usepackage{luatexja} \usepackage[no-math]{fontspec} \usepackage[no-math]{luatexja-fontspec} \setmainfont[Ligatures=TeX,BoldFont=Helvetica Neue Medium,ItalicFont=Helvetica Neue Light Italic,BoldItalicFont=Helvetica Neue Bold Italic]{Helvetica Neue Light} \setsansfont[Ligatures=TeX,BoldFont=Helvetica Neue Medium,ItalicFont=Helvetica Neue Light Italic,BoldItalicFont=Helvetica Neue Bold Italic]{Helvetica Neue Light} \setmainjfont[BoldFont=HiraginoSans-W4]{HiraginoSans-W3} \setsansjfont[BoldFont=HiraginoSans-W4]{HiraginoSans-W3} \usefonttheme{professionalfonts} \useoutertheme{infolines} \usecolortheme{dolphin} \usecolortheme[RGB={0,128,0}]{structure} \title[Hogehoge]{Fugafuga} \author{Taro BEAMER} \institute{HogeFuga Univ.} \date{2019/2/14} \begin{document} \maketitle \begin{frame}{Table of contents} \tableofcontents \end{frame} \section{Electromagnetism} \subsection{Maxwell's Equations} \begin{frame}{Maxwell's Equations in vacuum} \begin{eqnarray*} \mathrm{rot} \vec{E} &=& - \frac{\partial \vec{B}}{\partial t}\\ \mathrm{rot} \vec{H} &=& \frac{\partial \vec{D}}{\partial t}\\ \mathrm{div} \vec{D} &=& 0\\ \mathrm{div} \vec{B} &=& 0 \end{eqnarray*} \end{frame} \section{Conclusion} \begin{frame}{Beamer is} \Huge \centering So Cool! \end{frame} \end{document}