如何确保两个相邻的图形和标题水平对齐?

如何确保两个相邻的图形和标题水平对齐?

图像不共享水平底线,使用时标题也不共享:

\centering
\begin{minipage}{.48\textwidth}
  \centering
  \includegraphics[width=\linewidth]{Figures/im1}
  \captionof{figure}{Long caption ..........................................................................................................................}
  \label{fig:im1}
\end{minipage}
\hfill
\begin{minipage}{.48\textwidth}
  \centering
  \includegraphics[width=\linewidth]{Figures/im2}
  \captionof{figure}{Long caption ...........................................................................................................................}
  \label{fig:im2}
\end{minipage}
\end{figure}

有什么方法可以使图像的底部和标题的顶部水平对齐?

答案1

floatrow包非常简单:

\documentclass{article}
\usepackage[margin=2cm]{geometry}
\usepackage{erewhon}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{floatrow}

\begin{document}

\begin{figure}
\centering
\begin{floatrow}
\ffigbox[\FBwidth]{\caption{Meret Oppenheim – Schoolgirl’s Notebook}}{ \includegraphics[width=\linewidth]{cahier}}
\hfill
\ffigbox[\FBwidth]{\caption{Meret Oppenheim – My Nurse}}{\includegraphics[width=0.8\linewidth]{magouvernante}}
\end{floatrow}
\end{figure}

\end{document} 

在此处输入图片描述

答案2

在此处输入图片描述

\documentclass{article}
\usepackage{graphicx}
\usepackage{caption}
\begin{document}

\begin{figure}
\centering
\begin{minipage}[b]{.48\textwidth}
  \includegraphics[width=\linewidth]{example-image}
\end{minipage}
\hfill
\begin{minipage}[b]{.48\textwidth}
  \includegraphics[width=\linewidth]{example-image-16x9}
\end{minipage}
\begin{minipage}[t]{.48\textwidth}
  \caption{Long caption long caption long caption long caption long caption long caption long caption long caption long caption long caption \label{fig:im1}}
\end{minipage}
\hfill
\begin{minipage}[t]{.48\textwidth}
  \caption{Long caption long caption long caption long caption long caption long caption \label{fig:im2}}
\end{minipage}
\end{figure}

\end{document}

答案3

两种方法——测量图形的宽度并将其保存在sbox——或者使用选项将其对齐minipages在底部[b]——两者的结果相同

选择savebox

在此处输入图片描述

minipages底部对齐,captionsetup = linewidth

在此处输入图片描述

平均能量损失

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{blindtext}

\begin{document}
    \begin{figure}[!ht]
    \begin{minipage}[b]{.48\textwidth}
        \centering
        \sbox0{\includegraphics[width=\linewidth]{example-image}}% measure width}
        \begin{minipage}{\wd0}
            \usebox0
            \caption{\blindtext}
        \end{minipage}
        \label{fig:im1}
    \end{minipage}
    \hfill
    \begin{minipage}[b]{.48\textwidth}
        \centering
        \sbox0{\includegraphics[width=\linewidth]{example-image-16x9}}
        \begin{minipage}{\wd0}
            \usebox0
            \caption{\blindtext}
        \end{minipage}
        \label{fig:im2}
    \end{minipage}
\end{figure}

    \begin{figure}[!ht]
    \begin{minipage}[b]{.48\textwidth}
        \centering
                \captionsetup{width=\linewidth}
        \includegraphics[width=\linewidth]{example-image}
                    \caption{\blindtext}
            \label{fig:im1}
    \end{minipage}
    \hfill
    \begin{minipage}[b]{.48\textwidth}
        \centering
                        \captionsetup{width=\linewidth}
        \includegraphics[width=\linewidth]{example-image-16x9}
                    \caption{\blindtext}
            \label{fig:im2}
    \end{minipage}
\end{figure}
\end{document}

相关内容