When I include a figure in my paper, although it doesn't have any extra white borders around it, it goes to the right even when I use \centering. I always have to manually bring it back by \hspace{-1cm}. Here is my code,

\usepackage{algorithm, algpseudocode, dsfont, color, soul, tikz, amsmath, amssymb, amsfonts, amsthm, bbm, bbold, fixmath, mathtools, multirow, boldline, xcolor, colortbl, url, footnote, cite}
\label{fig: RWD}

Also I wonder if you tell what is the difference between \hfil and \hfill and between \hspace and \hspace*.

  • 2
    Don't use scale, but something like width=\columnwidth; your picture is probably too wide when scaled at 73%. – egreg Apr 27 '18 at 9:52
  • What's the natural width of RWD.pdf? Is it greater than (1/0.73)\columnwidth? – Mico Apr 27 '18 at 10:22
  • \hspace{\fil} and \hspace{\fill} are the same as \hfil and \hfill, resp. \hspace* inserts whitespace no matter what, whereas \hspace might not insert whitespace in case it's part of a "horizontal leader". Apologies for this TeXnical jargon! If you don't know what this means, don't worry about it. – Mico Apr 27 '18 at 10:44

Don't use the \hspace{-1cm} directive, don't use the scale=... option when executing \includegraphics. Instead, as already suggested by @egreg in a comment, set the width of the graph to \columnwidth.

You appear to be loading quite a few packages. However, some packages (such as fixmath) shouldn't be loaded at all, at least not for a document that doesn't employ the Computer Modern font family. Other packages needn't be loaded explicitly as they're loaded automatically by other packages. Oh, and do ask yourself if you really need to load these packages. A good rule of thumb is that if you have no idea what a package does, you may not need to load it in the first place...

enter image description here

\documentclass[conference,demo]{IEEEtran} % omit 'demo' option in real doc.
  \usepackage{algorithm, algpseudocode, dsfont, 
  %color, % don't load this since you're loading 'xcolor' as well
  soul, tikz, 
  %amsmath, % is loaded automatically by mathtools package
  %amsfonts, % is loaded automatically by 'amssymb' package
  amsthm, bbm, bbold, 
  %fixmath, % don't load this package since Times Roman font is in use
  mathtools, multirow, boldline, 
  %url, % don't load 'url' without the 'hyphens' option
  %xcolor, colortbl, % don't load these two packages independently
  footnote, % was last updated in 1997! do you really need it?!
  \usepackage{lipsum} % source of filler text

\lipsum[1] % filler text
\begin{figure}[h!] % "[h!]" used just for this example
%\hspace{-1cm}  % don't use this!
\label{fig:RWD} % default exension is ".pdf"
\lipsum[2] % more filler text

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.