TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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.
http://tex.stackexchange.com/questions/16513/page-numbering-with-figures-and-tables
tex.stackexchange.com
crawl=CC-MAIN-2016-30
92628
application/http; msgtype=response
sha1:6RZDB6TLR7GA6O3A3TVX2C732Z53HXRE
<urn:uuid:b90c73ab-bd8f-4142-8ce6-0a150f496e0e>
2016-07-27T21:12:59Z
151.101.129.69
sha1:2PE2V3PKYJ56DZKTMREHH4UUCJMLJDL3
<urn:uuid:4d758f61-d980-4873-95a6-1015c0769f2a>
http://tex.stackexchange.com/questions/16513/page-numbering-with-figures-and-tables
response
<urn:uuid:0761bfdc-9d40-4175-b010-3e1deb3773a6>
robots: classic
hostname: ip-10-185-27-174.ec2.internal
software: Nutch 1.6 (CC)/CC WarcExport 1.0
isPartOf: CC-MAIN-2016-30
operator: CommonCrawl Admin
description: Wide crawl of the web for July 2016
publisher: CommonCrawl
format: WARC File Format 1.0
conformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf