0

I am trying to have the caption of a figure aligned as it is below:

enter image description here

Description: I included a few rows of text above and below the figure to see the alignment of the caption. It seems to me that the text of the caption is aligned to center while the label Fig. 1.1.1. is somehow floating at the lest of the text.

Here's what I tried:

\begin{figure}
    \centering\captionsetup{format = hang}

    \includegraphics[width=7cm]{assets/basic}
    \caption{Some long caption here}
    \label{fig:my_label}
\end{figure}

The multiple rows in the caption are correctly justified under the first, but the entire caption box is then aligned to the left.

How can I achieve that effect, please?

EDIT

I have created an example document to illustrate my problem:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{graphicx, caption, threeparttable}
\usepackage{floatrow}

\title{FigureCaption}
\author{Victor Barbu}

\begin{document}

\section{Testing Captions}

\begin{figure}[h]
    \centering\captionsetup{format = hang}

    \includegraphics[width=7cm]{pic}
    \caption{The graph on $V = \{1,\ldots,7\}$ with edge set\\ $E = \{(1,2),(1,5),(2,5),(3,4),(5,7)\}$}
    \label{fig:my_label}
\end{figure}


\end{document}

enter image description here

7
  • 1
    The big question is whether \captionsetup{justification=centering} has already been used or is the default for this document class. The label format indicates that some additional \captionsetup has been used. Commented Apr 13, 2019 at 20:12
  • we need to see a complete small document, which show your problem. however, see if \captionsetup{format = hang, width=7cm} gives what you looking for.
    – Zarko
    Commented Apr 13, 2019 at 20:18
  • @JohnKormylo couldn't say. the image is a screenshot of a book
    – Victor
    Commented Apr 13, 2019 at 20:24
  • @Zarko it doesn't seem like what I need. Basically what I need is to have the caption text centered while the label should be ignored from centering calculation, or at least have it all centered as a whole
    – Victor
    Commented Apr 13, 2019 at 20:26
  • So basically you need a \phantom{\fnum@figure} to the right of the text. Tricky! Commented Apr 13, 2019 at 20:31

1 Answer 1

2

as far as i understood your question you looking for something like this:

enter image description here

but i might be wrong :-(

\documentclass{article}
%\usepackage[utf8]{inputenc}
%\usepackage{amsmath}
\usepackage[demo]{graphicx}
%\usepackage{threeparttable}
\usepackage{caption}

%\title{FigureCaption}
%\author{Victor Barbu}

\begin{document}

%\section{Testing Captions}

\begin{figure}[h]
    \centering\captionsetup{format = hang, width=8cm}
    \includegraphics[width=7cm]{pic}
    \caption{The graph on $V = \{1,\ldots,7\}$ with edge set $E = \{(1,2),(1,5),(2,5),(3,4),(5,7)\}$}
    \label{fig:my_label}
\end{figure}
\end{document}
1
  • This is what I want indeed!
    – Victor
    Commented Apr 13, 2019 at 21:30

You must log in to answer this question.

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