我定义了两个块环境,一个具有固定宽度,另一个具有可变长度(第二个基于定义这里)。一般情况下一切正常。但是,当我在可变长度块内的 itemize 环境中有一条长行时,它不会换行并且会变宽。我的代码及其生成的内容如下。有没有办法修复定义,以便 itemized 行可以正确换行?非常感谢。
![\documentclass\[table,xcolor=pdftex,dvipsnames\]{beamer}
\newenvironment<>{problock}\[1\]{%
\begin{actionenv}#2%
\def\insertblocktitle{#1}%
\par%
\mode<presentation>{%
\setbeamercolor{block title}{fg=white,bg=blue!50!white}
\setbeamercolor{block body}{fg=black,bg=blue!20}
\setbeamercolor{itemize item}{fg=blue}
\setbeamertemplate{itemize item}\[triangle\]
}%
\usebeamertemplate{block begin}}
{\par\usebeamertemplate{block end}\end{actionenv}}
\newenvironment<>{varproblock}\[2\]\[.9\textwidth\]{%
\setlength{\textwidth}{#1}
\begin{actionenv}#3%
\def\insertblocktitle{#2}%
\par%
\mode<presentation>{%
\setbeamercolor{block title}{fg=white,bg=blue!50!white}
\setbeamercolor{block body}{fg=black,bg=blue!20}
\setbeamercolor{itemize item}{fg=blue}
\setbeamertemplate{itemize item}\[triangle\]
}%
\usebeamertemplate{block begin}}
{\par\usebeamertemplate{block end}\end{actionenv}}
\begin{document}
\begin{frame}
\begin{problock}{Definition}
Given a countably infinite set $\cal{D}$ (documents), a Web of Linked Data is a tuple $W = ( D, adoc, data )$ where:
\begin{itemize}
\item $D \in \cal{D}$,
\item $adoc$ is a partial mapping from URIs to $D$, and
\item $data$ is a total mapping from $D$ to finite sets of RDF triples.
\end{itemize}
\end{problock}
\begin{varproblock}\[8cm\]{Definition}
A Web of Linked Data $W = (D, adoc, data)$ contains a data link from document $D \in \cal{D}$ to document $D' \in \cal{D}$ if there exists a URI $u$ such that:
\begin{itemize}
\item $u$ is mentioned in an RDF triple $t \in data(D)$ and
\item $D' = adoc(u)$.
\end{itemize}
\end{varproblock}
\end{frame}
\end{document}][2]
答案1
对我来说,与其尝试更改,不如\textwidth
将内容包装varproblock
在 minipage 环境中更明智。据我所知,没有任何副作用。对于您的第二个框,这给出:
以下是我修改你的环境的方法:
\newenvironment<>{varproblock}[2][.9\textwidth]{%
\begin{actionenv}#3%
\minipage{#1}
\def\insertblocktitle{#2}%
\par%
\mode<presentation>{%
\setbeamercolor{block title}{fg=white,bg=blue!50!white}
\setbeamercolor{block body}{fg=black,bg=blue!20}
\setbeamercolor{itemize item}{fg=blue}
\setbeamertemplate{itemize item}[triangle]
}%
\usebeamertemplate{block begin}}
{\par\usebeamertemplate{block end}\endminipage\end{actionenv}}