20

I have a document with many floats (figures, specifically). I want to be able to change the global floats positioning policy from htbp to just h (or even H with the floats package). For my-own reasons, I don't want to do this by appending the [h] argument to each float env.

One option that I can think of is using a macro:

\newcommand{\mypos}{h} % or htbp
\begin{figure}[\mypos]...

I also prefer not to do that - It is cumbersome.

Is there a way to set the global float positioning argument globally?

  • 3
    If you accept an answer, it would be nice to also upvote it. (This is also true for my answer to your question abour listings and subfigure. ;-)) – lockstep Dec 3 '10 at 12:23
16

Some lines in the preamble should do the trick.

\makeatletter
\renewcommand{\fps@figure}{!ht}
\renewcommand{\fps@table}{!ht}
\makeatother
7

You may use the floatrow package and its \floatplacement macro:

\usepackage{floatrow}
\floatplacement{figure}{!ht}
\floatplacement{table}{!ht}

Example:

\documentclass{article}

\usepackage{floatrow}
\floatplacement{figure}{!ht}

\usepackage{lipsum}

\begin{document}

\lipsum[1]

\begin{figure}
% \centering% default with "floatrow"
\rule{1cm}{1cm}
\caption{A figure}
\end{figure}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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