2

How can I left align the text in the figure/table caption? This is the text I am using to add an image

\begin{figure}[htbp]
    \centering
        \includegraphics[width=0.90\textwidth]{Figures/EdgeYarnA9}
        \caption[abc]{abc}
    \label{fig:EdgeYarnA9}
\end{figure}
2

If you can get used to specifying figures with commands, rather than environments, boxhandler will solve this, assuming you mean left-align to the figure and not the margin. (It can left align to margin, too, but you don't need boxhandler for just that)

\documentclass{article}
\usepackage{boxhandler}
\begin{document}

By default, boxhandler gives this

\bxfigure[ht]{This is the caption which, by default is idented wrt the
figure identifier}
{\rule{3in}{2in}}

But by changing the caption style with \verb|\captionStyle{n}{l}|, one
gets the following:

\captionStyle{n}{l}

\bxfigure[ht]{This is the caption which, by default is idented wrt the
figure identifier}
{\rule{3in}{2in}}

\end{document}

enter image description here

1

A caveat in using the boxhandler environment is that it doesn't allow for including a sub-caption. For example, I got into the situation of needing a main caption centered above the figure, and another one below it and left-aligned to the picture.

Although it's not the state-of-the-art solution, I managed to find a workaround for it using a minipage environment inside the figure environment:

\begin{figure}[h] \label{fig:caption-example}
    \caption{Example figure}
    \vspace*{6pt}
    \centering  \includegraphics{MyPicture.png} \par
    \begin{minipage}[h]{8cm}
        \footnotesize
        Source: the Author (2018)
    \end{minipage}
\end{figure}

The solution for the proper alignment was finetuning the minipage's width to match the figure's width.

  • You can store the figure width an reuse it in the minipage. See e.g. my answer tex.stackexchange.com/a/422360/2975 – Martin Scharrer Apr 26 '18 at 5:45
  • @MartinScharrer thanks for the tip, it worked just fine! Just had to use a \raggedleft command in the text content of the \adjustbox command argument. – Henrique Baron Apr 27 '18 at 12:26

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.