Clique aqui e veja a página ShareLaTeX em Inglês

[edit] ShareLaTeX guides

[edit] LaTeX Basics

[edit] Mathematics

[edit] Figures and tables

[edit] References and Citations

[edit] Languages

[edit] Document structure

[edit] Formatting

[edit] Fonts

[edit] Presentations

[edit] Commands

[edit] Field specific

[edit] Class files

To change the positioning of an image (and add caption and reference to it), we need to be able to treat it as an object inside the LaTex document. This object needs to have a few desirable properties -

  1. The contents of this object, i.e., the image, cannot be broken over a page.
  2. We should be able to specify the position of this object in the document.
  3. We should be able to add a caption to this object.
  4. We should be able to add a reference to this object, so that it can be cross-referenced elsewhere in the document.

This is where floats come in handy.

[edit] Floats

In LaTex, floats are used to contain things that must be placed inside a single page, i.e., they cannot be broken over multiple pages. floats can be used to contain tables and figures, but we can define new custom floats as well. Here is how floats address the issues mentioned above -

  1. The entity contained in a float is placed in a single page. If the entity (an image, for example) can not be contained in the space left in the current page, it is placed at the top of the next page.
  2. floats can be positioned wherever we specify - top, middle, bottom, left, right, and so on.
  3. They can have a caption describing them.
  4. The are numbered (so we can add reference to them). This also helps in producing a list of figures or a list of tables that we can include in our document.

To create floats to contain images, we use the figure environment.

[edit] Figures

Here is how we create a floating figure -

    \begin{figure}[''placement specifier'']
    ... figure contents...

The placement specifier parameter allows us to have a greater control over where a figure is placed. But while LaTeX will do its best to follow the placement we specify, it may not always be possible for it to adhere to it. Let us take a look at different placement specifiers and what they do before we dive into examples.

Specifier Permission
h Place the float here, i.e., approximately at the same point it occurs in the source text (however, not exactly at the spot)
t Position at the top of the page.
b Position at the bottom of the page.
p Put on a special page for floats only.
! Override internal parameters LaTeX uses for determining "good" float positions.
H Places the float at precisely the location in the LaTeX code. Requires the float package (\usepackage{float}). This is somewhat equivalent to h!.
    ... figure contents...

[edit] Centering a Figure

We often need to center figures, particularly in presentation. This can be achieved by using \centering -