以前まで独自カスタムのBeamerテンプレートを使っていたが,Mac移行した際にいくつかのファイルが失われ,かつpLaTeXからLuaLaTeXに移行したことで使えなくなってしまったから,いっそのことカスタムテーマをやめた. なにか良いものがないか探していたら,(学生が使っていた)metropolisテーマが良さそう(というよりそれ以外あまりまともなものがない?)なのでそれを使うことにした. デフォルトでキレイなのであまり何もしなくても良いが,日本語を使う際には少しおまじないが必要だったので,メモとしてサンプルを載せておく.
LuaLaTeX版
下記サンプルコードで生成されるスライドPDFも添付しておく.
\documentclass[%
unicode, % 日本語用には必要らしい
mathserif, %
m, % vertical position of text: (t,m,b)
% handout, % for printing slides
% aspectratio=169,
10pt, %
% compress,
unknownkeysallowed
]{beamer}
\usepackage{luatexja}% 日本語にしたい
\usepackage[haranoaji,deluxe]{luatexja-preset}% フォント指定
\renewcommand{\kanjifamilydefault}{\gtdefault}% 既定をゴシック体に
\usetheme[numbering=fraction]{metropolis}
\definecolor{Purple}{HTML}{911146}
\definecolor{Orange}{HTML}{CF4A30}
% Theme colors are derived from these two elements
\setbeamercolor{alerted text}{fg=Orange}
% ... however you can of course override styles of all elements
\setbeamercolor{frametitle}{bg=Purple}
\title[Footer title]{Beamer metropolisテーマの日本語設定}
\subtitle{見栄えの良いBeamerスライドのための覚書}
\author[author]{小林 亮}
\institute[NITech]
{
所属\\
別の所属?\\
email address
}
\date{\today}
% DOCUMENT %
\usepackage{amsmath} % required for `\equation*' (yatex added)
\begin{document}
\begin{frame}[plain,b]
\titlepage
\end{frame}
% \begin{frame}{Outline}
% \tableofcontents
% \end{frame}
%\section{Section}
% \subsection{Subsection}
%
\begin{frame}[fragile]{テーマカラー設定}
\metroset{block=fill}
\begin{block}{このスライドのカラー設定}
\footnotesize
\begin{verbatim}
\definecolor{Purple}{HTML}{911146}
\definecolor{Orange}{HTML}{CF4A30}
%...Theme colors are derived from these two elements
\setbeamercolor{alerted text}{fg=Orange}
%...however you can of course override styles of all elements
\setbeamercolor{frametitle}{bg=Purple} \end{verbatim}
\end{block}
最初にカラーの名前を定義して,それをさまざまなエレメントのfgやbgに設定する.
\end{frame}
%
\begin{frame}[fragile]{Two-column and image}
\begin{columns}[c]
\begin{column}{.4\textwidth}
\centering
\includegraphics[keepaspectratio,width=.8\textwidth]{NIT_Logo.pdf}
\end{column}
%
\begin{column}{.6\textwidth}
\metroset{block=fill}
\begin{block}{Two-column code}
\footnotesize
\begin{verbatim}
\begin{columns}[m]
\begin{column}{.4\textwidth}
\centering
\includegraphics[..]{...}
\end{column}
%
\begin{column}{.6\textwidth}
Some content...
\end{column}
\end{columns} \end{verbatim}
\end{block}
プレゼンではtwo-columnをよく使う.
\end{column}
\end{columns}
\end{frame}
\end{document}
pLaTeX版
上の投稿を書いた後,LuaLaTeXだと問題が生じてpLaTeXに戻ったため,そのコードと出来上がりスライドを載せておく.上との違いは tcolorbox
を使っていることくらい.
\documentclass[%
unicode, % 日本語用には必要らしい
dvipdfmx, %
mathserif, %
m, % vertical position of text: (t,m,b)
% handout, % for printing slides
% aspectratio=169,
10pt, %
% compress,
unknownkeysallowed
]{beamer}
\renewcommand{\kanjifamilydefault}{\gtdefault}% 既定をゴシック体に
\usetheme[numbering=fraction]{metropolis}
\usefonttheme[onlymath]{serif}
\metroset{block=fill}
\definecolor{Purple}{HTML}{911146}
\definecolor{Orange}{HTML}{CF4A30}
\definecolor{Green}{HTML}{25AB00}
% Theme colors are derived from these two elements
\setbeamercolor{alerted text}{fg=Orange}
% ... however you can of course override styles of all elements
\setbeamercolor{frametitle}{bg=Purple}
\usepackage{tcolorbox}
% These options will be applied to all `tcolorboxes`
\tcbset{%
noparskip,
colback=Purple!5!white, %background color of the box
%colframe=gray!40, %color of frame and title background
colframe=Purple, %color of frame and title background
coltext=black, %color of body text
coltitle=white, %color of title text
fonttitle=\bfseries,
left=4pt, right=4pt,
gray/.style={coltitle=black,
colframe=gray!30!white,
colback=gray!5!white},
example/.style={coltitle=white,
colframe=Green!75!black,
colback=Green!5!white},
}
\title[Footer title]{Beamer metropolisテーマの日本語設定}
\subtitle{見栄えの良いBeamerスライドのための覚書}
\author[author]{小林 亮}
\institute[NITech]
{
所属\\
別の所属?\\
email address
}
\date{\today}
% DOCUMENT %
\usepackage{amsmath} % required for `\equation*' (yatex added)
\begin{document}
\begin{frame}[plain,b]
\titlepage
\end{frame}
% \begin{frame}{Outline}
% \tableofcontents
% \end{frame}
%\section{Section}
% \subsection{Subsection}
%
\begin{frame}[fragile]{テーマカラー設定}
\metroset{block=fill}
\begin{tcolorbox}[title=このスライドのカラー設定]
\footnotesize
\begin{verbatim}
\definecolor{Purple}{HTML}{911146}
\definecolor{Orange}{HTML}{CF4A30}
%...Theme colors are derived from these two elements
\setbeamercolor{alerted text}{fg=Orange}
%...however you can of course override styles of all elements
\setbeamercolor{frametitle}{bg=Purple} \end{verbatim}
\end{tcolorbox}
最初にカラーの名前を定義して,それをさまざまなエレメントのfgやbgに設定する.
\end{frame}
%
\begin{frame}[fragile]{Two-column and image}
\begin{columns}[c]
\begin{column}{.4\textwidth}
\centering
\includegraphics[keepaspectratio,width=.8\textwidth]{NIT_Logo.pdf}
\end{column}
%
\begin{column}{.6\textwidth}
\metroset{block=fill}
\begin{tcolorbox}[title=Two-column code]
\footnotesize
\begin{verbatim}
\begin{columns}[m]
\begin{column}{.4\textwidth}
\centering
\includegraphics[..]{...}
\end{column}
%
\begin{column}{.6\textwidth}
Some content...
\end{column}
\end{columns} \end{verbatim}
\end{tcolorbox}
プレゼンではtwo-columnをよく使う.
\end{column}
\end{columns}
\end{frame}
\end{document}