I am trying to add captions for figures inside a table but am unable to do so. I have looked into this solution but having flexible X
columns is not working as described.
The current output looks something like this.
The offending code.
\documentclass[margin=2in]{article}
\usepackage{tabularray}
\usepackage{graphicx}
\usepackage{caption}
\begin{document}
\begin{figure}[h]
\begin{tblr}{X[2,r] X[-1,r]}
\includegraphics[width=2in]{example-image-a}
\captionof{figure}{Figure A}
&
\includegraphics[width=2in]{example-image-b}
\end{tblr}
\end{figure}
\end{document}
Error output:
You can't use `\hrule' here except with leaders. \end
Missing number, treated as zero. \end
Illegal unit of measure (pt inserted). \end
Missing \endgroup inserted. \end
Missing } inserted. \end
Use of \??? doesn't match its definition. \end
Extra \endgroup. \end
Too many }'s. \end
I have also tried with caption
and caption*
in place of captionof
. Any help is appretiated.