The question is a follow-up to this one. Background color for all existing floats
I hope to save the generated yellow background box location information to a new TXT file, as the floating element location annotation information.
As shown in the code below, I have made some preliminary attempts to save location information. After compiling the following code twice, a txt file will be generated in the current file directory. It records the generated coordinate information, but this code generates only the coordinates of the lower left corner, and I need to generate the label of the entire box, which means I also need the information of the height and width of the box. I know that the width of the box is textwidth or columnwidth, how to get the height of the frame?
\documentclass[11pt,a4paper,twocolumn,english]{article}
\usepackage{xcolor}
\usepackage[savepos]{zref}
\newwrite\myoutfile
\immediate\openout\myoutfile=\jobname-myoutfile.txt
\newcounter{mycounter}
\setcounter{mycounter}{1}
\makeatletter
\newif\iffloat@twocolumn
% redefine @dblfloat
\def@dblfloat{%
\if@twocolumn
\let\reserved@a@dbflt
\float@twocolumntrue
\else
\let\reserved@a@float
\fi
\reserved@a}
% based on https://tex.stackexchange.com/a/106906
% added \iffloat@twocolumn ... \else ... \fi
\def\foo#1\normalcolor\vbox\bgroup#2!!{%
\def@xfloat ##1[##2]{#1%
\normalcolor
\hbox\bgroup{%
\color{yellow}%
\zsavepos{\themycounter}%
\iffloat@twocolumn
\leaders\vrule\hskip\textwidth\hskip-\textwidth%
\immediate\write\myoutfile{"image",\the\dimexpr\zposx{\themycounter}sp\relax, \the\dimexpr\zposy{\themycounter}sp\relax}%
\else
\leaders\vrule\hskip\columnwidth\hskip-\columnwidth%
\immediate\write\myoutfile{"image",\the\dimexpr\zposx{\themycounter}sp\relax, \the\dimexpr\zposy{\themycounter}sp\relax}%
\fi}%
\vbox \bgroup\aftergroup\egroup
\label{\themycounter}
\stepcounter{mycounter}%
#2}}
\expandafter\foo@xfloat{#1}[#2]!!
\makeatother
\title{Two column document with figure underneath title}
\author{abhijit8}
\begin{document}
\maketitle
\begin{table}[h]
\small
\centering
\caption{Simuleringsresultat av beräkning av $\pi$ genom Monte Carlo.}
\begin{tabular}{|p{2.1cm}|p{2.1cm}|p{2.1cm}|p{2.1cm}|p{2.1cm}|p{2.1cm}|p{2.1cm}| }
\hline
\multicolumn{3}{|c|}{En beräkning av $\pi$ genom Monte Carlo} \
\hline
Antal \linebreak partiklar & Värde 1 & Värde 2 \
\hline
$10^0$ & 4 & 4 \
$10^1$ & 3,2 & 2,4 \
$10^2$ & 3,56 & 2,92 \
$10^3$ & 3,208 & 3,160 \
$10^4$ & 3,1404 & 3,1288 \
$10^5$ & 3,13468 & 3,14724 \
$10^6$ & 3,14286 & 3,146348 \
$10^7$ & 3,1421208 & 3,141374 \
$10^8$ & 3,14138248 & 3,14127896\
$10^9$ & 3,1416602762 & 3,1415840040 \
\hline
\multicolumn{3}{|c|}{$\pi = 3.1415926535 $ } \
\hline
\end{tabular}
\end{table}
\begin{table}[h]
\small
\centering
\caption{Simuleringsresultat av beräkning av $\pi$ genom Monte Carlo.}
\begin{tabular}{|p{2.1cm}|p{2.1cm}|p{2.1cm}|p{2.1cm}|p{2.1cm}|p{2.1cm}|p{2.1cm}| }
\hline
\multicolumn{6}{|c|}{En beräkning av $\pi$ genom Monte Carlo} \
\hline
Antal \linebreak partiklar & Värde 1 & Värde 2 & Värde 3 & Värde 4 & Värde 5\
\hline
$10^0$ & 4 & 4 & 4 & 4 & 0 \
$10^1$ & 3,2 & 2,4 & 4,0 & 3,6 & 3,6 \
$10^2$ & 3,56 & 2,92 & 3,32 & 3,04 & 3,36 \
$10^3$ & 3,208 & 3,160 & 3,108 & 3,136 & 3,136 \
$10^4$ & 3,1404 & 3,1288 & 3,1460 & 3,1572 & 3,1308 \
$10^5$ & 3,13468 & 3,14724 & 3,14316 & 3,14124 & 3,14248\
$10^6$ & 3,14286 & 3,146348 & 3,142648 & 3,141184 & 3,142144 \
$10^7$ & 3,1421208 & 3,141374 & 3,1414892 & 3,1413988 & 3,1416936 \
$10^8$ & 3,14138248 & 3,14127896 & 3,14172908 & 3,14154640 & 3,14178604\
$10^9$ & 3,1416602762 & 3,1415840040 & 3,1415684520 & 3,1415948080 & 3,1416119840\
\hline
\multicolumn{6}{|c|}{$\pi = 3.1415926535 $ } \
\hline
\end{tabular}
\end{table}
\end{document}
The following picture is a visual explanation of my needs,In general, I just want to know the height of the background generated by the code \makeatletter ... \makeatother.
