単位なしの長さの数値を取得するにはどうすればよいでしょうか?

単位なしの長さの数値を取得するにはどうすればよいでしょうか?

ページのサイズに関連する寸法のボックスを描画しようとしています。ボックスの高さと幅は\length、長さの単位を含む用語で計算できます (例: 55.5pt)。ただし、環境でボックスを描画しようとすると、pictureサイズの用語は単なる数字になります (例: 55.5)。単位付きの長さを単純な数字に変換するにはどうすればよいでしょうか。以下は、私が実行しようとしている例ですが、引数のマクロ\textwidthのようにマクロで失敗しています。\framebox\put

% borderprob.tex  SE 559677
\documentclass{memoir}
\usepackage{lipsum}

\newlength{\bmargin}
\setlength{\bmargin}{2cm}

\newlength{\bwidth} \setlength{\bwidth}{\paperwidth} 
  \addtolength{\bwidth}{-\bmargin}
\newlength{\bheight} \setlength{\bheight}{\paperheight} 
  \addtolength{\bheight}{-\bmargin}


\newcommand{\borderbox}{\put(0,0){\framebox(\textwidth,-\textheight)}{}}
%\renewcommand{\borderbox}{\put(0,0){BORDERBOX}}
%\renewcommand{\borderbox}{\put(0,0){\framebox(20,30)}{}}
%\renewcommand{\borderbox}{\put(0,0){\framebox({\bwidth},{\bheight})}{}}
%\renewcommand{\borderbox}{\put(0,0){\framebox(20,\bheight)}{}}
%\renewcommand{\borderbox}{\put(0,0){\framebox(\bwidth,30)}{}}
%\renewcommand{\borderbox}{\put(0,0){\framebox(20,30)}{}}

\begin{document}

% length values
\verb!\bmargin = ! \the\bmargin

\verb!\paperwidth = ! \the\paperwidth{}
\verb!\bwidth = ! \the\bwidth

\verb!\paperheight = ! \the\paperheight{}
\verb!\bheight = ! \the\bheight

% draw a box
\begin{picture}(0,0) \borderbox \end{picture}

\lipsum

\lipsum

\end{document}

答え1

次のリリース (LaTeX2e 2020-10-01) では、picture 環境で長さを使用できるようになりますが、現時点では、 を追加して、必要な長さを\usepackage{picture}使用できます。\put(\bmargin,10cm)

関連情報