如何仅测量节点之间距离的水平分量?

如何仅测量节点之间距离的水平分量?

我正在尝试建立线条来显示页面的几何形状。我只想测量current page text area.west和之间的水平分量current page.west。显示距离的线条应current page text area.west current page以水平方式连接,如图所示

在此处输入图片描述

\documentclass{elsarticle}

\usepackage{tikz,tikzpagenodes}
\usetikzlibrary{calc,arrows.meta}

\newlength{\widthpageframe}
\setlength{\widthpageframe}{0.1mm}
\newcommand{\opacitypageframe}{0.1}
\newcommand{\pageframeMainText}[2]{%c
    \tikz[remember picture,overlay] {
        
        \draw [color=gray, line width=#1, opacity=#2]
        (current page text area.south west)
        rectangle
        (current page text area.north east);
        
    }
}

\begin{document}
    
    \pageframeMainText{\widthpageframe}{\opacitypageframe}
    
    \begin{tikzpicture}[remember picture,overlay, arrows={Latex[length=11pt]}-{Latex[length=11pt]}]
        \draw[] let \p1 = ($(current page.west) - (current page text area.west)$), \n1={veclen(\x1,\y1)} in (current page.west) --  node[above, sloped] {\n1} (current page text area.west);
    \end{tikzpicture}
    
\end{document}

相关内容