
私は を使用してポスターを作成していますbeamerposter
。ブロック内のテキストには常に左余白がないようです。ブロックに左余白を導入する方法を教えていただけますか?
ブロックの外観のサンプルを以下に示します。テキストが左余白なしで始まることに注意してください。
ブロック内の左、右、上、下の余白を定義する方法を教えていただけるとありがたいです。ネストされたブロックがありますが、ネストされたブロックには別の環境名 (then と呼びます) があることに注意してください。したがって、環境の余白が自分の環境の余白に影響を与えないようinsideBlocks
にします。block
insideBlocks
分かりやすくなったと思います。
答え1
これはさまざまな方法で実現できると思います。1 つの可能性は、次のようにカスタム マージンを持つ新しいブロック環境を定義することです。
\documentclass{beamer}
\usetheme{Frankfurt}
\newenvironment<>{myblock}[1]{%
\begin{actionenv}#2%
\def\insertblocktitle{\leftskip=10pt\rightskip=10pt\vspace{10pt} #1\vspace{10pt}}%
\par%
\usebeamertemplate{block begin}\leftskip=10pt\rightskip=10pt\vspace{10pt}}
{\par\vspace{10pt}\usebeamertemplate{block end}
\end{actionenv}}
\begin{document}
\begin{frame}
\begin{myblock}{example title to show 10pt up, down, left and right margins}
example text to show 10pt up, down, left and right margins
\end{myblock}
\begin{block}{example title to show standard margins}
example text to show standard margins
\end{block}
\end{frame}
\end{document}
新しい環境 ( と呼びますmyblock
)では\leftskip
、\rightskip
と\vspace
を使用して余白を設定します。例として、すべてを 10pt に設定しました。右余白などが必要ない場合は、rightskip
コードから を削除します。タイトル テキストの余白もカスタマイズしたいと想定しましたが、必要ない場合はleftskip
など を から削除するだけです\def\insertblocktitle{}
。結果は次のとおりです。
tcolorbox
もう 1 つの可能性は、次のようにマージンを設定できるパッケージを使用することです。
\documentclass{beamer}
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\tcbset{ % custom tcolorbox
skin=enhanced,
frame style={fill=blue}, % sets the frame color
bottom=10pt, % distance between the body text and the bottom frame
top=10pt, % distance between the body text and the top frame
left=10pt,
right=10pt,
boxrule=0pt, % frame width
bottomtitle=10pt, % distance between the title text and the bottom title frame
toptitle=10pt, % distance between the title text and the top title frame
lefttitle=10pt, % title text left margin
righttitle=10pt
}
\begin{document}
\begin{frame}
\begin{tcolorbox}[title=test]
test
\end{tcolorbox}
\end{frame}
\end{document}
結果は次のとおりです:
beamerposter
編集:サンプル コードにはパッケージを追加しませんでした。変更しbeamer
てbeamerposter
もしなくても動作するからです。
答え2
tcolorboxの内部テーマの次期バージョンv0.3を使用することもできます(https://www.ctan.org/pkg/beamertheme-tcolorbox)。このテーマを使用すると、ネストされたブロックは自動的に周囲のブロックよりも少し小さくなります。
\documentclass{beamer}
\usetheme{Warsaw}
\usepackage[size=a4,orientation=portrait]{beamerposter}
\useinnertheme{tcolorbox}
\begin{document}
\begin{frame}
\begin{block}{title}
content...
\begin{block}{title}
content...
\end{block}
\end{block}
\end{frame}
\end{document}