Matriz en el encabezado de la sección

Matriz en el encabezado de la sección

¿Es posible colocar una matriz en un encabezado de sección?

Este es mi intento actual:

\section{Analyze the invertible $M= \left[ \begin{array}{rr}2 & 6 \\
2 & 4 \end{array} \right]$ matrix by doing the following:}

Quiero que se lea: ingrese la descripción de la imagen aquí

Se agradece cualquier ayuda ya que soy nuevo.

Respuesta1

Puedes usar a lrboxpara crear un cuadro que contenga elementos matemáticos y luego usarlo en el argumento de \section.

En primer lugar, agregue

\newsavebox{\mybox}

en el preámbulo. Luego incruste las cosas matemáticas en ellrbox

\begin{lrbox}{\mybox}
$M= \left[ \begin{array}{rr}2 & 6 \\
2 & 4 \end{array} \right]$
\end{lrbox}

y finalmente imprima el cuadro dentro de \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} 

ingrese la descripción de la imagen aquí

Esto no molesta, \tableofcontentspero considere usar el argumento opcional de \sectionpara imprimir algo diferente en el ToC, si lo está imprimiendo.

Respuesta2

Con muchas \protects para el 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}

ingrese la descripción de la imagen aquí

Respuesta3

Además, usar el entorno "smallmatrix" puede verse mejor en el título de una sección.

Salida de muestra

\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}

información relacionada