\documentclass{beamer}
\usepackage{picture}
\begin{document}
\begin{frame}{Here is text}
\begin{itemize}[<+->]
\item A first item
\item Another item, also inside the brace
\makebox(0,0){\put(0,2.2\normalbaselineskip){%
$\left.\rule{0pt}{1.1\normalbaselineskip}\right\}$ foo}}
\item Outside the brace
\end{itemize}
\end{frame}
\end{document}
答案1
我不太确定你想要达到什么效果,但也许是这样的:
主要问题是您需要移动受影响的其他项目行上的文本,以便为左括号及其文本腾出空间。我认为,要自动执行此操作会非常复杂,因此我使用 手动移动了文本\hspace*{}
。
除此之外,代码与右括号的代码基本相同,只是我制作了宏\LeftBrace{text}
来\RightBrace{text}
执行此操作。默认情况下,它们都跨越两行,但如我的示例所示,您可以使用可选参数更改这一点。以下是完整代码:
\documentclass{beamer}
\usepackage{picture}
\newcommand\RightBrace[2][1.1]{\makebox(0,0){\put(0,2.2\normalbaselineskip){%
$\left.\rule{0pt}{#1\normalbaselineskip}\right\}$ #2}}}
\newcommand\LeftBrace[2][1.1]{\makebox(0,0){\put(0,2.2\normalbaselineskip){#2%
$\left\{\rule{0pt}{#1\normalbaselineskip}\right.$}}\phantom{#2\{}}
\begin{document}
\begin{frame}{Here is text}
\begin{itemize}[<+->]
\item A first item
\item Another item, also inside the brace\RightBrace{foo}
\item Outside the brace
\item \hspace*{9mm}Inside the left brace
\item \LeftBrace[2]{goo} Inside the brace
\item \hspace*{9mm}Inside the left brace
\end{itemize}
\end{frame}
\end{document}
答案2
\documentclass{beamer}
\usepackage{picture}
\begin{document}
\begin{frame}{Here is text}
\begin{itemize}[<+->]
\item A first item
\item Another item, also inside the brace
\makebox(0,0){\put(0,2.2\normalbaselineskip){%
$\left\{\rule{0pt}{1.1\normalbaselineskip}\right.$ foo}}
\item Outside the brace
\end{itemize}
\end{frame}
\end{document}
答案3
这是一个使用的解决方案蒂克兹并进行了调整蒂克兹马克,它使用垂直线跨越行高\strut
,因此您可以在基线下方和行顶部处获得锚点。
Tikz 允许您单独调整支架。
\documentclass{beamer}
\usepackage{picture}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
% flexible textmark with anchorpoints regarding a strut inline
\newcommand{\tikzmarkflex}[1]{\tikz[remember picture]\node[inner sep = 0pt](#1){\vphantom{\strut}};\relax}%
\begin{document}
\begin{frame}{Here is text}
\begin{itemize}[<+->]
\item A first item
\item Another item, also inside the brace
\item Outside the brace
\item \parbox{1cm}{\hfill\tikzmarkflex{A}} Inside the left brace
\item \parbox{1cm}{\hfill} Inside the brace
\item \parbox{1cm}{\hfill\tikzmarkflex{B}} Inside the left brace
\end{itemize}
\begin{tikzpicture}[overlay, remember picture, shift={(current page.south west)}]
\draw[decorate,decoration={brace,amplitude=5pt},line width = 1pt] (B.south west) -- (A.north west)
node [midway,xshift=-0.7cm,align=right] {C};
\end{tikzpicture}%
\end{frame}
\end{document}
由于它与覆盖一起工作,因此需要双重编译。