乳胶:数学以外的可拉伸花括号 [英] Latex: stretchable curly braces outside math
问题描述
我正在制作一些乳胶投影仪幻灯片(但我认为这本身不是投影仪特定的问题).
我有以下内容:
\begin{itemize}
\item Issue1
\item Issue2
\item Issue3
\end{itemize}
现在,我要在第1个和第2个问题上展开的项目后面留一个合适的花括号(即'}').当然,我想在花括号后面写点东西.
在一个完美的世界里,我会写一些类似的东西:
\begin{itemize}
\left .
\item Issue1
\item Issue2
\right \} One and Two are cool
\item Issue3
\end{itemize}
这不起作用,因为我不在数学环境中,也无法将整个代码片段放入数学环境中,因为在这种情况下逐项操作不起作用.
是否有一个干净的解决方案或黑客可以产生我想要的结果?
关于, 巴斯蒂安.
我将使用tikz
并进行覆盖.
首先包含适当的软件包(您可能不需要包含tikz
,因为这是一个比较容易的问题):
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
然后,当您创建列表时,请在每个项目后面的位置命名:
\begin{itemize}
\item Issue 1
\tikz[remember picture] \node[coordinate,yshift=0.5em] (n1) {};
\item Issue 2
\tikz[remember picture] \node[coordinate] (n2) {};
\item Issue 3
\end{itemize}
(注意:我将y
值上移了1/2行可能会更好.)
由于我们使用了remember picture
,因此可以在叠加层中引用这些位置:
\begin{tikzpicture}[overlay,remember picture]
\path (n2) -| node[coordinate] (n3) {} (n1);
\draw[thick,decorate,decoration={brace,amplitude=3pt}]
(n1) -- (n3) node[midway, right=4pt] {One and two are cool};
\end{tikzpicture}
路径用于处理宽度不同的项目.此编辑来自 ESultanik的答案. /p>
结果是:
旁注:您可以删除所有remember picture
选项,并添加以下内容以自动为所有图片添加记忆:
\tikzstyle{every picture}+=[remember picture]
I am producing some latex beamer slides (but I think it is not a beamer specific question per se).
I have the following:
\begin{itemize}
\item Issue1
\item Issue2
\item Issue3
\end{itemize}
Now, I want to have a right curly brace (i.e. '}') behind the items spreading over issue1 and issue2. And of course I want to write something behind that curly brace.
In a perfect world I would write something like:
\begin{itemize}
\left .
\item Issue1
\item Issue2
\right \} One and Two are cool
\item Issue3
\end{itemize}
This does not work because I am not in a math environment and I can not put the whole snippet inside a math environment because itemize would not work in that case.
Is there a clean solution or a hack to produce my desired result?
Regards, Bastian.
I'd use tikz
and make an overlay.
First include the proper packages (you may not need to include tikz
since this is a beamer question):
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
Then when you make your list, give names to the places after each item:
\begin{itemize}
\item Issue 1
\tikz[remember picture] \node[coordinate,yshift=0.5em] (n1) {};
\item Issue 2
\tikz[remember picture] \node[coordinate] (n2) {};
\item Issue 3
\end{itemize}
(Note: I shifted the y
value up by 1/2 of a line maybe more would be better.)
Because we used remember picture
we can refer to these places in an overlay:
\begin{tikzpicture}[overlay,remember picture]
\path (n2) -| node[coordinate] (n3) {} (n1);
\draw[thick,decorate,decoration={brace,amplitude=3pt}]
(n1) -- (n3) node[midway, right=4pt] {One and two are cool};
\end{tikzpicture}
The path is there to deal with items that do not have the same width. This edit comes from ESultanik's answer.
The result is:
Side note: You can remove all of the remember picture
options and add the following to automatically add remember to all pictures:
\tikzstyle{every picture}+=[remember picture]
这篇关于乳胶:数学以外的可拉伸花括号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!