1

I am having trouble with a custom made figure caption command. I am having this command:

\newcommand{\figCaption[3]}{\justifying\textbf{\small\caption[#1] #2.}\space{#3}}

and a figure code like this:

\begin{figure}[H]
\centering
\begin{overpic}[width=0.95\linewidth]{picture}
\end{overpic}
\figCaption{rough description} {detailed description}.}
\label{fig:Sec3_mYFP}
\end{figure}

unfortunately, it comes out like this:

enter image description here

My goal is not to cut off the rough description after the first letter, but to have it all in one line. For longer descriptions, they should be in one block with the Figure## and the rough description being bold.

Is there anything I can do?

2
  • 3
    See package caption for better ways to handle caption formatting. Mar 31 '17 at 12:05
  • Have you tried the advice of Heiko? Apr 2 '17 at 17:32
2

Since you didn't post a complete mwe nor an image of the desired output, I don't know if this is exactly what you need.

See the comments in my code. You don't have to add to your document what I marked "only for testing purpose".

\documentclass{article}
\usepackage{mwe}% only for testing purpose
\usepackage{float}
\usepackage{graphicx}
\usepackage[margin=10pt,font=small,labelfont=bf,labelsep=period,format=hang,
indention=0cm]{caption}
\newcommand{\figCaption}[2]{\caption[#1]{\textbf{#1}\newline #2}}
\begin{document}
\listoffigures% if you would like the list of figures, remember to run pdflatex twice
\section{A section}
\blindtext% only for testing purpose
\begin{figure}[H]% H sould be avoided
    \centering
    \includegraphics[width=.95\textwidth]{example-image-a}% it's not clear to me why you used overpic
    \figCaption{Rough description.}{Detailed description. The detailed description is very very very very very very very very very very very very very very very very very very very very very very very very very very very very very long.}\label{fig:Sec3_mYFP}
\end{figure}
\blindtext% only for testing purpose
\end{document}

enter image description here

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.