1

I need to do multiple lines in the caption of the figure

the figure looks like this now

enter image description here

but I want the caption to have

Multi-Label Classification Techniques.
A: Binary Relevance (BR).
B: Classifier Chain (CC).
C: Label Power (LP).
D: Hierarchal Labels.

I found this answer but when I applied it, it did not work for me, still shows the caption in 1 line

How to write multiple line caption with figure

Here is my script

\documentclass[journal]{IEEEtran}
\usepackage{graphicx}

\begin{document}

\begin{figure*}
    \centering
    \includegraphics[width=1 \textwidth]{MLC.pdf}
    \caption{Multi-Label Classification Techniques.\\A: Binary Relevance (BR).\\B: Classifier Chain (CC).\\C: Label Power (LP).\\D: Hierarchal Labels.}
    \label{graph_MLC}
\end{figure*}

\end{document}

i am using TexStudio

2
  • If I insert your code fragment in a small document sample, I get caption with multiline caption text, as you like to have. So, please extend your code fragment to complete small document, which reproduce your problem.
    – Zarko
    Dec 3, 2022 at 1:10
  • @Zarko I updated the script in my question to show all document script, and still not multiple lines
    – asmgx
    Dec 3, 2022 at 4:10

2 Answers 2

1

The figure caption (specifically) is set in a box to measure its width. Boxes don't accept linebreaks. So, set it in a tabular to get the alignment you want and optionally pass a reduced caption to the LoF.

enter image description here

\documentclass[journal]{IEEEtran}

\usepackage{graphicx}

\begin{document}

\begin{figure*}
  \centering
  \includegraphics[width=\textwidth]{example-image}
  \caption[Multi-Label Classification Techniques.]
    {\begin{tabular}[t]{ @{} l @{} }
      Multi-Label Classification Techniques.\\
      A: Binary Relevance (BR).\\
      B: Classifier Chain (CC).\\
      C: Label Power (LP).\\
      D: Hierarchal Labels.
     \end{tabular}}
\end{figure*}

\end{document}
0
  • Default settings in IEEEtran documentclass doesn't allow to have caption formatting as you wishd.
  • If you attend to use this document od some their publications, changing their desired article layout is not way to go. You should to complain their rules and not to change caption style.
  • If for some reason you still persist to change caption styles, you can add caption package and set up own style, for example
\documentclass[journal]{IEEEtran}
\usepackage{graphicx}
\usepackage[skip=1ex, 
            labelfont=bf]{caption}

\begin{document}
\begin{figure*}
\captionsetup{format=hang}
    \centering
    \includegraphics[width=\textwidth]{example-image}%{MLC.pdf}
    \caption{Multi-Label Classification Techniques.\\
             A: Binary Relevance (BR).\\
             B: Classifier Chain (CC).\\
             C: Label Power (LP).\\
             D: Hierarchal Labels.}
    \label{graph_AutoML}
\end{figure*}
\end{document}

but be aware that this will change caption styles for table too.

  • I will not do this.

enter image description here

You must log in to answer this question.

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