1

I would like to use subfigure package, since it allows to define the subfigure environment size in terms of columnwidth, etc. However, I need to follow some formatting as:

  • Figure title on top and align to left (Figure 1 - ...);
  • Subcaptions below subfigures and
  • Figure description on bottom and align to left.

How is it possible? Thanks in advance

Updated: I've got almost what I need. Only references to subfigure are not right yet.

\documentclass{article}
\usepackage{mwe}

\newcounter{subfig}[figure]
\renewcommand{\thesubfig}{\alph{subfig}}

\newcommand{\subcaption}[1]% #1 = caption text
{\par\stepcounter{subfig}%
\makebox[\textwidth]{\textbf{(\thesubfig)} #1}%
\medskip\par}

\newenvironment{subfigure}[1]% width
{\begin{minipage}{#1}\let\caption=\subcaption}%
{\end{minipage}}
\usepackage[justification=justified,singlelinecheck=false,labelsep=endash,position=top]{caption}

\begin{document}
\begin{figure}[t]
\caption{Test 1}
\begin{subfigure}{0.45\columnwidth}
\centering\includegraphics[width=\textwidth]{example-image-a}%
\label{fig:test11}
\caption{}
\end{subfigure}\hfill
\begin{subfigure}{0.45\columnwidth}
\centering\includegraphics[width=\textwidth]{example-image-b}%
\label{fig:test12}
\caption{}
\end{subfigure}
\label{fig:test1}\\
{\footnotesize Source: Here comes the figures description.}
\end{figure}

\begin{figure}[!h]
\caption{Test 2}
\begin{center}
\centering\includegraphics[width=0.6\columnwidth]{example-image-c}
\end{center}
\label{fig:test2}
{\footnotesize Source: Here comes the figures description.}
\end{figure}

Figures \ref{fig:test1} is composed of \ref{fig:test11} e \ref{fig:test12}.

Figure \ref{fig:test2} is an ordinary include entry.
\end{document}

Here the output:
result

  • What's the difference between a figure "description" and a figure "caption"? Will the subcaptions have text, or just numbers? You shouldn't use the obsolete subfgure package. Use subcaption instead. What \documentclass are you using? Are there any restrictions with using subcaption (perhaps because this is for a journal submission)? – Werner Feb 26 '16 at 1:56
  • I attached a link with a example to make clear the difference I meant. I don't intend to use text in subcaption, just (a), (b), and so on... The \documentclass is a custom one of my university and this document is my thesis. I don't think there is a restriction about using subcaption. Could you provide an example, please? example – viniciuslb Feb 26 '16 at 2:14
  • 1
    No link, no example... – Werner Feb 26 '16 at 3:23
  • 1
    See also tex.stackexchange.com/questions/287919/… – John Kormylo Feb 26 '16 at 3:54
  • 1
    I don't know about comments, but you can edit your question: insert code and images. (CNTL V to paste) – John Kormylo Feb 26 '16 at 16:36
3

See, if this modification of your MWE do what you like to have:

\documentclass{article}
\usepackage{mwe}
\usepackage[justification=justified,
            singlelinecheck=false,
            labelsep=endash,
            position=top]{caption}
\usepackage[justification=centering]{subcaption}

\begin{document}
    \begin{figure}[t]
\caption{Test 1}
\label{fig:test1}
    \begin{subfigure}{0.45\columnwidth}
    \centering
\includegraphics[width=\linewidth]{example-image-a}%
\caption{}
    \label{fig:test11}
    \end{subfigure}
\hfill
    \begin{subfigure}{0.45\columnwidth}
    \centering
\includegraphics[width=\linewidth]{example-image-b}%
    \caption{}
\label{fig:test12}
    \end{subfigure}

{\footnotesize Source: Here comes the figures description.}
\end{figure}

\begin{figure}[!h]
    \centering
\caption{Test 2}
\label{fig:test2}
\includegraphics[width=0.6\columnwidth]{example-image-c}

\begin{minipage}{\linewidth}\footnotesize 
Source: Here comes the figures description.
\end{minipage}
\end{figure}

Figures \ref{fig:test1} is composed of \ref{fig:test11} e \ref{fig:test12}. 
Figure \ref{fig:test2} is an ordinary include entry.
\end{document}

In above MWE I remove your definitions of subfigure counter and environment and instead them use package subcaption. Beside this I put labels after captions where they should be (for correct referencing)

enter image description here

  • Perfect, @Zarko! I already knew about the \label after \caption. I just forgotten here. – viniciuslb Feb 26 '16 at 22:21

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.