TransWikia.com

How to put the caption of a subfigure in table style (or array style)

TeX - LaTeX Asked by user137927 on February 26, 2021

I have the following code to put some figures alongside.

begin{figure*}[!htb]{
 subfigure[test]{label{fig:test}includegraphics[scale=0.3]{test.pdf}}
 end{figure*}

This code works correctly. I want to have a table in the subcaption of the subfigure, but putting array or tabular does not work. I’ve tried the following code:

begin{figure*}[!htb]{
 subfigure[
  $begin{array}{cc}
  a & b \
  c & d
  end{array}$
  ]
  {label{fig:test}includegraphics[scale=0.3]{test.pdf}}
 }
 end{figure*}

Do you have any suggestions? I have multiple subfigures, so using subfigure is necessary.

One Answer

In order to get the desired output, switch from the deprecated subfigure package to either subcaption (as shown in the following example) or subfig and remove the extra {:

enter image description here

documentclass[twocolumn]{article}
usepackage{subcaption}
usepackage{graphicx}
begin{document}

begin{figure*}[!htb]
 subfloat[
  $begin{array}{cc}
  a & b \
  c & d
  end{array}$
  ]
  {label{fig:test}includegraphics[scale=0.3]{example-image}}
 end{figure*}
 
 end{document}

Correct answer by leandriis on February 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP