I am trying to insert a matrix inside of the caption of an image.
The compiled pdf displays the picture, but gives an error that says:
\caption@{indecipherable} has an extra }
Can someone please point to me where I might have inserted an extra }
? Because I don't see it anywhere!
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{thmtools}
\usepackage{graphicx}
\setlength\parindent{0pt}
\usepackage[linesnumbered,ruled]{algorithm2e}
\usepackage{hyperref}
\usepackage{caption}
\usepackage{cleveref}
\begin{document}
\section{Introduction}
\begin{figure}[ht]
\begin{center}
\includegraphics{jpg-to-pdf.pdf}
\end{center}
\caption{$x^\star =\begin{bmatrix} \alpha, \beta, \gamma \end{bmatrix}$}
\label{fig:just_picture_of_cute_cat}
\end{figure}
\end{document}
Does anyone also know what ydblarg is?
\protect\begin{bmatrix}....\protect\end{bmatrix}
, and remove the\begin{center}...\end{center}
there, it does nothing good there\begin{matrix}
is a fragile command, i.e. it breaks during the write process to the.aux
/.lof
, so this breaking is prevented with\protect
\matrix
a fragile command? I thought that fragile commands were usually commands like\footnote
or\figure
, where the arguments might need to be saved and typeset later or in a different place. Though…now that I think about it,\lstinline
is fragile and doesn't fit this pattern, either; extra kudos if you know that one, too. :-)