并排图像

并排图像

我正在尝试使用 minipages 选项将两张图片并排放置。但我的标题相当长 - 出于显而易见的原因,我希望两张图片之间有更多空间。我该怎么做?

我的代码:

\documentclass[12pt]{article}
\usepackage[a4paper]{geometry}
\usepackage[myheadings]{fullpage}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage[T1]{fontenc}
\usepackage[font=small, labelfont=bf]{caption}
\usepackage{fourier}
\usepackage[protrusion=true, expansion=true]{microtype}
\usepackage[english]{babel}
\usepackage{sectsty}
\usepackage{amsmath,amssymb,amsthm,textcomp}
\usepackage{setspace}
\usepackage{array}
\usepackage{color}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{gensymb}
\usepackage{graphicx}
\usepackage{adjustbox}
\usepackage{blindtext}
\usepackage{biblatex}
\usepackage[utf8]{inputenc}
\usepackage[table,xcdraw]{xcolor}
\usepackage[justification=centering]{caption}
\usepackage{parskip}
\usepackage{float}

\begin{document}
\begin{figure}[H]
\centering
\begin{minipage}[b]{.5\textwidth}
  \centering
  \includegraphics[width=.4\linewidth]{exp2a}
  \captionof{figure}{The circuit setup to calculate the current through      the resistor using Ohm's Law with $V_{in}=1.00\pm5\%  V$ and $R=10.0\pm5\%  M\Omega$.}
  \label{fig:test1}
\end{minipage}
\hfill
\begin{minipage}[b]{.5\textwidth}
  \centering
  \includegraphics[width=.4\linewidth]{exp2b}
  \captionof{figure}{The circuit setup to measure the current through the resistor using Ohm's Law $V_{in}=1.00\pm5\%  V$ and $R=10.0\pm5\%   M\Omega$.}
  \label{fig:test2}
\end{minipage}
\end{figure}
\end{document}

编译后会产生以下输出: 我显然想将标题分开,使它们之间有空格,但我不知道该怎么做!

答案1

\documentclass[12pt]{article}
\usepackage[a4paper]{geometry}
\usepackage[font=small, labelfont=bf]{caption}
\usepackage{subcaption}
\usepackage[demo]{graphicx}

\begin{document}
\begin{figure}[htb]% <-- don't use option H!
\centering
\begin{minipage}[b]{.45\textwidth}% <-- reduced minipage width (that gives space between them
  \centering% <--
  \includegraphics[width=\linewidth]{exp2a}% <-- width of images is equal to mini page's width
  \captionof{figure}{The circuit setup to calculate the current through the resistor using Ohm's Law with $V_{in}=1.00\pm5\%  V$ and $R=10.0\pm5\%  M\Omega$.}
  \label{fig:test1}
\end{minipage}
\hfil % <-- changed from \hfill
\begin{minipage}[b]{.45\textwidth}% <-- reduced minipage width
  \centering% <-- is sensible only if picture is smaller than minipage width
  \includegraphics[width=\linewidth]{exp2b}
  \captionof{figure}{The circuit setup to measure the current through the resistor using Ohm's Law $V_{in}=1.00\pm5\%  V$ and $R=10.0\pm5\%   M\Omega$.}
  \label{fig:test2}
\end{minipage}
\end{figure}
\end{document}

上述代码应该是不言自明的(参见其中的注释)。结果是:

在此处输入图片描述

无关: 在代码的序言中,您有重复的包:xcolor是的扩展版本color,即color多余的;caption被加载了三次。为了说明您的问题,序言中的大多数包都是多余的。我使用包demo的选项,graphicx因为我没有您的图片。在最终文档中,您必须删除此选项。此外,使用H选项放置图片并不是一个好主意。它会导致文档格式非常难看。

相关内容