
是否可以在節標題中放置矩陣?
這是我目前的嘗試:
\section{Analyze the invertible $M= \left[ \begin{array}{rr}2 & 6 \\
2 & 4 \end{array} \right]$ matrix by doing the following:}
我希望它讀作:
由於我是新人,任何幫助都會受到讚賞。
答案1
您可以使用 alrbox
建立一個包含數學內容的框,然後在 的參數中使用它\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}