Latex:数学之外的可拉伸花括号 [英] Latex: stretchable curly braces outside math
问题描述
我正在制作一些乳胶投影仪幻灯片(但我认为这本身不是投影仪特定的问题).
I am producing some latex beamer slides (but I think it is not a beamer specific question per se).
我有以下几点:
egin{itemize}
item Issue1
item Issue2
item Issue3
end{itemize}
现在,我想在散布在 issue1 和 issue2 上的项目后面有一个右花括号(即}").当然,我想在花括号后面写点什么.
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:
egin{itemize}
left .
item Issue1
item Issue2
ight } One and Two are cool
item Issue3
end{itemize}
这不起作用,因为我不在数学环境中,我不能将整个代码段放入数学环境中,因为在这种情况下 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.
是否有干净的解决方案或 hack 来产生我想要的结果?
Is there a clean solution or a hack to produce my desired result?
问候,巴斯蒂安.
推荐答案
我会使用 tikz
并进行叠加.
I'd use tikz
and make an overlay.
首先包含正确的包(您可能不需要包含 tikz
,因为这是一个投影问题):
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:
egin{itemize}
item Issue 1
ikz[remember picture]
ode[coordinate,yshift=0.5em] (n1) {};
item Issue 2
ikz[remember picture]
ode[coordinate] (n2) {};
item Issue 3
end{itemize}
(注意:我将 y
值向上移动了 1/2 行,也许更多会更好.)
(Note: I shifted the y
value up by 1/2 of a line maybe more would be better.)
因为我们使用了remember picture
,所以我们可以在一个叠加层中引用这些地方:
Because we used remember picture
we can refer to these places in an overlay:
egin{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 的回答.
The path is there to deal with items that do not have the same width. This edit comes from ESultanik's answer.
结果是:
旁注:您可以删除所有 remember picture
选项并添加以下内容以自动将记住添加到所有图片:
Side note: You can remove all of the remember picture
options and add the following to automatically add remember to all pictures:
ikzstyle{every picture}+=[remember picture]
这篇关于Latex:数学之外的可拉伸花括号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!