ボックスのサイズを一定に保ち、ボックスを「接着」するにはどうすればよいですか (Beamer 内)?

ボックスのサイズを一定に保ち、ボックスを「接着」するにはどうすればよいですか (Beamer 内)?

私は新しいビーマー テンプレートをまとめていますが、最後のいくつかの問題を解決できません。これらの問題を浮き彫りにする最小限の動作例は次のとおりです (最小限に見えませんが、そう感じます)。

\documentclass{beamer}

\makeatletter
\def\th@mystyle{
    \normalfont 
    \setbeamercolor{block title example}{bg=orange,fg=white}
    \setbeamercolor{block body example}{bg=orange!20,fg=black}
    \def\inserttheoremblockenv{exampleblock}
}

\makeatother
\theoremstyle{mystyle}
\newtheorem{que}{Question}

\usepackage{fontspec}
\setmainfont{Verdana}

\begin{document}

\section{Boxes}

\frame{
\frametitle{Boxes}
\fontspec{Cambria}
\setbeamercolor{postit}{fg=black,bg=orange!20} \begin{beamercolorbox}[rounded=false,shadow=true]{postit} How to inflate these two boxes such that their size... \end{beamercolorbox}
\setbeamercolor{postit}{fg=black,bg=green}
\begin{beamercolorbox}[rounded=false,shadow=true]{postit}...is precisely consistent with that of the third box?\end{beamercolorbox}
~\\
    \begin{que}[About this box]
    How to get such a box with arbitrary content, i.e. basically without it being a kind of theorem/definition? (Right now, the title is at least ``Question ()'')
\end{que}

~\\
\begin{que}[About the font]
How to apply the font change visible in the first two boxes to the whole presentation or at least the whole frame?
\end{que}
}

\end{document}

今、3つの質問があります。

  1. 定理のボックスにはテキストの周囲にいくらかの余白が含まれていますが、これは好ましいと思います。すべてのボックスが完全に一致するように余白を調整するにはどうすればよいでしょうか?

  2. 「質問」ボックスは定理環境に対応しているため、上部 (「ブロック タイトル」) を自由に入力することはできません。もちろん、これはある意味では最初の 2 つのボックスを結合したり、1 つのボックス内で色の設定を変更したりするのと同じです。どうすればそれができるでしょうか。

  3. これは簡単に修正できると思っていましたが、今のところうまくいく方法が見つかりません。フォントの変更をプレゼンテーション全体 (つまり、タイトル以外のすべてのテキスト) に適用したいのですが、どうすればよいですか?

答え1

基本的な問題に対する答え

あなたが本当に知りたいのは、ビーマーブロックをこのように使用できることだと思います

\begin{block}{<block title>}
   <block content>
\end{block}

(beamercolorboxこれは「舞台裏」のためのものです。実際に直接必要でない場合は、すべての構成を処理する Beamer コンストラクトを使用してください。その方がはるかに簡単です)

\documentclass{beamer}

\setbeamercolor{block title}{bg=orange,fg=white}
\setbeamercolor{block body}{bg=orange!20,fg=black}

\begin{document}

\begin{frame}
\frametitle{Boxes}
    \begin{block}{How to inflate these two boxes such that their size...}
        ...is precisely consistent with that of the third box?
    \end{block}
\end{frame}

\end{document}

ここに画像の説明を入力してください

個々のサブ質問に答える

定理のボックスにはテキストの周囲にいくらかの余白が含まれていますが、これは好ましいと思います。すべてのボックスが完全に一致するように余白を調整するにはどうすればよいでしょうか?

単にblocks を使用します。blocks には必須のタイトルがあり、最初の 2 つのボックスにはタイトルがないため、\setbeamertemplate{block begin}{...}再定義する必要があります。

「質問」ボックスは定理環境に対応しているため、上部 (「ブロック タイトル」) を自由に入力することはできません。もちろん、これはある意味では最初の 2 つのボックスを結合したり、1 つのボックス内で色の設定を変更したりするのと同じです。どうすればそれができるでしょうか。

答えは「blocksを使う」です

これは簡単に修正できると思っていましたが、今のところうまくいく方法が見つかりません。フォントの変更をプレゼンテーション全体 (つまり、タイトル以外のすべてのテキスト) に適用したいのですが、どうすればよいですか?

\fontspec{Cambria}プレゼンテーションの始めに設定すると、通常のテキストはすべて Cambria で表示されますが、フレームやブロックなどのタイトルは Verdana のままになります。これらを変更するには、 を調整します\setbeamerfont{block title}{...}

% !TEX TS-program = xelatex
\documentclass{beamer}

\makeatletter
\def\th@mystyle{
    \normalfont 
    \setbeamercolor{block title example}{bg=orange,fg=white}
    \setbeamercolor{block body example}{bg=orange!20,fg=black}
    \def\inserttheoremblockenv{exampleblock}
}

\makeatother
\theoremstyle{mystyle}
\newtheorem{que}{Question}

\setbeamercolor{block body}{fg=black,bg=orange!20} 
\setbeamercolor{block title}{bg=orange,fg=white} 

\usepackage{xstring}

\setbeamertemplate{block begin}
{
  \par\vskip\medskipamount%
  \IfStrEq{\insertblocktitle}{}{}{
      \begin{beamercolorbox}[colsep*=.75ex]{block title}
        \usebeamerfont*{block title}\insertblocktitle%
      \end{beamercolorbox}%
  }
  {\parskip0pt\par}%
  \ifbeamercolorempty[bg]{block title}
  {}
  {\ifbeamercolorempty[bg]{block body}{}{\nointerlineskip\vskip-0.5pt}}%
  \usebeamerfont{block body}%
  \begin{beamercolorbox}[colsep*=.75ex,vmode]{block body}%
    \ifbeamercolorempty[bg]{block body}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}

\usepackage{fontspec}
\setmainfont{Verdana}


\begin{document}
\fontspec{Cambria}

\section{Boxes}

\begin{frame}
\frametitle{Boxes}

\begin{block}{} 
        How to inflate these two boxes such that their size... 
\end{block}

{
    \setbeamercolor{block body}{fg=black,bg=green} 
    \begin{block}{} 
        precisely consistent with that of the third box? 
    \end{block}
}

\begin{block}{About this box}
  How to get such a box with arbitrary content, i.e. basically without it being a kind of theorem/definition? (Right now, the title is at least ``Question ()'')
\end{block}

\end{frame}

\end{document}

ここに画像の説明を入力してください

関連情報