目前,我正在使用此代码
\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}
我怎样才能使子图标题位于每个子图的左上角而不是子图下方?
答案1
像这样?
关于主题:
- 只是放在
\caption{...}
之前includegraphics
- 加上
\captionsetup[subfigure]{...}
singlelinecheck=false
无关:
- 您的代码中缺少
\begin{document}
,end{document}
并且包graphicx
- 不要使用
figure
选项[H]
,它可能会导致不愉快的文档格式。该选项[ht]
应该足够了 - 不要强制图像的宽度大于
subfigure
环境的宽度(图像会重叠)
\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}