我想要在 itemize 环境中有块。代码:
\documentclass[8pt]{beamer}
\usetheme{Madrid}
\begin{document}
\begin{frame}{Bad Frame}
\begin{itemize}
\item Some item here
\begin{block}{Bad Block}
Bad text
\end{block}
\item Some item here
\end{itemize}
\end{frame}
\end{document}
产生如下内容:
但我确实希望块与项目文本对齐,而不是向左移动。开始对我拥有的每个块使用列:
\begin{columns}
\begin{column}{0.075\textwidth}
\end{column}
\begin{column}{0.925\textwidth}
\begin{block}{\bf Output}
Good block text
\end{block}
\end{column}
\end{columns}
但这看起来很丑,文档变得不可读。我可以创建一个简单的命令或环境,如下所示:
\begin{itemize}
\item Some item here
\begin{gblock}{Good Block}
Good text
\end{gblock}
\item Some item here
\end{itemize}
答案1
这看起来确实不错:
\newenvironment<>{gblock}[2][\textwidth]{%
\setlength{\textwidth}{#1}
\begin{columns}
\begin{column}{0.075\textwidth}
\end{column}
\begin{column}{0.925\textwidth}
\begin{actionenv}#3%
\def\insertblocktitle{#2}%
\par%
\usebeamertemplate{block begin}}
{\par%
\usebeamertemplate{block end}%
\end{actionenv}
\end{column}
\end{columns}}