Captions are set up like Figure 1. Caption, I need it to be Figure 1. <text> Caption, with the same text to all figures, and I need it to be part of the caption, not figure name **.

I tried with what I know and did

\renewcommand{\caption}[1]{ \caption{<text> #1} }

And that didn't work because all the captions in my text are written as \caption[shortcaption]{caption}. Found this question which was really insightful, but I couldn't make it work with changes I thought of doing.

Clearly, I need to define caption correctly by including \shortcaption in the redefinition but I don't know how to do that.

How do I prepend text to caption as explained above? Thanks!

** This is a workaround I found for another problem. In book class, using a template I didn't write and can't change for my thesis, captions are not justified even with the correct package settings. But they do justify if before writing the caption I add the code \vspace{0pt}\justifying\noindent. So, I want to prepend that to my caption command and avoid writing it every time.

  • 1
    Your redefinition creates a circular referencing of \caption which will trigger an infinite loop. Using \Caption instead, newly defined as \newcommand{\Caption}[1]{ \caption{<text> #1} } could be a way out. – Partha D. Feb 19 '19 at 3:34

The easy solution is to use the caption package.

\DeclareCaptionFormat{silly}{#1#2<text> #3}
\usepackage{blindtext}% MWE only

\caption[short caption]{\blindtext}


|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.