Command to check the amount of horizontal space

Please, this is very important because I depend on it to finish my master's dissertation. So, I looked everywhere for an answer, but I could not find it..

Basically, I want to know if there is any command that print in the document how much horizontal space exist(pt, in, cm, etc) at the point where the command was issued. For example, in the next figure, i would like to know how long is the red line:

Enter

\documentclass{memoir}
\usepackage{multicol}       % Suporte a mesclagens em colunas
\usepackage{multirow}       % Suporte a mesclagens em linhas
\usepackage{float}          % Fixa tabelas e figuras no local exato
\usepackage{array}
\usepackage{tabularx}
\usepackage{ltablex}
\usepackage{ragged2e}       % also allows hyphenation
\usepackage{booktabs}       % get "good" rules in tables
% Use it's \toprule, \midrule and \bottomrule.
\usepackage{siunitx}        % Handle numerical value nicely,for aligning on
% the decimal point
\usepackage{amsmath,environ}
\usepackage{blindtext}

\usepackage[left=30mm,top=30mm,right=20mm,bottom=20mm]{geometry}

\NewEnviron{variables}{%
\begin{tabularx}{\textwidth}[t]{%
|>{${}} l <{{}$}  @{${}:\enspace{}$}%
>{\raggedright\arraybackslash}  X   <{}     %
>{\raggedright\arraybackslash{}(}   l   <{)}| %
>{\raggedright\arraybackslash}  X   <{}
}%
\BODY
\end{tabularx}
}

\begin{document}

\blindtext

\begin{variables}
1   & 1& 1\\
2   & yield stress\\
3   & plastic viscosity \\
4   & shear rate
\end{variables}

\blindtext

\end{document}

• Welcome to TeX.SX! The first thing I can think of is the savepos module of the zref package. Read section 3,13 of the documentation of the zref package. – GuM Aug 9 '19 at 15:31
• it looks like a numbered "equation". right? – user187802 Aug 9 '19 at 15:32
• By default text comes at the left margin so rather than adding the space and removing it it would be better not to add it. But you have given no indication of how you added the space so it is hard to help – David Carlisle Aug 9 '19 at 16:05
• @GuM Once I saw a command that does that, but I'm unable to remember, it is very simply. I will check the zref package – Victor Verga Aug 9 '19 at 16:24
• @DavidCarlisle In this case the ltablex package does that to the xtabular table showed. I hope to use the command in other issues as well – Victor Verga Aug 9 '19 at 16:27

I can't really recommend ltablex it has some slightly strange effects on tables, however it provides a command \keepXColumns which if you add anywhere in the preamble after \usepackage{ltablex} keeps tabularx being closer to its original definition and produces the output: