41

I have 2 questions:

  1. I am trying to center a figure in LaTeX, but above a certain size it just starts at the left margin and goes beyond the right. How can I make it actually center, so the amount it goes over the left margin is the same as the right?

  2. Some short lines justify to fill the whole page width, which makes it look really bad. Is there a way I can fix these lines, or maybe set the width for justification to be considered?

Thanks in advance.

52
  1. \centerline{\includegraphics{foo}}

  2. Can you provide an example? You can use \raggedright or even ragged2e package to control the paragraph. However, I wonder how the short lines fill the whole page width.

  • Thank you, these both worked perfectly! The line in question was "when one interprets them.". I simply surrounded it in raggedright and it worked. Is there a more permanent solution, though? – Anonymous Jan 10 '11 at 5:44
  • It is hard to figure out what problem you're having with (2). It's completely unclear what "a more permanent solution" would be like. That's why Leo wanted an example. – frabjous Jan 10 '11 at 17:42
22

Re: 1.: I've been using this excellent tip by Stefan Kottwitz for very large figures in my PhD-Thesis. Essentially, it boils down to using a

\noindent\makebox[\textwidth]{%
  very wide figure or very wide table%
}

around your figure- or table-code.

8

Another possible solution is to use a picture environment and then \put the included graphic way left:

\begin{figure}[htbp]
  \centering
  \setlength{\unitlength}{\textwidth} 
    \begin{picture}(1,0.5)%in case your image is twice as wide as it is high
                          %(otherwise change the 0.5 to your file's height/width).
       \put(-0.1,0){\includegraphics[width=1.2\unitlength]{image.jpg}}
    \end{picture}
\end{figure}

Your Answer

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