![如何在两个并排的图形之间留出水平空间,然后自动将图片缩放到新的宽度?](https://linux22.com/image/326130/%E5%A6%82%E4%BD%95%E5%9C%A8%E4%B8%A4%E4%B8%AA%E5%B9%B6%E6%8E%92%E7%9A%84%E5%9B%BE%E5%BD%A2%E4%B9%8B%E9%97%B4%E7%95%99%E5%87%BA%E6%B0%B4%E5%B9%B3%E7%A9%BA%E9%97%B4%EF%BC%8C%E7%84%B6%E5%90%8E%E8%87%AA%E5%8A%A8%E5%B0%86%E5%9B%BE%E7%89%87%E7%BC%A9%E6%94%BE%E5%88%B0%E6%96%B0%E7%9A%84%E5%AE%BD%E5%BA%A6%EF%BC%9F.png)
我一直在研究如何将书中的图和标题并排放置,但一直没能找到在两个图之间留出水平空间的方法。自从我开始使用 PDF 图像以来,一直存在一些问题,所以我只是想提一下以防万一。
到目前为止,我一直在使用 minipage 解决方案来管理这个问题,但我不知道该怎么做。任何帮助或建议都将不胜感激。
\documentclass{article}
\usepackage{graphicx}
\usepackage{caption}
\usepackage[paperwidth=6in, paperheight=9in, margin=0.9in, showframe]{geometry}
\usepackage{lipsum}
\begin{document}
\begin{figure}
\centering
\begin{minipage}{.5\textwidth}
\centering
\includegraphics[width=1\linewidth]{camellia}
\captionof{figure}{an evergreen eastern Asian shrub related to the tea plant, grown for its showy flowers and shiny leaves.}
\label{camellia}
\end{minipage}%
\begin{minipage}{.5\textwidth}
\centering
\includegraphics[width=1\linewidth]{rose}
\captionof{figure}{a prickly bush or shrub that typically bears red, pink, yellow, or white fragrant flowers, native to north temperate regions. Numerous hybrids and cultivars have been developed and are widely grown as ornamentals.}
\label{rose}
\end{minipage}
\end{figure}
\lipsum
\end{document}
我想要获得的是:
我没有在标题中提到这一点,但我还想让标题相互内联。并且图像也位于同一行,如下所示:
答案1
\documentclass{article}
\usepackage{graphicx}
\usepackage{caption}
\usepackage[paperwidth=6in, paperheight=9in, margin=0.9in, showframe]{geometry}
\usepackage{lipsum}
\begin{document}
\begin{figure}
\centering
\begin{minipage}{.4\textwidth}
\centering
\includegraphics[width=1\linewidth]{example-image}
\end{minipage}\qquad
\begin{minipage}{.4\textwidth}
\centering
\includegraphics[width=1\linewidth]{example-image-golden-upright}
\end{minipage}
\bigskip
\begin{minipage}[t]{.4\textwidth}
\centering
\caption{an evergreen eastern Asian shrub related to the tea plant, grown for its showy flowers and shiny leaves.}
\label{camellia}
\end{minipage}\qquad
\begin{minipage}[t]{.4\textwidth}
\centering
\caption{a prickly bush or shrub that typically bears red, pink, yellow, or white fragrant flowers, native to north temperate regions. Numerous hybrids and cultivars have been developed and are widely grown as ornamentals.}
\label{rose}
\end{minipage}
\end{figure}
\lipsum
\end{document}
答案2
只需为小页面保留所需的空间;就\dimexpr
可以很容易地修复图像之间的空间(这里为 2 em)。
请注意,您不需要\captionof
。使用\begin{minipage}[t]
可确保与图片底部对齐。
\documentclass{article}
\usepackage{graphicx}
\usepackage{caption}
\usepackage[paperwidth=6in, paperheight=9in, margin=0.9in, showframe]{geometry}
\usepackage{lipsum}
\begin{document}
\begin{figure}
\centering
\begin{minipage}[t]{\dimexpr.5\textwidth-1em}
\centering
\includegraphics[width=\textwidth]{example-image-9x16}
\caption{an evergreen eastern Asian shrub related to the tea plant,
grown for its showy flowers and shiny leaves.}\label{camellia}
\end{minipage}\hfill
\begin{minipage}[t]{\dimexpr.5\textwidth-1em}
\centering
\includegraphics[width=\textwidth]{duck}
\caption{a prickly bush or shrub that typically bears red,
pink, yellow, or white fragrant flowers, native to north
temperate regions. Numerous hybrids and cultivars have been
developed and are widely grown as ornamentals.}\label{rose}
\end{minipage}
\end{figure}
\lipsum
\end{document}