是否可以将矩阵放在章节标题中?
这是我目前的尝试:
\section{Analyze the invertible $M= \left[ \begin{array}{rr}2 & 6 \\
2 & 4 \end{array} \right]$ matrix by doing the following:}
我希望它读起来:
由于我是新手,因此任何帮助我都非常感谢。
答案1
您可以使用lrbox
创建一个包含数学内容的框,然后在 的参数中使用它\section
。
首先,添加
\newsavebox{\mybox}
在序言中。然后将数学知识嵌入到lrbox
\begin{lrbox}{\mybox}
$M= \left[ \begin{array}{rr}2 & 6 \\
2 & 4 \end{array} \right]$
\end{lrbox}
最后打印出框内的\section
:
\section{Analyze the invertible \usebox{\mybox} matrix by doing the following:}
梅威瑟:
\documentclass{article}
\newsavebox{\mybox}
\begin{document}
\begin{lrbox}{\mybox}
$M= \left[ \begin{array}{rr}2 & 6 \\
2 & 4 \end{array} \right]$
\end{lrbox}
\section{Analyze the invertible \usebox{\mybox} matrix by doing the following:}
\end{document}
这不会干扰,但如果要打印的话,\tableofcontents
请考虑使用可选参数在目录中打印一些不同的东西。\section
答案2
有很多\protect
s 代表toc
;-)
\documentclass{article}
\usepackage{mathtools}
\usepackage{array}
\begin{document}
\tableofcontents
% Protection for the math stuff written to toc
\section[{$M= \protect\left[\protect\begin{array}{rr} 2 & 6 \\ 2 & 4 \protect\end{array}\protect\right]$}]{Analyze the invertible matrix \protect{$M= \left[ \begin{array}{rr}
2 & 6 \\
2 & 4
\end{array} \right]$}
by doing the following:}
% protection for both heading and toc
\section{Analyse the matrix {$M= \protect\left[\protect\begin{array}{rr} 2 & 6 \\ 2 & 4 \protect\end{array}\protect\right]$}
by doing the following:}
\end{document}
答案3
此外,使用环境“smallmatrix”在章节标题中可能看起来更好。
\documentclass[11pt,a4paper]{article}
\usepackage{amsmath}
\newsavebox{\mybox}
\begin{document}
\begin{lrbox}{\mybox}
$M=\small[\begin{smallmatrix}a&b\\c&d\end{smallmatrix}\small]$
\end{lrbox}
\tableofcontents
\section{Analyze the invertible {\usebox{\mybox}} by doing the following}
\end{document}