# Controlling placement of figures in text [duplicate]

How does one manipulate the placement of figures within text? I can't seem to control which text appears before the diagram and which comes after.

Here is the sample code for my figure:

\begin{figure}
\begin{tikzpicture}
\matrix (m) [matrix of math nodes,row sep=0.5em,column sep=0.5em,minimum width=0.5em]
{
D1  &          & F1 &             & D2  \\
&   \alpha &      & \beta     &         \\
F2          &        &      &               & F2      \\
&   -\beta &          & -\alpha &             \\
D2  &            & F2 &         &   D1  \\
};
\path[-] (m-1-1) edge [] node [] {} (m-5-5);
\path[-] (m-1-3) edge [] node [] {} (m-5-3);
\path[-] (m-3-1) edge [] node [] {} (m-3-5);
\path[-] (m-1-5) edge [] node [] {} (m-5-1);
\end{tikzpicture}
\end{figure}


Anyways I just need to learn how to control the placement insofar as before or after certain paragraphs, I don't care about any kind of strict control.

Is this something that is simple?

## marked as duplicate by Martin Scharrer♦Dec 4 '12 at 20:13

• If you use the figure environment, your TikZ drawing is considered as a float and positioned according to the general rules for floats (see this post). In your case, your matrix should probably not be treated as a float. You could simply remove the \begin{figure} \end{figure} to make sure your picture appears at the same position as in the source. – Corentin Dec 1 '12 at 23:21
Whatever is placed inside a figure environment is considered as a float and positioned according to the general rules for floats (see How to influence the position of float environments like figure and table in LaTeX? for a description of these rules).
In your case, your TikZ matrix should probably not be treated as a float. You could simply remove the \begin{figure} and \end{figure} to make sure your picture appears in the output at the same position as in the source.
Note that in general, you should not use floating environments like figure or table if you do not wish its content to float: even a figure can be positioned as non-floating by simply using \includegraphics outside of the figure environment. Note also that some packages allow for more control on the way floats are positioned (see also Keeping tables/figures close to where they are mentioned).