# A tip for latex table, Create LaTex table online!

I found a pretty awesome tool that can create a LaTex table with an intuitive interface (like excel table). What all you need to do is filling a table and generate code. Of course copy and paste.

It also tells you which packages are required depending on your table design. My case, I need to use multirow package and it works like charm!.

Here is the link and enjoy.

http://www.tablesgenerator.com/#

# Putting a page number in Latex.

In order to put a page number,

\pagenumbering{arabic}
\pagestyle{plain}

This will put just a plain page number for each page.

More fancy functions are also supported and you can find them from the following links.

http://timmurphy.org/2009/06/29/latex-page-numbering/

http://www.personal.ceu.hu/tex/pagestyl.htm

If a page number is too close of your text, then use the following script.

\pagestyle{fancy}

\cfoot{\vspace*{1.5\baselineskip}\thepage}

# A tip for floating figures and table in latex. How to deal with them?

You may often experience floating figures or tables whilst using Latex. It’s a right behaviour of Latex since your attempt don’t fit well to Latex’s taste. Figures are maybe bigger than space left and Latex can’t split them up.

In this case, I found quite useful site:

http://www.staff.science.uu.nl/~oostr102/floats/node1.htm

Hope this helps someone who is suffering from floating figures.

# Float placement

Floats are page elements that float with respect to the rest of the document. Standard floats are tables and figures, but with the float package you can easily make new ones, like algorithms. Most of the time floats work satisfactory, but sometimes LaTeX seems too stubborn to do what you want. This section describes how you can influence LaTeX so that it will do most of the time what you want. There might, however be some pathological cases where it is impossible to convince LaTeX to do things your way. In the following we will use figures as an example but everything applies to other floats as well.

The most encountered problems with floats are:

1. You want a float at a certain position in the text, but LaTeX moves it, usually to the next page.
2. From a certain point, LaTeX moves all your floats to the end of the document or the end of a chapter.
3. LaTeX complains about “Too many floats”.

In the first two cases you must first check if you have given the correct “placement” parameter to you float, e.g. \begin\{figure\}[htp] specifies that your figure may be placed either: Here (i.e. in the text position where the command is given), on the Top of a page (which may be the page where you put the command), or on a separate Page of floats. You could also have specified “b” for Bottom of the page. The order of the letters is insignificant, you cannot force LaTeX to try Bottom first and then Top by specifying [bt].

If LaTeX doesn’t put the float at the place where you expected it, it is usually caused by the following:

1. The float didn’t fit on the page. In this case it has to move to the next page or even further. If you didn’t specify either [t] or [b] in the position parameter, LaTeX must save it until it has enough for a page of floats. So don’t specify only [h]. If you want to give LaTeX a chance to put the float on a page of floats, you must also specify “p”.
2. The placement would violate the constraints imposed by LaTeX’s float placement parameters. This is one of the most occurring causes and it can easily be corrected by changing the parameters. Here is a list of them:

topfraction bottomfraction textfraction floatpagefraction

There are also some others for double column floats in two-column documents.

The values in the righthand column are the defaults for the standard LaTeX classes. Other classes could use different defaults. As you see with the default values a float will not be put in the bottom of a page if its height is more than 30% of the page height. So if you specify [hb] for a float which is taller it has to move to a float page. But if it is less than 50% of the page height it will have to wait until some more floats are given before a float page can be filled to satisfy the \floatpagefraction parameter. If you have this kind of behaviour you can easily adapt the parameters, e.g. with:

\renewcommand{\textfraction}{0.05}
\renewcommand{\topfraction}{0.95}
\renewcommand{\bottomfraction}{0.95}
\renewcommand{\floatpagefraction}{0.35}
\setcounter{totalnumber}{5}


You may want to be careful not to make \floatpagefraction too small, otherwise you may get too many small floatpages.

You can force LaTeX to ignore most of the parameters for one specific float occurrence by including an exclamation mark (!) in the placement parameters, e.g.

\begin{figure}[!htb]


Floats which contain a “t” in the position parameter could be placed before the place where they are referenced (but on the same page). This is normal behaviour for LaTeX but some people just don’t like it. There are a number of ways to prevent this:

1. Of course deleting the “t” will help, but in general this is undesirable, as you may want the float to be placed at the top of the next page.
2. use the flafter package which causes floats never to be placed “backwards”.
3. use the command \suppressfloats[t]. This command will cause floats for the top position on this page to be moved to the next page. This can also be done with [b] or without parameter for all floats on this page.

If in spite of all your attempts LaTeX still moves your floats to the end of the document or the end of a chapter, you can insert a \clearpage command. This will start a new page and insert all pending floats before continueing. If it is undesirable to have a pagebreak you can use the afterpage package and the following command:

\afterpage{\clearpage}


This will wait until the current page is finished and then flush all outstanding floats. In some pathological circumstances afterpage may give strange results, however.

Finally, if you want a float only at the place where you define it, without LaTeX moving it whatsoever, you can use the float package and give the command:

\restylefloat{figure}


in the preamble. Now you will be able to specify [H] as the position parameter, which will mean “HERE and only HERE”. This may cause an unwanted page break however. If you want to avoid the unwanted pagebreak, i.e. let LaTeX move the float only if it doesn’t fit on the page, the use the afterpage package with:

\afterpage{\clearpage \begin{figure}[H] ... \end{figure}}


Complaints from LaTeX about “Too many floats” are usually caused by one of the above problems: floats not being able to be placed and LaTeX collecting too many of them. The solutions given above, especially those with \clearpage in them will usually help. In some cases there really are too many floats, as LaTeX has a limited number of “boxes” to store the floats. The package morefloats can be used to increase this number. If you need still more then you must edit a private copy of this file, but even then there will be some limit that you cannot pass. Then your only resort will be to change your document.