在標題上方的圖像下方插入文本

在標題上方的圖像下方插入文本

如何將文字放置在圖像的正下方(標題上方)subfig?這是我的程式碼:

\documentclass{article}

\usepackage{hyperref}
\usepackage{graphicx} 
\usepackage{subfig} 

\begin{document}

\captionsetup[subfigure]{labelfont=bf,textfont=normalfont,singlelinecheck=off,justification=raggedright}
\captionsetup[figure]{singlelinecheck=off}

\begin{figure}
\subfloat[\textit{\textit{D. pulex}}
\newline \tiny \url{commons.wikimedia.org/wiki/File:Daphnia_pulex.png}
\newline \tiny Photos by Paul Hebert]{\label{dpulex}
\includegraphics[width=0.48\textwidth]{dpulex.png}
}
\end{figure}

\end{document}

這是它打印的內容:

在此輸入影像描述

所以我希望寫入的這兩行tiny出現在圖像下方和“(a) D. pulex”上方。任何幫助將不勝感激。

答案1

只需將其包含在圖像下方,而不是標題上方:

在此輸入影像描述

\documentclass{article}

\usepackage{graphicx,subfig}% http://ctan.org/pkg/{graphicx,subfig}
\usepackage{hyperref}% http://ctan.org/pkg/hyperref
\captionsetup[subfigure]{labelfont=bf,textfont=normalfont,singlelinecheck=off,justification=raggedright}
\captionsetup[figure]{singlelinecheck=off}

\begin{document}

\begin{figure}
  \subfloat[\textit{D.\ pulex}\label{dpulex}]{%
    \centering\parbox{0.48\linewidth}{%
      \includegraphics[width=\linewidth]{example-image-a} \\
      {\tiny \url{commons.wikimedia.org/wiki/File:Daphnia_pulex.png} \\
      Photos by Paul Hebert}%
    }
  }
\end{figure}

\end{document}

可以更改 URL 和製作人員名單之間的跳躍以滿足您的需求。例如,使用\\[-.5\baselineskip]代替\\,例如):

在此輸入影像描述

\parbox純粹使用了一個左對齊的塊。但是,您可以根據自己的喜好修改它。基本思想保持不變。

也,hyperref在這種情況下實際上應該最後加載。看哪些套件應該在 hyperref 之後而不是之前加載?

答案2

如果您願意使用該subcaption包而不是該subfigure包(我相信它已被棄用),您可以使用類似以下方法:

\documentclass{article}
\usepackage[demo]{graphicx} % omit [demo] in real version
\usepackage{subcaption} 
\captionsetup[subfigure]{labelfont=bf, 
   singlelinecheck=off,
   justification=raggedright}
\captionsetup[figure]{singlelinecheck=off}
\usepackage{hyperref}
\begin{document}
\begin{figure}

\begin{subfigure}{0.48\textwidth}
\includegraphics[width=\linewidth]{dpulex.png}

\tiny Photos by Paul Hebert

\url{commons.wikimedia.org/wiki/File:Daphnia_pulex.png}

\caption{\textit{D. pulex}}\label{dpulex}
\end{subfigure}
\end{figure}
\end{document}

在此輸入影像描述

相關內容