[Tex/LaTex] \hfill and \hspace do not work

horizontal alignmentspacing

All,

I want to put three figures together in one line, spanning two columns. I used \hfill and \hspace{} in order to make the three figures fully span the horizontal width of the paper. However, after so many times I tried, I just cannot make it. There is always some space on the right, and \hfill or \hspace{} will not help to occupy the space. Below is a MWE.

Please use this link to download the figures http://pan.baidu.com/share/link?shareid=3521927653&uk=3776487005. (Click the button below in the opened page to download, the page is in Chinese.)

enter image description here

%\documentclass[conference]{IEEEtran}
\documentclass[9.5pt,conference,compsocconf,letterpaper]{IEEEtran} %ICDCS
\usepackage[noend]{algpseudocode}
\usepackage[ruled]{algorithm}
\usepackage{subfigure}
\usepackage{graphicx}
\usepackage{times}
\usepackage{amssymb}
\usepackage{url}
\usepackage{hyperref}
\usepackage{amsmath}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage{wrapfig}
\algnewcommand{\LineComment}[1]{\State \(\triangleright\) #1}

\begin{document}

%\title{xxx}
%
%\maketitle


\begin{figure*}[htp]
  % Requires \usepackage{graphicx}
  \begin{minipage}{0.32\textwidth}%
      \centering
      \includegraphics[width=1\textwidth]{merging_and_balancing_multi_thread.eps}%
      \caption{\small Multi-thread monitoring speed with both merging and balancing optimizations.}%
      \label{fig:merging_and_balancing_multi_thread}%
  \end{minipage}\hspace{0.2cm}
  \begin{minipage}{0.33\textwidth}%
      \centering
      \includegraphics[width=1.1\textwidth]{Monitoring_result_and_ground_truth.eps}%
      \caption{\small Popularity monitored by the fixed window and sliding window designs,
                compared with the popularity ground truth.}%
      \label{fig:Monitoring_result_and_ground_truth}%
  \end{minipage}\hfill
  \begin{minipage}{0.32\textwidth}%
      \centering
      \includegraphics[width=1.05\textwidth]{Deviation_distribution.eps}%
      \caption{\small The deviation distribution.}%
      \label{fig:Deviation_distribution}%
  \end{minipage}
  \vspace{-0.6cm}
\end{figure*}


\end{document} 

Best Answer

The images are not cropped and have white margins. For example, Deviation_distribution.eps has the bounding box:

%%BoundingBox:    44   238   549   604

The real bounding box can be calculated via ghostscript:

$ gs -sDEVICE=bbox -dBATCH -dNOPAUSE Deviation_distribution.eps

The result is:

%%BoundingBox: 49 246 493 585
%%HiResBoundingBox: 49.936780 246.815992 492.839985 584.243982

The white margins are:

  • left: 49bp - 44bp = 5bp
  • bottom: 246bp - 238bp = 8bp
  • right: 549bp - 493bp = 56bp
  • top: 604bp - 585bp = 19bp

The .eps files can be fixed by replacing the %%BoundingBox with the result of ghostscript's bbox device. Or the program epstool --copy --bbox can be used.

In case of PDF files, the images can be cropped with pdfcrop.

With cropped images, you can then clean up the code (e.g. something like 1.1\textwidth will usually cause overfull \hbox warnings).