Latex 将两幅带有标题的图像并排放置,并用乳胶控制其高度

Latex 将两幅带有标题的图像并排放置,并用乳胶控制其高度,latex,beamer,Latex,Beamer,我想在latex/beamer演示文稿中对齐两个图像。 它们没有相同的宽高比,我想控制整体高度 如果我不需要字幕,以下功能很好: \includegraphics[height=0.35\textheight]{im1.png} \hfill \includegraphics[height=0.35\textheight]{im2.png} 请注意,我不需要输入图像宽度,我也不想输入。 但是只要我需要放一个标题,使用两个figure环境将数字放在两行上。 解决方案是将两个图环境插入迷你页,但我

我想在latex/beamer演示文稿中对齐两个图像。 它们没有相同的宽高比,我想控制整体高度

如果我不需要字幕,以下功能很好:

\includegraphics[height=0.35\textheight]{im1.png}
\hfill
\includegraphics[height=0.35\textheight]{im2.png}
请注意,我不需要输入图像宽度,我也不想输入。

但是只要我需要放一个标题,使用两个
figure
环境将数字放在两行上。 解决方案是将两个
环境插入迷你页,但我必须根据我想要的平均高度计算两个迷你页的宽度


是否可以避免计算迷你页的宽度?

您可以将图像放在表格中

您可以添加小标题,它们将适应您的栏宽。
唯一的问题是当你的标题跨越几行时。在这种情况下,columntype必须是
p
,但在不知道段落宽度的情况下,无法定义或更改段落的列类型

一种解决方案是使用表格。它基本上与表格式*相同,需要表格的总宽度。但列将根据其单元格的较大自然宽度进行调整,并根据列说明符将其格式化为段落:居中(C)、左参差不齐(L)、右(R)或对齐(J)

下面的示例说明了这两种方法

\documentclass[array]{article}

\usepackage{graphicx}
\usepackage{tabulary}

\begin{document}
\begin{tabular}{cc}
  \includegraphics[height=0.25\textheight]{mushr1}
  &
  \includegraphics[height=0.25\textheight]{mushr2}
   \\                                                     
   Mushroom 1&Mushroom 2
 \end{tabular}

\begin{tabulary}{\linewidth}{CC}
  \includegraphics[height=0.25\textheight]{mushr1}
  &
  \includegraphics[height=0.25\textheight]{mushr2}
   \\                                                     
   Look how beautiful are these mushrooms!&
   Some others beautiful mushrooms. But these ones are very dangerous. Never eat them!
 \end{tabulary}
\end{document}


居中和对正远非完美,但这可能是一个起点。

要获得beamer格式的真实字幕,
varwidth
软件包可以帮助:

\documentclass{beamer}
\usepackage{varwidth}

\begin{document}

\begin{frame}
    \begin{varwidth}{\textwidth}
        \begin{figure}
            \includegraphics[height=0.45\textheight]{example-image-duck}
            \caption{text}
        \end{figure}
    \end{varwidth}
    \hfill
    \begin{varwidth}{\textwidth}
        \begin{figure}
            \includegraphics[height=0.45\textheight]{example-image-golden-upright}
            \caption{text}
        \end{figure}
    \end{varwidth}
\end{frame} 

\end{document}

在Beamer中,我尝试了\column和\minipage环境将图形并排放置。但工作不正常,并且存在对齐问题。最后,以下解决方案通过使用
\usepackage{subfigure}工作。

\begin{figure}
    \centering
    \mbox{\subfigure{\includegraphics[width=5.5cm, height=4.8cm]{suppopicture3}}\quad
        \subfigure{\includegraphics[width=3.0cm, height=4.5cm]{Figure 3_HR-TEM_result} }}
    \caption{Text pertaining to both graphs ...} \label{fig12}
\end{figure}
参考:-