2

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}
4
  • There's a \begin{document} missing
    – user31729
    Commented Aug 20, 2017 at 20:57
  • @ChristianHupfer Thanks for pointing that out.
    – nainometer
    Commented Aug 20, 2017 at 21:24
  • ... and now put that \begin{document} after \usepackage{smartdiagram} ;-)
    – user31729
    Commented Aug 20, 2017 at 21:26
  • @ChristianHupfer Argh.. Me tex noob. LOL :) Thanks man.
    – nainometer
    Commented Aug 20, 2017 at 21:31

1 Answer 1

2

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.

1
  • great--was looking for this ``````\begin{center} \captionof{figure}{Cycle of Interaction} \smartdiagram[bubble diagram]{Cycle of Environment, Look, Plan, Act} \end{center}`````````````````````````````````
    – js bibra
    Commented Nov 5, 2019 at 15:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .