0

This question already has an answer here:

Sometimes it's more convenient to have fixed floats during document creation (for ex. when copying from multiple MS Word documents) so as to not get lost and then at the end to be able to "release" them.

My question is: "How to achieve this without needing to replace every H specification of a float with ht! manually at the end of work (presuming you use float package and its' H specification for a float when writing the document)."

My try so far was to load float package and define two new commands.

\usepackage{float}
\newcommand{\floatingfloat}{\text{ht!}}
\newcommand{\fixedfloat}{\text{H}}

\begin{document}
    \begin{table}[\fixedfloat]
    \caption {Some caption.}
    \label{tab:1}  
    \begin{center}
    \begin{tabular}{@{}rl@{}}
        \toprule
        Numbers & More umbers
        \midrule
        1 & 5 \\
        2 & 8 \\
        6 & 3 \\
        \bottomrule
    \end{tabular}
    \end{center}
    \end{table}
\end{document}

This, however, returns an error: "Unknown float option ..."

Any help will be greatly appreciated!

marked as duplicate by user36296, Mensch, Stefan Pinnow, Zarko, GuM May 7 '17 at 22:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    See if \def\fps@figure{H} in preamble (between \makeatletter and \makeatother) can help you . After then (on the end) you can replace it with \def\fps@figure{!htp} – Zarko May 7 '17 at 21:48
  • Thank you, both. I will, however, answer this question for the sake of simplicity and perhaps a more intuitive title. – KeVal May 7 '17 at 22:27
0

As @Zarko and @samcarter pointed out there is a simple way of doing this:

\usepackage{float}
\makeatletter
\def\fps@figure{H}
\def\fps@table{H}
\makeatother

\begin{document}

    \begin{table}
        \caption {Some caption.}
        \label{tab:1}  
        \begin{center}
        \begin{tabular}{@{}rl@{}}
            .
            .
        \end{tabular}
        \end{center}
    \end{table}

    \begin{figure}
        \centering
        \includegraphics[width=10cm]{"path"}
        \caption{Some caption.}
        \label{fig:1}
    \end{figure}

\end{document}

During the actual document creation, we have to add the 5 lines in the preamble: usepackage{float}, \makeatletter ... to make floats "fixed". Then at the end we just replace the H with ht! or another position specification and recompile to have "floating" floats again.

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