![带有小页面的图形 - 如何使其适合文本宽度](https://linux22.com/image/450597/%E5%B8%A6%E6%9C%89%E5%B0%8F%E9%A1%B5%E9%9D%A2%E7%9A%84%E5%9B%BE%E5%BD%A2%20-%20%E5%A6%82%E4%BD%95%E4%BD%BF%E5%85%B6%E9%80%82%E5%90%88%E6%96%87%E6%9C%AC%E5%AE%BD%E5%BA%A6.png)
我该怎么做才能使它适应\textwidth
?
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} % ensure your document is UTF-8
\usepackage[spanish]{babel}
\usepackage[demo]{graphicx} % demo option just for testing
\usepackage{caption}
\usepackage{subcaption}
\usepackage{float}
\usepackage[showframe]{geometry}
\begin{document}
% Begin minipage figure
\begin{figure}[htb]
\begin{minipage}[t]{.32\textwidth}
\centering
\includegraphics[width=\textwidth]{images/1.png}
\subcaption{Image 1.}\label{fig:1}
\end{minipage}
\hfill
\begin{minipage}[t]{.32\textwidth}
\centering
\includegraphics[width=\textwidth]{images/2.png}
\subcaption{Image 2.}\label{fig:2}
\end{minipage}
\hfill
\begin{minipage}[t]{.32\textwidth}
\centering
\includegraphics[width=\textwidth]{images/rtk3.png}
\subcaption{Image 3.}\label{fig:3}
\end{minipage}
\hfill
\label{fig:1-2-3}
\caption{Title.}
\end{figure}
\begin{minipage}{\textwidth}
\centering
\begin{minipage}{0.475\textwidth}
\begin{figure}[H]
\includegraphics[width=\linewidth]{france-in-pictures-beautiful-places-to-photograph-eiffel-tower}
\caption{This is the first figure}
\end{figure}
\end{minipage}
\hfill
\begin{minipage}{0.475\textwidth}
\begin{figure}[H]
\includegraphics[width=\linewidth]{france-in-pictures-beautiful-places-to-photograph-eiffel-tower}
\caption{This is the second figure}
\end{figure}
\end{minipage}
\hfill
\end{minipage}
\end{document}
答案1
尝试一下这个代码。
(1)删除\hfill
最后一张图后面的;(2)将小页面放在第二行的图环境中,而不是相反;(3)将标签放在第一行的标题后面。
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} % ensure your document is UTF-8
\usepackage[spanish]{babel}
\usepackage[demo]{graphicx} % demo option just for testing
\usepackage{caption}
\usepackage{subcaption}
\usepackage{float}
\usepackage[showframe]{geometry}
\begin{document}
% Begin minipage figure
\begin{figure}[htb]
\begin{minipage}[t]{.32\textwidth}
\centering
\includegraphics[width=\textwidth]{images/1.png}
\subcaption{Image 1.}\label{fig:1}
\end{minipage}
\hfill
\begin{minipage}[t]{.32\textwidth}
\centering
\includegraphics[width=\textwidth]{images/2.png}
\subcaption{Image 2.}\label{fig:2}
\end{minipage}
\hfill
\begin{minipage}[t]{.32\textwidth}
\centering
\includegraphics[width=\textwidth]{images/rtk3.png}
\subcaption{Image 3.}\label{fig:3}
\end{minipage}
% \hfill
\label{fig:1-2-3}%changed
\caption{Title.} %<<<<<<<<<<<<<<<
\end{figure}
\begin{figure}[htb]
% \begin{minipage}{\textwidth}
\centering
\begin{minipage}{0.475\textwidth}
% \begin{figure}[H]
\includegraphics[width=\linewidth]{france-in-pictures-beautiful-places-to-photograph-eiffel-tower}
\caption{This is the first figure}
% \end{figure}
\end{minipage}
\hfill
\begin{minipage}{0.475\textwidth}
% \begin{figure}[H]
\includegraphics[width=\linewidth]{france-in-pictures-beautiful-places-to-photograph-eiffel-tower}
\caption{This is the second figure}
% \end{figure}
\end{minipage}
% \hfill
% \end{minipage}
\end{figure}
\end{document}
答案2
对于子图像,我将使用subfigure
环境(在包中定义),在图像行末尾subcaption
删除并删除第二行图形周围的s::hfill
minipage
minipage
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[spanish]{babel}
\usepackage[demo]{graphicx} % demo option just for testing
\usepackage{caption}
\usepackage{subcaption}
\usepackage[showframe]{geometry}
\begin{document}
\begin{figure}[htb]
\begin{subfigure}[t]{.32\textwidth}
\includegraphics[width=\textwidth]{images/1.png}
\caption{Image 1.}
\label{fig:1}
\end{subfigure}
\hfill
\begin{subfigure}[t]{.32\textwidth}
\includegraphics[width=\textwidth]{images/1.png}
\caption{Image 2.}
\label{fig:2}
\end{subfigure}
\hfill
\begin{subfigure}[t]{.32\textwidth}
\includegraphics[width=\textwidth]{images/1.png}
\caption{Image 3.}
\label{fig:1}
\end{subfigure}
\caption{Title}
\bigskip
\begin{minipage}{0.475\textwidth}
\includegraphics[width=\linewidth]{france-in-pictures-beautiful-places-to-photograph-eiffel-tower}
\caption{This is the first figure}
\end{minipage}%
\hfill
\begin{minipage}{0.475\textwidth}
\includegraphics[width=\linewidth]{france-in-pictures-beautiful-places-to-photograph-eiffel-tower}
\caption{This is the second figure}
\end{minipage}
\end{figure}
\end{document}
答案3
试试这个代码:
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} % ensure your document is UTF-8
\usepackage[spanish]{babel}
\usepackage[demo]{graphicx} % demo option just for testing
\usepackage{caption}
\usepackage{subcaption}
\usepackage{float}
\usepackage[showframe]{geometry}
\begin{document}
% Begin minipage figure
\begin{figure}[htb]
\begin{minipage}[t]{.32\textwidth}
\centering
\includegraphics[width=\textwidth]{images/1.png}
\subcaption{Image 1.}\label{fig:1}
\end{minipage}
\hfill
\begin{minipage}[t]{.32\textwidth}
\centering
\includegraphics[width=\textwidth]{images/2.png}
\subcaption{Image 2.}\label{fig:2}
\end{minipage}
\hfill
\begin{minipage}[t]{.32\textwidth}
\centering
\includegraphics[width=\textwidth]{images/rtk3.png}
\subcaption{Image 3.}\label{fig:3}
\end{minipage}
\hfill
\label{fig:1-2-3}
\caption{Title.}
\end{figure}
\begin{figure}[h]
\centering
\begin{minipage}{0.475\textwidth}
\begin{figure}[H]
\includegraphics[width=\linewidth]{france-in-pictures-beautiful-places-to-photograph-eiffel-tower}
\caption{This is the first figure}
\end{figure}
\end{minipage}
\hfill
\begin{minipage}{0.475\textwidth}
\begin{figure}[H]
\includegraphics[width=\linewidth]{france-in-pictures-beautiful-places-to-photograph-eiffel-tower}
\caption{This is the second figure}
\end{figure}
\end{minipage}
\hfill
\end{figure}
\end{document}