5

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}
2

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

2

You need neither figure nor \caption*.

\documentclass{article}
\usepackage[demo]{graphicx} % demo is just for the example
\usepackage{lipsum}

\begin{document}
\lipsum[1]

\begin{center}
\includegraphics[width = .14\columnwidth]{five3}\\[\abovecaptionskip]
\scriptsize
($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$
\end{center}

\lipsum[2]

\end{document}

enter image description here

2

Why not just place the content of the \caption in a tabular (or array, depending on your preference)?

enter image description here

\documentclass{article}
\usepackage{caption,graphicx}% http://ctan.org/pkg/{caption,graphicx}
\begin{document}

\begin{figure}[ht]
  \centering
  \minipage{.5\linewidth}
    \centering
    \includegraphics[width = 100pt]{example-image-a}
    \caption*{\scriptsize $\array{c}(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
      \endarray$}
  \endminipage
\end{figure}

\end{document}
  • Perhaps also \array{@{}c@{}}...? – Gonzalo Medina Aug 28 '13 at 23:37

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.