[Tex/LaTex] How to caption a smartdiagram figure

captionssmartdiagram

I am using smartdiagram to make a figure in my document. I want to know how can I caption this figure. I am pasting sample code below.

\documentclass{article}
\usepackage{smartdiagram}
\begin{document}
\begin{center}
\caption{Cycle of Interaction}
\smartdiagram[bubble diagram]{Cycle of Environment,
      Look, Plan, Act}
\end{center}
\end{document}

Best Answer

The \smartdiagram macro does not work as a float environment etc. so caption is useless here, but since a diagram works as a figure basically, \captionof{figure}{Cycle of Interaction} should be sufficient.

\documentclass{article}
\usepackage{smartdiagram}
\usepackage{caption}

\begin{document}
\begin{center}
\captionof{figure}{Cycle of Interaction}
\smartdiagram[bubble diagram]{Cycle of Environment,
      Look, Plan, Act}
\end{center}
\end{document}

If figure isn't the correct name, there are basically two ways to improve this:

  1. Use \captionsetup to provide another name=Diagram, for example

    \documentclass{article}
    \usepackage{smartdiagram}
    \usepackage{caption}
    
    
    
    \begin{document}
    \begin{center}
    \captionsetup[figure]{name=Diagram}
    \captionof{figure}{Cycle of Interaction}
    \smartdiagram[bubble diagram]{Cycle of Environment,
      Look, Plan, Act}
    \end{center}
    
    \end{document}
    
  2. Define a new floating environment, say, diag:

    \documentclass{article}
    
    
    \usepackage{smartdiagram}
    \usepackage{newfloat}
    \usepackage{caption}
    
    
    \DeclareFloatingEnvironment[fileext=diag,placement={!ht},name=Diagram]{diag}
    
    \begin{document}
    \begin{center}
    \captionof{diag}{Cycle of Interaction}
    \smartdiagram[bubble diagram]{Cycle of Environment,
      Look, Plan, Act}
    \end{center}
    \end{document}
    

enter image description here

I prefer the 2nd way with an extra floating environment, but that is a matter of taste.