[Tex/LaTex] Minipage, multiline caption centering

captionsminipage

No matter what I do, I can't seem to center the bottom line of these minipage captions. Along with the several variations in the code below, I have also tried \usepackage[justification=centering]{caption}. Advice?

enter image description here

\begin{figure}[H]
  \centering
  \minipage{0.14\textwidth}
    \includegraphics[width = \linewidth]{five3}
    \caption*{\scriptsize ($d.d.d.d, c.d.c.d, \newline
                            b.d.d.b.d.d, \newline
                            a.d.a.d.c.b.c.d$) \newline
                            $c=a+b$ \newline
                            $d=c+b$}
  \endminipage\hfill

  \minipage{0.14\textwidth}
    \centering
    \includegraphics[width=\linewidth]{four3}
    \caption*{\scriptsize ($d.d.d.d, \newline 
                            d.c.c.c, \newline  
                            b.c.b.c.b.d.d, \newline 
                            a.d.a.d.b.c.b.c.d$) \newline 
                            $c=a+b$ \newline 
                            $d=c+b$ \centering}
  \endminipage\hfill
\endminipage
\end{figure}

Best Answer

The combination of \centering and \newline does not give the desired output, as one can see from this simple document:

\documentclass{article}

\begin{document}
\noindent\parbox{\textwidth}{\centering
First line\newline Second line}
\par\bigskip
\noindent\parbox{\textwidth}{\centering
First line\\ Second line}
\end{document}

enter image description here

So don't use \newline inside your caption but \\ instead:


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

\begin{document}
\begin{figure}[H]
\centering
\captionsetup{justification=centering,font=scriptsize}
\minipage{0.14\textwidth}
\includegraphics[width = \linewidth]{five3}
\caption*{($d.d.d.d, c.d.c.d,$ \\  $b.d.d.b.d.d,$ \\ $a.d.a.d.c.b.c.d$) \\ $c=a+b$ \\ $d=c+b$}
\endminipage\hfill

\minipage{0.14\textwidth} \centering
\includegraphics[width=\linewidth]{four3}
\caption*{($d.d.d.d,$ \\ $d.c.c.c,$ \\  $b.c.b.c.b.d.d,$ \\ $a.d.a.d.b.c.b.c.d$) \\ $c=a+b$ \\ $d=c+b$}
\endminipage\hfill
\end{figure}
\end{document}

enter image description here