I want to cite a page within a subfigure. The parsing process breaks because tex assumes the page brackets for the page ref ] are closing the subfloat command. How can I prevent this or how can I correctly cite a page in a subfigure?

  \subfloat[Confusion matrix for multi-class classification. The confusion matrix of a classification with n classes. When considering the class $k$ $(0 \leq k \leq n)$, the four different classification results can be obtained: true positive (green), true negative (orange), false positive (brown), and false negative (red) \citep[p.73]{kruger2016activity}.]{\includegraphics[width=0.4\textwidth]{multiclass-conf-matrix-alt.png}
  \subfloat[Example for a multiclass confusion matrix \citep{baeld:f1}.]
  \caption{Multiclass confusion matrices.}

enter image description here


If you want to use a ] inside an optional argument, you can enclose it in curly braces, e.g.,

\subfloat[Example for a multiclass confusion matrix {\citep[47]{baeld:f1}}.]
  • I didn't know that. Fantastic answer. Thank you. However, the system tells me that I need 3 more minutes to wait until I can accept it. – Smittie Jan 12 at 16:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.