将 3 张图片水平挤压在一起

将 3 张图片水平挤压在一起

我在一页上有三个图表:

\documentclass[a4paper, 12pt]{article}

\usepackage{ifpdf}
\usepackage[latin1]{inputenc}
\usepackage[margin=2cm, left=2cm, top = 1.7cm, bottom=1.7cm]{geometry}
\usepackage{amsmath, mathtools}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{epigraph}
\usepackage{wasysym}
\usepackage[none]{hyphenat}
\usepackage[super]{nth}
%\usepackage{subfig}
\usepackage{textcomp}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{hyperref}
\usepackage[authoryear, super]{natbib}
\usepackage{comment}
\usepackage{setspace}
\usepackage{float}
\usepackage{dcolumn}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{multicol}
\usepackage{gensymb}

\begin{document}
\begin{figure}[htp]

    \centering
    \includegraphics[width=.32\linewidth]{"../../Graphs for Jan/graph_left"}
    \includegraphics[width=.32\linewidth]{"../../Graphs for Jan/graph_middle"}
    \includegraphics[width=.32\linewidth]{"../../Graphs for Jan/graph_right"}

    \caption[Fit for different redshift ranges]{The best fits for each redshift range, $ (U-K)/(W2-NUV) $ for $ z<1 $ (left), $ (I-W2)/(W3-U) $ for $ 1<z<3 $ (middle) and $ (I-SPIT8)/(W4-R) $ for $ z>3 $ (right).}
    \label{fig:3graphs}

\end{figure}
\end{document}

在此处输入图片描述

但我希望它们之间的空白尽可能小,必要时可以超出边距。我不需要将它们作为子图,它们可以作为一个图形使用(即红色来自0<x<1,绿色来自1<x<3,蓝色来自 )3<x。我怎样才能让它们更靠近?

答案1

我将您使用的图像更改为必须安装但未调用的example-image-a包中的等......mwe

现请参见以下更正并缩短的 mwe:

\documentclass[a4paper, 12pt]{article}

\usepackage[latin1]{inputenc}
\usepackage[margin=2cm, left=2cm, top = 1.7cm, bottom=1.7cm]{geometry}

\usepackage{graphicx}

\usepackage{caption}


\begin{document}

\begin{figure}[htp]
  \centering%
  \includegraphics[width=.33\linewidth]{example-image-a}%
  \includegraphics[width=.33\linewidth]{example-image-b}%
  \includegraphics[width=.33\linewidth]{example-image-c}%
  \caption[Fit for different redshift ranges]{The 
    best fits for each redshift range, $ (U-K)/(W2-NUV) 
    $ for $ z<1 $ (left), $ (I-W2)/(W3-U) $ for $ 1<z<3 $ (middle) and 
    $ (I-SPIT8)/(W4-R) $ for $ z>3 $ (right).}
  \label{fig:3graphs}
\end{figure}

\end{document}

正如您所看到的,我%在您的图像后添加了并使用了.33您的,.32因为添加的内容%删除了图像之间的空间......正如您在结果中看到的那样:

生成的 pdf

我建议不要将图形扩展到边距,而且在您的情况下似乎不需要......

答案2

如果您从每幅图像中修剪尽可能多的空白(保持所有图像的宽度相似),那么很容易将它们推入边距而不会影响其他设置。

在此处输入图片描述

\documentclass[a4paper, 12pt]{article}

\usepackage{ifpdf}
\usepackage[latin1]{inputenc}
\usepackage[margin=2cm, left=2cm, top = 1.7cm, bottom=1.7cm]{geometry}
\usepackage{amsmath, mathtools}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{epigraph}
\usepackage{wasysym}
\usepackage[none]{hyphenat}
\usepackage[super]{nth}
%\usepackage{subfig}
\usepackage{textcomp}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{hyperref}
\usepackage[authoryear, super]{natbib}
\usepackage{comment}
\usepackage{setspace}
\usepackage{float}
\usepackage{dcolumn}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{multicol}
\usepackage{gensymb}

\begin{document}
\begin{figure}[htp]

    \centering

    \parbox{1.1\textwidth}{\hspace{-1.0cm}\includegraphics[width=.33\linewidth]{example-image-a}
    \includegraphics[width=.33\linewidth]{example-image-b}
    \includegraphics[width=.33\linewidth]{example-image-c}}

    \caption[Fit for different redshift ranges]{The best fits for each redshift range, $ (U-K)/(W2-NUV) $ for $ z<1 $ (left), $ (I-W2)/(W3-U) $ for $ 1<z<3 $ (middle) and $ (I-SPIT8)/(W4-R) $ for $ z>3 $ (right).}
    \label{fig:3graphs}

\end{figure}
\end{document}

相关内容