
セクション見出しにマトリックスを配置することは可能ですか?
これが私の現在の試みです:
\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:}
MWE:
\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}
これは を妨げるものではありませんが、印刷する場合は、ToC に別の内容を印刷するため\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}