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.

I'm having a bit of trouble with my LaTeX document. I've been writing quite a bit, and have a few images and a table that I'm referring to.

My first problem is, that I have some text, then image, then text, then image, some more text and then my table. When I compile the whole thing it displays like: text, text, text, image, image, table. For my images I use the [htbp!] thing, which (as far as I understand) should display the image right where the text is..

My other problem is, that on the page with the two figures (which by the way is a separate page), my page numbering disappears. I doesn't show in my page footer like it does on all other pages..

My footer is as follows form my preamble:

\fancypagestyle{plain}{\fancyfoot[C]{\thepage\ af \pageref{LastPage}}}
\fancyhf{}
\pagestyle{fancy}

I display my images like this:

\begin{figure}[htbp!]
    \begin{center}
        \includegraphics[width=0.7\textwidth]{skitse-salg}
        \caption{Skitse over menuen hvori man søger}
        \label{fig:skitse-salg}
    \end{center}
\end{figure}

Finaly my table is made as follows:

\begin{center}
\begin{table}
  \begin{tabular}{ | l | l | l | }
    \hline
    \textbf{Afsnit} & \textbf{Side} & \textbf{Funktion} \\ \hline
    1 & 2 & 3 \\ \hline
    4 & 5 & 6 \\ \hline
  \end{tabular}
  \caption{Tabel over de grafiske klasser, hvor i dokumentet de kan findes og hvad deres funktion er.}
  \label{table:gui-klasser}
  \end{table}
\end{center}

A little help would be much appreciated :-)

share|improve this question
1  
In short, [htbp!] doesn't mean "HERE!" but "here, if possible". With regard to the missing page number, I can only guess (because you didn't provide a minimal working example) that \fancypagestyle{fancy} (not plain!) fiddles with \iffloatpage. –  lockstep Apr 24 '11 at 20:03
    
See How can I get the figures not to be pushed to the end of the document? and the questions linked there (on the lower right side on the sidebar). –  Martin Scharrer Apr 24 '11 at 20:30
    
I found this linke usefull: latex-community.org/forum/viewtopic.php?f=47&t=7822#p30422 worked like a charm.. –  Simon Apr 24 '11 at 20:35
    
Don't put the table environment inside a center; rather use \centering just after \begin{table} –  egreg Apr 24 '11 at 22:03
    
As for why you should use \centering instead of \begin{center}, see this question. –  lockstep Apr 24 '11 at 22:24

3 Answers 3

up vote 1 down vote accepted

I can answer your question regarding the placement. Get rid of the t, p and b. Just put [!h] and that should place the float on the exact location. If you put t, p or b LaTeX considers then as other options you're likely to be happy with.

share|improve this answer
    
I'll remember that.. For this I just ended up using wrapfigure in stead.. Worked like a charm ;-) –  Simon Apr 25 '11 at 15:42

With regard to your second question (page numbers disappearing on any page that contains only floats): fancyhdr (which, according to your code snippets, you are using) features the \iffloatpage macro which allows to customize the header and footer depending on whether the current page is a "float page" or not. Check your settings of the fancy pagestyle (not the plain style!) and, if you want the "standard" header and footer on float pages, replace \iffloatpage{}{<whatever>} with <whatever>.

share|improve this answer

htbp means place the float here if possible, otherwise place it on the top if possible, otherwise bottom if possible, ..., Generally I prefer ht, for personal typographical taste. Note that the order of the specifiers are irrelevant. See chapter 6 of The LaTeX Companion. The ! specifier cause LaTeX to ignore most restriction on the floats placement, described below.

It seems in your situation that the figures are too large to be placed in normal page. Since LaTeX, by default, allows a float to occupy at most 70% of the text body if it is on top, and 30% for bottom, in addition, for floats and texts to be placed in the same page, (a normal page), the text has to occupy at least 20% area. These parameters can be changed by \def \topfraction, \bottomfraction and \textfraction respectively.

Personally I don't courage the use !h to force placement of floats. Instead, use package like afterpage, placeins, etc to make sure that the placement of the floats are not too far away from the text they belong to.

However, floating control is one of the weaknesses of LaTeX.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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