Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Possible Duplicate:
How to influence the position of float environments like figure and table in LaTeX?

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?

share|improve this question

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

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3  
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
    
Thanks! That solved my problem! –  Kyle Dec 1 '12 at 23:26
    
Ok, I have turned my comment into an answer. If you are happy with this answer, you can mark it as accepted so that the question does not appear as unanswered (but it is always best to wait a little before doing so in case someone else gives a better answer). –  Corentin Dec 1 '12 at 23:31

1 Answer 1

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).

share|improve this answer
1  
I made the link descriptive- hope you don't mind :) We link to this particular question a lot, so it helps to see the link description and not hide it –  cmhughes Dec 2 '12 at 3:43

Not the answer you're looking for? Browse other questions tagged or ask your own question.