I run into this rather strange problem when using TikZ with LyX 2. I have this graph programmed using TikZ, and it is supposed to follow a paragraph of text and be positioned at the top of next new page. Instead, it is positioned exactly at the center of the new page, leaving a chunk of space between the text and itself. In my document, I place the tex code for the figure immediately after the text itself with a space, and the TikZ code is as follows.

    \begin{tikzpicture} [label distance=2mm,
        vertice/.style={circle, fill=gray!30, thick, inner sep=0pt, minimum size=7mm},
        dot/.style={shape=circle, fill=black, minimum size=2pt, inner sep=0pt, outer sep=2pt}]
        \node [vertice] (a) at (0,7) {$t_1$};
        \node [vertice] (b) at (0,6) {$t_2$};
        \node [vertice] (c) at (0,5) {$t_3$};
        \node [dot] (d) at ($(c) + (270:1)$) {};
        \node [dot] (e) at ($(d) + (270:0.5)$) {};
        \node [dot] (f) at ($(e) + (270:0.5)$) {};
        \node[draw, ellipse, label=below:$T$, fit=(a) (b) (c) (d) (e) (f)] {};\node [vertice] (h) at (5,7) {$a_1$};
        \node [vertice] (i) at (5,6) {$a_2$};
        \node [vertice] (j) at (5,5) {$a_3$};
        \node [dot] (k) at ($(j) + (270:1)$) {};
        \node [dot] (l) at ($(k) + (270:0.5)$) {};
        \node [dot] (m) at ($(l) + (270:0.5)$) {};
        \node[draw, ellipse, label=below:$A$, fit=(h) (i) (j) (k) (l) (m)] {};

        \path (h) edge [-stealth, auto, swap] node {$w_1$} (a)
                  edge [-stealth, auto] node[below, sloped] {$w_2$} (e)
            (i) edge [-stealth, auto, swap] node {$w_3$} (b)
            (j) edge [-stealth, auto] node[below, sloped] {$w_4$} (a)
                  edge [-stealth, auto] node[above, sloped] {...} (f)
              (k) edge [-stealth, auto] node[above, sloped] {...} (c)
              (l) edge [-stealth, auto] node[below, sloped] {...} (d)
              (m) edge [-stealth, auto] node {...} (f);
    \caption{A graph $G$}

Any suggestion how it can be fixed?

I am using Springer LNCS document class, if that makes any difference.

closed as too localized by Jake, Joseph Wright Dec 9 '11 at 10:09

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    Does the page with the figure happen to be the very last page by any chance? I think once you add additional text, things will work fine. Also, please always post a fully compilable MWE that illustrates the problem including the \documentclass and all the appropriate packages. – Peter Grill Dec 5 '11 at 2:08
  • 2
    I try your code with svmult.cls of springer without problem. I place the figure between two \lipsum. You need to give us a real MWE that illustrates the problem. – Alain Matthes Dec 5 '11 at 6:35
  • 1
    I removed the "thanks" from your question. This is just the style here, intended to keep the questions neat. Thanks is best expressed as upvoting answers that help you. In addition, your question is unlikely to be solved without the MWE. Please provide it for us so we can find a solution without having to guess what packages and macros you're using. – qubyte Dec 5 '11 at 15:06
  • hey guys, apologies for not supplying a MWE for this one. It turns out Peter Grill is right that once additional text is added after the figure, the problem fixes itself. So there wasn't actually a problem with my document or the Tikz figure. Thanks. – Skyork Dec 5 '11 at 20:58
  • @PeterGrill, just out of curiosity, how to make a figure align at the top of a new page if the figure just happens to be the only thing on the very last page? – Skyork Dec 5 '11 at 21:00

If the figure happens to be on the very last page with no text following it it is centered as illustrated by the MWE below (if you comment out the \setlength line).

As per Vertical layout of float pages the values that control the distances between floats are:

\@fptop defines the distance from the top of the page to the top of the first float,

\@fpsep defines the separation between floats, and

\@fpbot defines the distance from the bottom of the last float on the page to the bottom of the page.

and the default values are:

\@fptop = 0pt + 1fil
\@fpsep = 8pt + 2fil
\@fpbot = 0pt + 1fil

So, setting \@fptop to something without the 1fill, achieves the desired result.

\usepackage[demo]{graphicx}% Remove [demo] option in real use

\makeatletter% Set distance from top of page to first float

    \caption{A graph $G$}
  • This is an answer to the extension of my original question (see comments above). Thanks! – Skyork Dec 6 '11 at 15:56

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