[Tex/LaTex] How to indent text within captionof

captionsindentation

Does someone know how to indent the text within captionof? I have a long caption that I want to make two paragraphs out of but indent does not seem to work.

\documentclass{article}

\usepackage{caption}
\usepackage[demo]{graphicx}

% make demo figure
\makeatletter
  \AtBeginDocument{%
    \def\Ginclude@graphics#1{%
      \begingroup\fboxsep=-\fboxrule
      \fbox{\rule{\@ifundefined{Gin@@ewidth}{150pt}{\Gin@@ewidth}}{0pt}%
        \rule{0pt}{\@ifundefined{Gin@@eheight}{100pt}{\Gin@@eheight}}}\endgroup}}
\makeatother

\begin{document}

\noindent
\begin{minipage}[c]{\linewidth}
\centering
\includegraphics{}
\captionof{figure}{\textbf{Title} \newline
\indent Paragraph 1 is found here with a lot of text lot of text lot of text lot of text lot of text lot of text \newline
\indent Paragraph 2 is found here with a lot of text lot of text lot of text lot of text lot of text lot of text}
\label{fig:angio}
\end{minipage}

\end{document}

enter image description here

Best Answer

This is because of two things. First of all, the minipage nullifies the value of \parindent. Secondly, captions are also typically set in a way that avoid indentation. You can save the current \parindent and force your alignment manually:

enter image description here

\documentclass{article}

\usepackage{caption}
\usepackage{graphicx}

\newlength{\savedparindent}
% Save \parindent
\AtBeginDocument{\setlength{\savedparindent}{\parindent}}

\begin{document}

\noindent
\begin{minipage}{\linewidth}
  \centering
  \includegraphics[width=.5\linewidth]{example-image}
  \captionof{figure}[Title]{\textbf{Title} \newline
  \hspace*{\savedparindent}Paragraph 1 is found here with a lot of text lot of text lot of text lot of text lot of text lot of text \newline
  \hspace*{\savedparindent}Paragraph 2 is found here with a lot of text lot of text lot of text lot of text lot of text lot of text}
\end{minipage}

\end{document}

You can use the functionality of caption to store this yourself using the option [parindent=\parindent]. However, this requires you to specify each paragraph as a paragraph - leaving a blank line between them:

  \captionof{figure}[Title]{\textbf{Title}

  Paragraph 1 is found here with a lot of text lot of text lot of text lot of text lot of text lot of text

  Paragraph 2 is found here with a lot of text lot of text lot of text lot of text lot of text lot of text}

Note that I've used an optional title Title to avoid complications with content in the LoF.

Related Question