子浮动的通用图例

子浮动的通用图例
\begin{figure}[!h]
        \centering
    \subfloat{\includegraphics[width=4.5cm,height=3.5cm]{a.jpeg}%
        }   
        \subfloat{\includegraphics[width=4.5cm,height=3.5cm]{b.jpeg}%
        }\\
        \subfloat{\includegraphics[width=4.5cm,height=3.5cm]{c.jpeg}%
        }
        \subfloat{\includegraphics[width=4.5cm,height=3.5cm]{d.jpeg}%
        }\\
        \caption{comman legend.}
        \label{3}
    \end{figure}        

如何为子图添加常见图例。

答案1

没有什么可以阻止您在图形和公共标题之间写一些内容。您可以直接输入一些文本,将其放在minipage或使用tabular。以下是一个例子:

\documentclass[11pt,a4paper]{article}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{tabularx}
\begin{document}
\begin{figure}[!h]
\centering
\subfloat{\includegraphics[width=4.5cm,height=3.5cm]{example-image-a.jpg}}
\subfloat{\includegraphics[width=4.5cm,height=3.5cm]{example-image-b.jpg}}\\
\subfloat{\includegraphics[width=4.5cm,height=3.5cm]{example-image-c.jpg}}
\subfloat{\includegraphics[width=4.5cm,height=3.5cm]{example-image.jpg}}\\[2ex]
Some Text can go here, but it is of course centered. And it extends to the
full text width.

\vspace{2ex}
\begin{minipage}{9cm}
Or you can put it in a mini page with the appropriate width. Or, as shown below,
you can use a tabular.
\end{minipage}

\vspace{2ex}
\begin{tabularx}{9cm}{@{}lX@{}}
\multicolumn{2}{@{}l}{\textbf{Legend:}}\\
top left:     & nice gray image with the letter A and some lines \\
top right:    & nice gray image with the letter B and some lines\\
bottom left:  & nice gray image with the letter C and some lines\\
bottom right: & nice gray image with the word Image and some lines
\end{tabularx}
\caption{Comman caption.}
\label{3}
\end{figure}
\end{document}

环境figure仅使其内容浮动,其标题(通常)以数字。内容几乎可以是任何你想要的东西。

相关内容