準備
同一フォルダ内に以下の2つのファイルを入れてください。
例えば、Zというフォルダ内に「.latexmkrc, NotoSansJP-Regular, main.tex」の3つがあれば、main.texをコンパイラ出来ます。
.latexmkrc
$latex = 'uplatex';
$dvipdf = 'dvipdfmx %O -o %D %S';
$pdf_mode = 3;
NotoSansJP-Regular.otf
Google Fontsから無料でダウンロードできます。
https://fonts.google.com/noto/specimen/Noto+Sans+JP
テンプレ
%Iceberg風Beamer
\RequirePackage{plautopatch} %おまじない
\documentclass[uplatex,dvipdfmx,12pt]{beamer}
%=====packages=====
\usepackage{bxdpx-beamer} %for dvipdfmx
\usepackage{pxjahyper} %日本語でbookmark
\usepackage{amsmath} %数式環境
\usepackage{enumitem} %itemizeのバレット
\usepackage[]{otf} %日本語フォント
\usepackage[noalphabet,unicode]{pxchfon} %日本語フォント
%=====color=====
\definecolor{iceberg_bg}{rgb}{0.086, 0.094, 0.129} %161821
\definecolor{iceberg_fg}{rgb}{0.776, 0.784, 0.819} %c6c8d1
\definecolor{icered}{rgb}{0.886, 0.470, 0.470} %e27878
\definecolor{iceorange}{rgb}{0.886, 0.643, 0.470} %e2a478
\definecolor{icegreen}{rgb}{0.705, 0.745, 0.509} %b4be82
\definecolor{icesky}{rgb}{0.537, 0.721, 0.760} %89b8c2
\definecolor{iceblue}{rgb}{0.517, 0.627, 0.776} %84a0c6
\definecolor{icepurple}{rgb}{0.627, 0.576, 0.780} %a093c7
%=====theme=====
\usetheme{Pittsburgh}
\useoutertheme{infolines}
\useinnertheme{default}
\setbeamertemplate{footline}{}
\usecolortheme{default}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{footline}[frame number]
\setbeamercolor{title}{fg=iceblue}
\setbeamercolor{author}{fg=icepurple}
\setbeamercolor{institute}{fg=iceberg_fg}
\setbeamercolor{date}{fg=iceberg_fg}
\setbeamercolor{section in head/foot}{fg=iceberg_fg, bg=iceberg_bg}
\setbeamercolor{subsection in head/foot}{fg=iceberg_fg, bg=iceberg_bg}
\setbeamercolor{frametitle}{fg=iceblue}
\setbeamercolor{normal text}{fg=iceberg_fg, bg=iceberg_bg}
%=====itemizeのバレット、色はiceblue=====
\newcommand{\labelitemi}{\textcolor{iceblue}{\rule[0.25ex]{1ex}{1ex}}} %レベル1を四角
\newcommand{\labelitemii}{$\textcolor{iceblue}{\bullet}$} %レベル2を丸
%=====block=====
\setbeamercolor{block title}{bg=iceberg_bg, fg=iceorange}
\setbeamercolor{block body}{bg=iceberg_bg!90, fg=iceberg_fg!90}
%=====オリジナル・コマンド=====
\newcommand{\void}{\vspace{\baselineskip}} %1行空白を入れる
\newcommand{\red}[1]{\textcolor{icered}{#1}} %赤文字
\newcommand{\blue}[1]{\textcolor{iceblue}{#1}} %青文字
\newcommand{\green}[1]{\textcolor{icegreen}{#1}} %緑文字
%=====日本語フォント=====
\setminchofont{NotoSansJP-Regular.otf} %好みのotf/ttfファイルを入れる
%=====欧文フォント=====
\usepackage[defaultsans,scaled=.85]{droidsans}
\usepackage[T1]{fontenc}
%=====数式フォント=====
\usepackage{newtxsf}
%=====行間調整=====
\renewcommand{\baselinestretch}{1.0}
%ここから本文
\title[short title]{Iceberg風 Beamer テンプレート}
\author[short author]{Author}
\institute[short institute]{Institute}
\date[short date]{date}
\begin{document}
\maketitle
\begin{frame}{コンパイラはupLaTex}
フォント
\begin{itemize}
\item 欧文: Droid Sans。数式: newtxsf math。
\begin{itemize}
\item 日本語: Noto Sans JP。Download the otf file for free, Google it.
\end{itemize}
\end{itemize}
\begin{block}{ブロック}
.latexmkrcとNotoSansJP-Regular.otfは同一フォルダに入れてね。
\end{block}
\void %1行空行を入れるコマンド、便利
数式
\begin{align}
f(x) = x
\end{align}
強調したいときは、\textbackslash red\{words\} で\red{強調}できるよ。
\end{frame}
\end{document}
出力結果
動作環境
Overleaf上で正しく動くことを確認しています。メニューからコンパイラを「LaTeX」に変更するのを忘れないように。
アレンジ方法
テンプレ内の「theme」のところで、文字の色など変えられます。例えば以下のコードでは本文テキストの色を変えています。「fg=iceberg_fg」で、文字の色を定義した「iceberg_fg」という色に、「bg=icegerg_bg」で、文字の背景色を定義した「iceberg_bg」という色に変えています。
\setbeamercolor{normal text}{fg=iceberg_fg, bg=iceberg_bg}
備考
- 定義されている「\void」コマンドは、1行空行を入れるコマンドで結構便利です。
- 「\red, \blue, \green」コマンドで、文字の色を簡単に変えられます。
- 自分が持っているotfファイルで日本語フォントを自由に変えられるようになっています。
- 欧文フォントは「Droid Sans」、数式フォントは「newtxsf math」を使っています。
- 参考資料のウェブサイトを参考に、簡単に好みのものに変えられます。
- テンプレの「%packagesから%行間調整」を別のファイルに書くことで (template.tex)、簡潔にすることができます。
- 新たに「template.tex」というファイルを同一フォルダに作って、以下のようにしても同じ出力が得られます。
\RequirePackage{plautopatch}
\documentclass[uplatex,dvipdfmx,12pt]{beamer}
\input{template.tex}
\begin{document}
xxx.
\end{document}
参考資料
Iceberg作者様:http://cocopon.github.io/iceberg.vim/
欧文・数式フォントのリスト:https://tug.org/FontCatalogue/sansseriffonts.html