3

Basically, I have a large graph, which take almost half a page. Right now, when I compile the tex file, the graph shifts to the right on the pdf. I have label and caption on this graph. How can I shift it to the left such that it looks like it is being centered? I have checked out some other posts. However, none seems to work for me.

\begin{center}
\centering{\includegraphics[height =375px, width = 450px]{ABC.pdf} }
\captionof{figure}{ABC}
\label{abc}
\end{center}

Or maybe Someone can give me a solution that can allow to begin at position on the left while having the caption centre at the middle.

3

The \hsmash macro of the 9-11 release of the stackengine package makes LaTex think the image is zero width. Thus, it has no problem centering it, because it doesn't know it falls outside of the left margin.

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{stackengine}[2013-09-11]
\usepackage{caption}
\begin{document}
{\centering
\hsmash{\includegraphics[height =375px, width = 450px]{ABC.pdf} }
\captionof{figure}{ABC}\label{abc}}

here is textwidth\\\rule{\textwidth}{1ex}
\end{document}

enter image description here

  • What's \centering supposed to do? – egreg Sep 15 '13 at 22:29
  • you don't want the \centering inside center (copied from original example) Is \hsmash{..} different from \makebox[0pt]{..} ? – David Carlisle Sep 15 '13 at 22:30
  • @egreg oversight. Fixed. – Steven B. Segletes Sep 15 '13 at 22:31
  • @DavidCarlisle center environment removed... Codewise, \hsmash is not a \makebox; It is more like a \clap (halfway between a \rlap and \llap). Functionally, I don't know if it acts differently from a \makebox[0pt]. – Steven B. Segletes Sep 15 '13 at 22:34
  • @StevenB.Segletes I guess it's the same then:-) \makebox[0pt][clr] are left right or centred *lap depending on the second arguument, defaulting to c – David Carlisle Sep 15 '13 at 22:40

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.