[LaTeX] Optional parameters explained for fine tuning the placement of tables and figures in LaTeX

This post introduces the optional parameters to fine tune the placement of tables and figures in LaTeX.

If you are using LaTeX, you have seen figure examples like the following


These are optional parameters to fine tune the placement of tables and figures, the term is Float placement specifiers (introduced in detail below). LaTeX will try to honor the placement with respect to the actual place, the top or bottom of the page, or a separate page of floats coming immediately after the present insertion point.

Float placement specifiers

To direct a float to be placed into one of these areas, a float placement specifier has to be provided as an optional argument to the float.

If no such optional argument is given then a default placement specifier is used, which depends on the float class. Each float in LaTeX belongs to a class. By default, LaTeX knows about two classes,figureand table. A float placement specifier can contain the following characters in any order and combination:

  • ! — indicates that some restrictions should be ignored 
  • h — indicates that the float is allowed to be placed inline (i.e., here)
  • t — indicates that the float is allowed to go into a top area
  • b — indicates that the float is allowed to go into a bottom area
  • p — indicates the the float is allowed to go on a float page or column area

The order in which these characters are stated does NOT influence how the algorithm tries to place the float (e.g., [ht] or [th] will make no difference)! This is one of the common misunderstandings, for instance when people think that bt means that the bottom area should be tried first. You may also force LaTeX to “insist” on these specifications by adding an exclamation mark (!) before the placement parameters, e.g. \begin{figure}[!htb].

However, if a letter is not present then the corresponding area will not be tried at all.

For more detailed intro about this topic, check out How to influence the position of float environments like figure and table in LaTeX?




How to remove the double quotes in a CSV file on Ubuntu

This post introduces the simplest way to remove all double quotes in a csv file on Ubuntu (via terminal).

If you have a CSV file like


and want something like


Or you have something like this

and want something like this

In your terminal,

cd to the directory where input.csv file is located and then issue the following command:

$ tr -d '"' <input.csv> output.csv

Note: tr stands for translateThe d flag causes tr command to delete all tokens of the specified set of characters from its input.  


8 Linux TR Command Examples (pdf)

tr (Unix)