下午好 !
我正在寻找一种方法来在同一页面中添加两张最大的图片。该页面将仅包含带有标题的图片:
\documentclass[notitlepage]{article}
\usepackage{amsmath, amssymb}
\usepackage{pdflscape}
\usepackage[left=0.3in,right=0.3in,top=0.3in,bottom=0.5in]{geometry}
\usepackage{colortbl}
\usepackage[margin=1cm]{caption}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{float}
\usepackage{graphicx}
\graphicspath{{figures/}}
\usepackage{longtable}
%\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{pdfpages}
\usepackage[ ruled,vlined]{algorithm2e}
\usepackage{ifoddpage}
\usepackage{blindtext}
\usepackage{authblk}
\usepackage{listings}
\usepackage{xcolor}
\begin{document}
\FloatBarrier
\begin{figure}[h]
\begin{center}
\makebox[\textwidth]{\fbox{\includegraphics[width=\textwidth,height=\textheight,keepaspectratio]{../figures/figures2/res1.png}}}
\end{center}
\caption{Convergence performance plots of the conceived hybrid optimizer based on iterations number : part-1}
\end{figure}
\FloatBarrier
\begin{figure}[h]
\begin{center}
\makebox[\textwidth]{\fbox{\includegraphics[width=\textwidth,height=\textheight,keepaspectratio]{../figures/figures2/res2.png}}}
\end{center}
\caption{Convergence performance plots of the conceived hybrid optimizer based on iterations number : part-2}
\end{figure}
\FloatBarrier
\end{document}
感谢您的帮助 !
答案1
该页面将支持两个几乎为其高度一半的图形textheight
(因为标题需要空间)。
我简化了您的代码并使用了graphicx
包中的测试图形:一个正方形和一个矩形。
由于您显然希望保持两个图形的纵横比和相同的扩展因子,因此只有一个自由度:分配给两个图形的文本高度的百分比。(示例中为 0.45,但在您的情况下可能会有所不同)。
使用该包的 [H]float
将使 LaTeX 将图形保持在正确的位置。我在第一页添加了一些虚拟文本来说明它的工作原理。
\documentclass[notitlepage]{article}
\usepackage{amsmath, amssymb}
\usepackage{pdflscape}
\usepackage[left=0.3in,right=0.3in,top=0.3in,bottom=0.5in]{geometry}
\usepackage{colortbl}
\usepackage[margin=1cm]{caption}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{float}
\usepackage{graphicx}
\graphicspath{{figures/}}
\usepackage{longtable}
%\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{pdfpages}
\usepackage[ ruled,vlined]{algorithm2e}
\usepackage{ifoddpage}
\usepackage{blindtext}
\usepackage{authblk}
\usepackage{listings}
\usepackage{xcolor}
\usepackage{float} % needed <<<<
\usepackage{showframe} % show the text area
\usepackage{kantlipsum} % dummy text
\begin{document}
\kant[1]
\newpage
\begin{figure}[H]
\centering
\includegraphics[height=0.45\textheight,keepaspectratio]{example-grid-100x100pt}
\caption{Convergence performance plots of the conceived hybrid optimizer based on iterations number : part-1}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[height=0.45\textheight,keepaspectratio]{example-image-b}
\caption{Convergence performance plots of the conceived hybrid optimizer based on iterations number : part-2}
\end{figure}
\kant[2]
\end{document}
答案2
一个快速测试(从 Simon 的解决方案开始)表明,如果你在后面添加一个而不是在前面添加一个,那么你可以使用[p]
而不是。毕竟,这就是 [p] 浮点类型的用途。[H]
\clearpage
\newpage
\documentclass[notitlepage]{article}
\usepackage{amsmath, amssymb}
\usepackage{pdflscape}
\usepackage[left=0.3in,right=0.3in,top=0.3in,bottom=0.5in]{geometry}
\usepackage{colortbl}
\usepackage[margin=1cm]{caption}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{float}
\usepackage{graphicx}
\graphicspath{{figures/}}
\usepackage{longtable}
%\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{pdfpages}
\usepackage[ ruled,vlined]{algorithm2e}
\usepackage{ifoddpage}
\usepackage{blindtext}
\usepackage{authblk}
\usepackage{listings}
\usepackage{xcolor}
\usepackage{float} % needed <<<<
\usepackage{showframe} % show the text area
\usepackage{kantlipsum} % dummy text
\begin{document}
\kant[1]
\begin{figure}[p]
\centering
\includegraphics[height=0.45\textheight,keepaspectratio]{example-grid-100x100pt}
\caption{Convergence performance plots of the conceived hybrid optimizer based on iterations number : part-1}
\end{figure}
\begin{figure}[p]
\centering
\includegraphics[height=0.45\textheight,keepaspectratio]{example-image-b}
\caption{Convergence performance plots of the conceived hybrid optimizer based on iterations number : part-2}
\end{figure}
\clearpage
\kant[2]
\end{document}