12.04.2015 Views

Using Imported Graphics in LaTeX and pdfLaTeX - Mirror

Using Imported Graphics in LaTeX and pdfLaTeX - Mirror

Using Imported Graphics in LaTeX and pdfLaTeX - Mirror

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Part III<br />

<strong>Us<strong>in</strong>g</strong> <strong>Graphics</strong>-Inclusion Comm<strong>and</strong>s<br />

10 Horizontal Spac<strong>in</strong>g <strong>and</strong> Center<strong>in</strong>g<br />

Obsolete<br />

Syntax<br />

10.1 Horizontal Center<strong>in</strong>g<br />

The placement of the graphic is controlled by the current text justification. To center<br />

the graphic, put it <strong>in</strong>side a center environment<br />

\beg<strong>in</strong>{center}<br />

\<strong>in</strong>cludegraphics[width=2<strong>in</strong>]{graphic}<br />

\end{center}<br />

If the \<strong>in</strong>cludegraphics comm<strong>and</strong> is <strong>in</strong>side an environment (such as m<strong>in</strong>ipage or<br />

figure), the \center<strong>in</strong>g declaration centers the rema<strong>in</strong><strong>in</strong>g output of the environment.<br />

For example<br />

\beg<strong>in</strong>{figure}<br />

\center<strong>in</strong>g<br />

\<strong>in</strong>cludegraphics[width=2<strong>in</strong>]{graphic}<br />

\end{figure}<br />

is similar to<br />

\beg<strong>in</strong>{figure}<br />

\beg<strong>in</strong>{center}<br />

\<strong>in</strong>cludegraphics[width=2<strong>in</strong>]{graphic}<br />

\end{center}<br />

\end{figure}<br />

The \center<strong>in</strong>g syntax is preferred because the \beg<strong>in</strong>{center} syntax produces<br />

double vertical space above <strong>and</strong> below the figure due to the space produced by<br />

the figure environment <strong>and</strong> by the center environment. If extra vertical space is<br />

desired, the comm<strong>and</strong>s <strong>in</strong> Section 19.1 on Page 64 should be used.<br />

Bugs <strong>in</strong> the \psfig <strong>and</strong> \epsfbox comm<strong>and</strong>s made it difficult to produce horizontallycentered<br />

graphics. The TEX comm<strong>and</strong>s \centerl<strong>in</strong>e <strong>and</strong> \leavevmode were used<br />

as work-arounds for bugs <strong>in</strong> \psfig <strong>and</strong> \epsfbox.<br />

S<strong>in</strong>ce the \<strong>in</strong>cludegraphics comm<strong>and</strong> is written correctly, the \centerl<strong>in</strong>e<br />

<strong>and</strong> \leavevmode comm<strong>and</strong>s are no longer needed, allow<strong>in</strong>g graphics to be centered<br />

with the \center<strong>in</strong>g comm<strong>and</strong> or the center environment.<br />

10.2 Horizontal Spac<strong>in</strong>g<br />

It is important to realize that L A TEX arranges graphics the same way it formats other<br />

objects such as letters. For example, an <strong>in</strong>terword space is <strong>in</strong>troduced between L A TEX<br />

<strong>in</strong>put l<strong>in</strong>es unless the l<strong>in</strong>e ends with a %. For example, just as<br />

Hello<br />

World<br />

put an <strong>in</strong>terword space between “Hello” <strong>and</strong> “World”<br />

\<strong>in</strong>cludegraphics{file}<br />

\<strong>in</strong>cludegraphics{file}<br />

puts an <strong>in</strong>terword space between the graphics. End<strong>in</strong>g the first l<strong>in</strong>e with a comment<br />

character<br />

\<strong>in</strong>cludegraphics{file}%<br />

\<strong>in</strong>cludegraphics{file}<br />

32

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!