Howto-Latex语法与\section[]{}:将括号[放在括号内]

Howto-Latex语法与\section[]{}:将括号[放在括号内],latex,beamer,latex-environment,Latex,Beamer,Latex Environment,我正在写一篇beamer演示文稿。我的问题是\section[Outline]{title}\section的语法问题在我的所有章节标题中都可以正常工作,以下示例除外: \section[$\mathbb{Z}[G]$-module constructions]{$\mathbb{Z}[G]$-modules and Geometric Constructions} 我需要一个[或\[符号,在\section的大纲部分的G(即[G])周围,但是,只要有类似于括号的东西在里面,Tex就会抛出大量

我正在写一篇beamer演示文稿。我的问题是
\section[Outline]{title}
\section
的语法问题在我的所有章节标题中都可以正常工作,以下示例除外:

\section[$\mathbb{Z}[G]$-module constructions]{$\mathbb{Z}[G]$-modules and Geometric Constructions}
我需要一个
[
\[
符号,在
\section
的大纲部分的G(即[G])周围,但是,只要有类似于括号的东西在里面,Tex就会抛出大量错误


欢迎提出所有想法,并提前表示感谢。

Michael Anderson在评论中指出了一种更简洁的方法来实现这一点。请在序言中定义如下命令:

\newcommand[1]{\bracket}{[#1]}
并使用语法
$\bracket{G}$
将括号放在
G
周围


问题是因为LaTeX将
[G]
中的
]
解释为命令的
[Outline]
部分的结束括号。这里有一个解决方法。在序言中,添加以下内容:

\newcommand{\rbracket}{]}
现在将
部分定义为

\section[$\mathbb{Z}[G\rbracket $-module constructions]{$\mathbb{Z}[G]$-modules and Geometric Constructions}
这就是大纲的样子


迈克尔·安德森给出了一个很好的解决方案,但当我尝试时,却出现了错误。然后我写了以下内容:

\newcommand{\bracket}[1]{[#1]}
这就成功地将括号中的括号括起来:

\bracket{content}

要获取[内容]。

通过将短标题包装在另一层
{…}
中,您可以对latex“隐藏”有问题的内容:

\documentclass{beamer}



\begin{document}
\begin{frame}
\tableofcontents
\end{frame}

\section[{$\mathbb{Z}[G]$-module constructions}]{$\mathbb{Z}[G]$-modules and Geometric Constructions}


\begin{frame}
content...
\end{frame}

\end{document}

我可能会使用
\newcommand[1]{\bracket}{[#1]}
这样你就可以使用看起来更干净的
$\mathbb{Z}\bracket{G}$-module…
@Michael:谢谢,这更干净了。我已经编辑了答案来添加它。可选参数的括号呢?优雅的解决方案!