I make two pictures with TikZ in two figures at top of each secion.
I refer their position at the end of each section.
Can you suggest a way to move them arbitrarily?

My problem is lables

They should make before using them.
Here is my entire code to show an example of a table (splited by lines) which forced me to locate the figure at the beginning of the section:


% and other necessary packages

\section{جلسه اول}

\subfloat[سوال اول و دوم]{\label{fig:J55VH}
\filldraw [black] (.5,.5) rectangle (.75,.75);
  \foreach \x in {.125,.375,...,1.125}
    \foreach \y in {.125,.375,...,1.125}
      \draw (\x,\y) +(-.125,-.125) rectangle ++(.125,.125);
\caption{جلسه اول(خانه‌های مشکی حذف شده‌اند.)}

را با تعداد کافی از مهره‌ی

را با تعداد کافی از مهره‌ی 

  • 1
    You should place them closer to where they're referenced... However, I'm not sure I understand the problem exactly.
    – Werner
    Jan 2, 2013 at 7:47
  • 4
    The position of the figure environment does not depend on its contents (tikz in this case) so I think your question is just about floats not about tikz, it's not really clear where you want the figure to appear? In particular if you want it to come at the end of the section can you not just place the figure environment at the end rather than the start? Please always provide complete (small) documents that demonstrate the issue, it is hard to comment on figure positioning just given a fragment. Jan 2, 2013 at 7:53
  • 3
    Your edited question is perhaps less clear than the original. But note you nay refer to a label with \ref before the figure that defines the label, LaTeX will resolve the reference on the second run. Jan 2, 2013 at 8:04
  • 2
    This is too confusing. MWE = Minimum Working Example, not Maximum Working Example. Jan 2, 2013 at 8:21
  • 5
    You seemed to be worried about using labels before they are defined. That is actually not a problem in LaTeX, you just have to compile the file twice. LaTeX achieves this by writing the position of the label to an auxilliary file on the first run and then it reads that file early in the second run. Jan 2, 2013 at 9:24


Browse other questions tagged .