[Tex/LaTex] How to make the subcaption labeling appear on top left corner

floatslabels

Currently, I am using this code

\documentclass[letterpaper,12pt]{article}
\usepackage[margin=1in]{geometry} % set page parameters appropriately
\usepackage{subcaption}
\captionsetup{font={bf,small},skip=0.25\baselineskip}
\captionsetup[subfigure]{font={bf,small}, skip=1pt}


\begin{figure}[H]
\centering
\begin{subfigure}{0.49\linewidth}
\centering
\includegraphics[width=1.2\linewidth, height=0.17\textheight, keepaspectratio]{H_beffect.png}%, 
\caption{}
\label{fig:halfsaturationeffect}
\end{subfigure}
%\quad
\begin{subfigure}{0.49\linewidth}
\centering
\includegraphics[width=1.2\linewidth, height=0.17\textheight, keepaspectratio]{BIHSItransmission.png}
\caption{The effect of $\beta_b$ on $R_{ah}$}
\label{fig:rateoftransmission}
\end{subfigure}
%\hfill
\caption{Effect of half-saturation constant for birds with avian strain and transmission coefficient on the basic reproduction number.}
\label{fig:effectonR_0}
\end{figure}

How can I make the subfigures caption be located at top left corner of each subfigures instead of below the subfigures?

Best Answer

like this?

enter image description here

on topic:

  • just put \caption{...} before includegraphics
  • to \captionsetup[subfigure]{...} add singlelinecheck=false

off-topic:

  • in your code are missing \begin{document}, end{document} and package graphicx
  • don't use figure option [H], it can cause unpleasant document formatting. the option [ht] should be sufficient
  • don't force images' widths to be larger than widths of subfigure environment (images will overlaps)

\documentclass[letterpaper,12pt]{article}
\usepackage[margin=1in]{geometry} % set page parameters appropriately
\usepackage[demo]{graphicx}
\usepackage{subcaption}
\captionsetup{font={bf,small},skip=0.25\baselineskip}
\captionsetup[subfigure]{font={bf,small}, skip=1pt, singlelinecheck=false}

\begin{document}
\begin{figure}
\centering
\begin{subfigure}{0.49\linewidth}
\caption{}
\label{fig:halfsaturationeffect}
    \includegraphics[width=\linewidth, height=0.17\textheight, keepaspectratio]{H_beffect.png}%,
\end{subfigure}
\hfill
\begin{subfigure}{0.49\linewidth}
\caption{The effect of $\beta_b$ on $R_{ah}$}
\label{fig:rateoftransmission}
    \includegraphics[width=\linewidth, height=0.17\textheight, keepaspectratio]{BIHSItransmission.png}
\end{subfigure}
\caption{Effect of half-saturation constant for birds with avian strain and transmission coefficient on the basic reproduction number.}
\label{fig:effectonR_0}
\end{figure}
\end{document}