私は「metropolis」Beamer テーマ + fontspec + Fira フォントを基にして、シンプルな .sty ファイルを作成しました。タイトル ページで著者と機関を MWE のように表示する、つまり著者/機関ごとに 1 行ずつ表示するというアイデアが気に入っています。このレイアウトの欠点は、\author マクロと \institution マクロを使用する場合、引数を\\
同じ inst. の形式で共著者を区切って渡す必要があることです。align=left
この処理は が行います。問題は、新しい段落でデフォルトの色である黒が使用され、それ以上の色が使用されないことです\usebeamercolor[fg]{author}
。color = \usebeamercolor[fg]{author}
ノード定義でを使用するとMissing \endcsname inserted
、エラーが発生します。color = white
は機能します。これは私が今行っていることです。しかし、それは色をハードコーディングすることを意味します。これは避けたほうがよいでしょう。解決策としては、著者のリストを次のように分割することが考えられます。\@authorsリストを\andで分割します著者をループ処理していますが、私がやっていることとしてはやり過ぎのようです。\usebeamercolor[fg]{author}
すべての著者に適用するより簡単な方法はありますか?
MWE:
\documentclass[11pt, aspectratio=169]{beamer} %
\usetheme[]{metropolis}
% Requirement
\usepackage{tikz}
\usepackage{fontspec}
% colors
\definecolor{BGlightBlu}{HTML}{3461AA}
% Fonts
\newfontfamily{\RuLight}{Rubik Light}
% Settings
\setbeamercolor*{author}{fg = white}
% innertheme
\defbeamertemplate*{title page}{thisStyle}[1][]
{%
\begin{tikzpicture}[remember picture,overlay]
\draw[fill=BGlightBlu, BGlightBlu] (current page.south west) rectangle
(current page.north east);
% Title
\node
[ align=left,
xshift=.6cm,
yshift = 1cm,
minimum width=0.8\textwidth,
text width=0.7\textwidth,
anchor = west,
font = {\RuLight \LARGE},
text = white,
execute at begin node=\setlength{\baselineskip}{0.7\baselineskip}
] (title) at (current page.west)
{
\inserttitle
};
% Author
\node
[
below=0.6cm,
align=left,
anchor = north west,
xshift=.6cm,
font={\RuLight \footnotesize},
align=left,
% color=white, %works
% color = \usebeamercolor[fg]{author}, % 'Missing \endcsname' error
execute at begin node=\setlength{\baselineskip}{01.2\baselineskip}
] (author) at (title.south west){ \usebeamercolor[fg]{author} \insertauthor
};
% Inst
\node
[
xshift = 0.5\textwidth,
below=0.6cm,
align=left,
anchor = north west,
font={\RuLight \footnotesize},
align=left,
color=white,
execute at begin node=\setlength{\baselineskip}{1.2\baselineskip}
] (inst) at (title.south west){ \insertinstitute };
\end{tikzpicture}
}
\title[]{The title is so long that it needs two lines}
\author[]{Me Myself \\ My First Coauthor, My Second Coauthor}
\institute[]{My Place alone (MPA) \\ Their place, together (TPT)}
\begin{document}
\begin{frame}[plain]
\maketitle
\end{frame}
\end{document}
ここで、エラーを再現するために、コードを BgMWE.tex と beamerthemeMWE.sty に分割しました。
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% beamerthemeMWE.sty
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\mode<presentation>
\usetheme[]{metropolis}
% Requirement
\usepackage{tikz}
% Settings
\setbeamercolor*{author}{fg = red}
% innertheme
\setbeamertemplate{background}{
\begin{tikzpicture}
\draw[fill=BGlightBlu, BGlightBlu] (current page.south west) rectangle
(current page.north east);
\ifnum\thepage>1\relax%
\fill[white,opacity=1] (0,0) rectangle(\the\paperwidth,\the\paperheight);
\fi
\end{tikzpicture}
}
\defbeamertemplate*{title page}{MWE}[1][]
{%
\begin{tikzpicture}[remember picture,overlay]
% Title
\node
[ align=left,
xshift=.6cm,
yshift = 1cm,
minimum width=0.8\textwidth,
text width=0.7\textwidth,
anchor = west,
font = { \LARGE},
text = white,
execute at begin node=\setlength{\baselineskip}{0.7\baselineskip}
] (title) at (current page.west)
{
\inserttitle
};
% Author
\node
[
below=0.6cm,
align=left,
anchor = north west,
xshift=.6cm,
font={ \footnotesize},
align=left,
color = author.fg, % Here is the source of the error
execute at begin node=\setlength{\baselineskip}{0.8\baselineskip}
] (author) at (title.south west){ \insertauthor
};
% Inst
\node
[
xshift = 0.5\textwidth,
below=0.6cm,
align=left,
anchor = north west,
font={ \footnotesize},
align=left,
color=white,
execute at begin node=\setlength{\baselineskip}{0.8\baselineskip}
] (inst) at (title.south west){ \insertinstitute };
\node[below=0.5cm,
align=left,
anchor = north west,
font={ \large},
color=white,
] (date) at (author.south west){ \insertdate};
\end{tikzpicture}[action]{%
{\usebeamercolor[fg]{author}}% just to initialize the colour
}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% BgMWE.tex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[11pt, aspectratio=169]{beamer} %
\usetheme{MWE}
\title[]{The title is so long that it needs two lines}
\author[]{Me Myself \\ My First Coauthor, My Second Coauthor}
\institute[]{My Place alone (MPA) \\ Their place, together (TPT)}
\begin{document}
\begin{frame}[plain]
\maketitle
\end{frame}
\end{document}
MWE.texをコンパイルするとMWE.tex:14: Package xcolor Error: Undefined color `author.fg'.
Type H <return> for immediate help.```
答え1
以前に著者の色を使用したことがある場合 (単純なもので{\usebeamercolor[fg]{author}}
十分です)、次のようにして前景コンポーネントにアクセスできますauthor.fg
。
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% BgMWE.tex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[11pt, aspectratio=169]{beamer}%
\begin{filecontents*}[overwrite]{beamerthemeMWE.sty}
\mode<presentation>
\usetheme{moloch}% modern fork of the metropolis theme
% Requirement
\usepackage{tikz}
\definecolor{BGlightBlu}{HTML}{3461AA}
% Settings
\setbeamercolor*{author}{fg = red}
% innertheme
\setbeamertemplate{background}{
\begin{tikzpicture}
\draw[fill=BGlightBlu, BGlightBlu] (current page.south west) rectangle
(current page.north east);
\ifnum\thepage>1\relax%
\fill[white,opacity=1] (0,0) rectangle(\the\paperwidth,\the\paperheight);
\fi
\end{tikzpicture}
}
\defbeamertemplate*{title page}{MWE}[1][]
{%
\begin{tikzpicture}[remember picture,overlay]
% Title
\node
[ align=left,
xshift=.6cm,
yshift = 1cm,
minimum width=0.8\textwidth,
text width=0.7\textwidth,
anchor = west,
font = {\LARGE},
text = white,
execute at begin node=\setlength{\baselineskip}{0.7\baselineskip}
] (title) at (current page.west)
{\inserttitle};
% Author
\node
[
below=0.6cm,
align=left,
anchor = north west,
xshift=.6cm,
font={\footnotesize},
align=left,
color = author.fg, % Here is the source of the error
execute at begin node=\setlength{\baselineskip}{0.8\baselineskip}
] (author) at (title.south west){\insertauthor};
% Inst
\node
[
xshift = 0.5\textwidth,
below=0.6cm,
align=left,
anchor = north west,
font={\footnotesize},
align=left,
color=white,
execute at begin node=\setlength{\baselineskip}{0.8\baselineskip}
] (inst) at (title.south west){\insertinstitute};
\node[below=0.5cm,
align=left,
anchor = north west,
font={\large},
color=white,
] (date) at (author.south west){\insertdate};
\end{tikzpicture}
}
{\usebeamercolor[fg]{author}}
\end{filecontents*}
\usetheme{MWE}
\title[]{The title is so long that it needs two lines}
\author[]{Me Myself \\ My First Coauthor, My Second Coauthor}
\institute[]{My Place alone (MPA) \\ Their place, together (TPT)}
\begin{document}
\begin{frame}[plain]
\maketitle
\end{frame}
\end{document}