I often find myself copying and pasting large chunks of {figure} and {table} code around my documents, trying to improve the placement of my figures. It's error prone and bit annoying.
I know about the [H] argument for a float environment. Here, I’m not trying to make the float position in the resulting e.g PDF document match exactly the location of my float environment. I just want a simpler way of moving code for floats around my tex file that doesn’t involve copying and pasting big chunks of code around.
I wonder, can it be possible to make some system with new environments and macros, where I can do something like this
\begin{placer}{tag}
\begin{figure}
...
\end{figure}
\end{placer}
My idea is that the new placer environment just captures everything and saves it with a name based on the argument tag.
I then put my figure where I want by using a new macro
\place{tag}
Ideally, it would be possible use \place{tag} before the above code snippet, and still get the desired result. And ideally, it would not rely on writing files or any additional compilation steps. I thinky it would be very nice if by default the float was placed by default at the \begin{placer}{tag} spot if \place{tag} was never called.
Is this kind of system feasible?
If it is, I’d want to go even further. I’d like to redefine the figure and table float environments to automatically cache their contents, as above, and so it could be placed via the place macro as above using some labels.
I could load some package that implemented that and start moving figures and tables around a document by just adding the \place{fig:whatever} commands with the argument corresponding to some tag of the relevant figure. Something like this
\usepackage{placer}
\begin{document}
This is a document with one figure.
\begin{figure}
...
\label{fig:whatever}
\end{figure}
Actually, let’s put the figure code below this text.
\place{fig:whatever}.

Hplacement defined in thefloatpackage, i.e. you like to stop working of float mechanism (on some complicated way). Or I miss understood you? – Zarko Sep 09 '20 at 03:49\place{tag}to have the effect of cutting and pasting the whole figure to that place – innisfree Sep 09 '20 at 04:06\newcommand\foo[2]{\begin{figure}\includegraphics{#1}\caption{#2}\end{figure}}then\foo{mypic}{the caption}?? – David Carlisle Sep 09 '20 at 06:43xifthenboolean. I had to define a new command the way @DavidCarlisle did. – Oleg Lobachev Sep 09 '20 at 08:35\begin{figure}[H]from the float package so all floating is disabled and figures are manually placed. – David Carlisle Sep 09 '20 at 09:55