
我一直在組裝一個新的投影機模板,但無法解決最後幾個問題。以下是一個強調這些問題的最小工作範例(它看起來並不最小,但我覺得它是):
\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}
我現在有三個問題:
定理框在文字周圍有一些空白,這是我更喜歡的。如何調整邊距以使所有框完全一致?
由於“問題”框對應於定理環境,因此我無法自由填寫我想要的上部部分(“區塊標題”)。當然,這在某種意義上相當於將前兩個框架黏合在一起或更改一個框內的顏色設定。我怎樣才能做到這一點?
我希望這個問題很容易解決,但到目前為止我發現沒有任何東西可以完成這項工作:我希望字體變更應用於整個簡報(即除標題之外的所有文字)。我怎樣才能做到這一點?
答案1
回答基本問題
我懷疑你真正想知道的是:你可以像這樣使用投影機塊
\begin{block}{<block title>}
<block content>
\end{block}
(beamercolorbox
是“幕後”的東西 - 如果您實際上並沒有直接需要它,請使用將處理所有配置的投影機構造 - 這要容易得多)
\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}
回答各個子問題
定理框在文字周圍有一些空白,這是我更喜歡的。如何調整邊距以使所有框完全一致?
只需使用block
s。由於block
s 有一個強制性標題,而您的前兩個框沒有標題,因此\setbeamertemplate{block begin}{...}
需要重新定義。
由於“問題”框對應於定理環境,因此我無法自由填寫我想要的上部部分(“區塊標題”)。當然,這在某種意義上相當於將前兩個框架黏合在一起或更改一個框內的顏色設定。我怎樣才能做到這一點?
答案還是“使用block
s”
我希望這個問題很容易解決,但到目前為止我發現沒有任何東西可以完成這項工作:我希望字體變更應用於整個簡報(即除標題之外的所有文字)。我怎樣才能做到這一點?
如果您\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}