我已经成功做到了这一点:
但我正在尝试这样做:
不同之处在于,标题以图形的缩微格式分组在一起。
代码:
\usepackage{caption}
\usepackage{subcaption}
\usepackage{graphicx}
\graphicspath{ {./figures/} }
\usepackage{float}
\begin{figure}[H]
\begin{subfigure}[t]{0.33\textwidth}
\centering
\includegraphics[width=\linewidth]{figures/Image1BW.png}
\caption{}\label{fig:Image1BW}
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.33\textwidth}
\centering
\includegraphics[width=\linewidth]{figures/Image1BWPhaseMaskOnly.png}
\caption{}\label{fig:Image1BWPhaseMaskOnly}
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.33\textwidth}
\centering
\includegraphics[width=\linewidth]{figures/Image1BWSpatialAndPhaseMask.png}
\caption{}\label{fig:Image1BWSpatialAndPhaseMask}
\end{subfigure}
\begin{subfigure}[t]{0.33\textwidth}
\centering
\includegraphics[width=\linewidth]{figures/Image3Colour.png}
\caption{}\label{fig:Image3Colour}
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.33\textwidth}
\centering
\includegraphics[width=\linewidth]{figures/Image3ColourPhaseMaskOnly.png}
\caption{}\label{fig:Image3ColourPhaseMaskOnly}
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.33\textwidth}
\centering
\includegraphics[width=\linewidth]{figures/Image3ColourPhaseAndSpatialMask.png}
\caption{}\label{fig:Image3ColourPhaseAndSpatialMask}
\end{subfigure}
\caption{Development of code to encrypt image. (\subref{fig:Image1BW}) Image to be encrypted. (\subref{fig:Image1BWPhaseMaskOnly}) Encryption through convolution with phase mask. (\subref{fig:Image1BWSpatialAndPhaseMask}) Encryption through multiplication and convolution with phase mask. (\subref{fig:Image3Colour})(\subref{fig:Image3ColourPhaseMaskOnly})(\subref{fig:Image3ColourPhaseAndSpatialMask}) Results of colour images through the same process.}
\end{figure}
编辑:轻松搞定
\begin{figure}[H]
\begin{subfigure}[t]{0.33\textwidth}
\centering
\includegraphics[width=\linewidth]{figures/Image1BW.png}
\caption{}\label{fig:Image1BW}
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.33\textwidth}
\centering
\includegraphics[width=\linewidth]{figures/Image1BWPhaseMaskOnly.png}
\caption{}\label{fig:Image1BWPhaseMaskOnly}
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.33\textwidth}
\centering
\includegraphics[width=\linewidth]{figures/Image1BWSpatialAndPhaseMask.png}
\caption{}\label{fig:Image1BWSpatialAndPhaseMask}
\end{subfigure}
\begin{subfigure}[t]{0.33\textwidth}
\centering
\includegraphics[width=\linewidth]{figures/Image3Colour.png}
\caption{}\label{fig:Image3Colour}
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.33\textwidth}
\centering
\includegraphics[width=\linewidth]{figures/Image3ColourPhaseMaskOnly.png}
\caption{}\label{fig:Image3ColourPhaseMaskOnly}
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.33\textwidth}
\centering
\includegraphics[width=\linewidth]{figures/Image3ColourPhaseAndSpatialMask.png}
\caption{}\label{fig:Image3ColourPhaseAndSpatialMask}
\end{subfigure}
\vfill
\begin{matrix}
\subref{fig:Image1BW} & \subref{fig:Image1BWPhaseMaskOnly} & \subref{fig:Image1BWSpatialAndPhaseMask}\\
\subref{fig:Image3Colour} & \subref{fig:Image3ColourPhaseMaskOnly} & \subref{fig:Image3ColourPhaseAndSpatialMask}
\end{matrix}
\hfill
\caption{Development of code to encrypt image. (\subref{fig:Image1BW}) Image to be encrypted. (\subref{fig:Image1BWPhaseMaskOnly}) Encryption through convolution with phase mask. (\subref{fig:Image1BWSpatialAndPhaseMask}) Encryption through multiplication and convolution with phase mask. (\subref{fig:Image3Colour})(\subref{fig:Image3ColourPhaseMaskOnly})(\subref{fig:Image3ColourPhaseAndSpatialMask}) Results of colour images through the same process.}\label{fig:Imaginary Encrypt}
\end{figure}
虽然还不完全一样,但已经接近完美
答案1
目前还不完全清楚您的问题到底是什么。一个简单的代码,重现显示所需的结果是:
\documentclass{book} % used document class is unknown
\usepackage{geometry} % page layout is unknown
\usepackage{graphicx}
\graphicspath{ {./figures/} }
\usepackage{caption}
\captionsetup[figure]{font=small, labelfont = bf}
\usepackage{booktabs, tabularx}
\begin{document}
\begin{figure}[ht]
\setkeys{Gin}{width=\linewidth}
\begin{tabularx}{\textwidth}{@{} XXX @{}}
\includegraphics{example-image-a} & % {figures/Image1BW.png}
\includegraphics{example-image-b} & % {figures/Image1BWPhaseMaskOnly.png}
\includegraphics{example-image-c} \\ % {figures/Image1BWSpatialAndPhaseMask.png}
\addlinespace
\includegraphics{example-image} & % {figures/Image3Colour.png}
\includegraphics{example-image} & % {figures/Image3ColourPhaseMaskOnly.png}
\includegraphics{example-image} % {figures/Image3ColourPhaseAndSpatialMask.png}
\end{tabularx}
\begin{minipage}{0.1\textwidth}\small
\setlength\arraycolsep{3pt}
$\begin{array}{ccc}
\mathbf{a} & \mathbf{b} & \mathbf{c} \\
\mathbf{d} & \mathbf{e} & \mathbf{f}
\end{array}$
\end{minipage}%
\begin{minipage}{0.9\textwidth}
\caption{Development of code to encrypt image.
(\textbf{a}) Image to be encrypted.
(\textbf{b}) Encryption through convolution with phase mask.
(\textbf{c}) Encryption through multiplication and convolution with phase mask.
(\textbf{a}) (\textbf{a}) (\textbf{a}) Results of colour images through the same process.}
\label{fig:Imaginary Encrypt}
\end{minipage}
\end{figure}
\end{document}
答案2
这是一个不太好的解决方案,在文档上实现起来容易得多,但在 latex land 中,您不必手动引用东西。例如,我现在可以自动引用这个图及其子图,太棒了!
输出如下:
代码如下:
\usepackage{caption}
\usepackage{subcaption}
\usepackage{graphicx}
\graphicspath{ {./figures/} }
\usepackage{float}
\usepackage{titlesec}
\usepackage{enumitem}
\usepackage{amsmath}
\usepackage{xcolor}
\captionsetup[subfigure]{labelfont= {color = white}, font = tiny}
\captionsetup[figure]{labelfont = bf}
\begin{document}
\begin{figure}[H]
\begin{subfigure}[t]{0.32\textwidth}
\centering
\includegraphics[width=\linewidth]{figures/Image1BW.png}
\caption{}\label{fig:Image1BW}
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.32\textwidth}
\centering
\includegraphics[width=\linewidth]{figures/Image1BWPhaseMaskOnly.png}
\caption{}\label{fig:Image1BWPhaseMaskOnly}
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.32\textwidth}
\centering
\includegraphics[width=\linewidth]{figures/Image1BWSpatialAndPhaseMask.png}
\caption{}\label{fig:Image1BWSpatialAndPhaseMask}
\end{subfigure}
\begin{subfigure}[t]{0.32\textwidth}
\centering
\includegraphics[width=\linewidth]{figures/Image3Colour.png}
\caption{}\label{fig:Image3Colour}
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.32\textwidth}
\centering
\includegraphics[width=\linewidth]{figures/Image3ColourPhaseMaskOnly.png}
\caption{}\label{fig:Image3ColourPhaseMaskOnly}
\end{subfigure}
\hfill
\begin{subfigure}[t]{0.32\textwidth}
\centering
\includegraphics[width=\linewidth]{figures/Image3ColourPhaseAndSpatialMask.png}
\caption{}\label{fig:Image3ColourPhaseAndSpatialMask}
\end{subfigure}
\vfill
$\begin{minipage}{0.1\textwidth}
$\begin{matrix}
\textbf{\subref{fig:Image1BW}} & \textbf{\subref{fig:Image1BWPhaseMaskOnly}} & \textbf{\subref{fig:Image1BWSpatialAndPhaseMask}}\\
\textbf{\subref{fig:Image3Colour}} & \textbf{\subref{fig:Image3ColourPhaseMaskOnly}} & \textbf{\subref{fig:Image3ColourPhaseAndSpatialMask}}
\end{matrix}$
\end{minipage}$
\begin{minipage}{0.9\textwidth}
\caption{Development of code to encrypt image. (\subref{fig:Image1BW}) Image to be encrypted. (\subref{fig:Image1BWPhaseMaskOnly}) Encryption through convolution with phase mask. (\subref{fig:Image1BWSpatialAndPhaseMask}) Encryption through multiplication and convolution with phase mask. (\subref{fig:Image3Colour}) (\subref{fig:Image3ColourPhaseMaskOnly}) (\subref{fig:Image3ColourPhaseAndSpatialMask}) Results of colour images through the same process.\label{fig:Imaginary Encrypt}}
\end{minipage}
\end{figure}
\end{document}