仅从框而不是 pt 中提取值

仅从框而不是 pt 中提取值

我的代码如下:

\documentclass{book}
\usepackage{graphicx}

\newbox\fightbox
\newcount\fightcount

\newcommand{\test}[1]{
\setbox\fightbox=\vbox{#1}%184.99pt
}

\begin{document}

\test{\includegraphics{./images/c02f001.pdf}}

\showthe\ht\fightbox

Running text

\end{document}

当我进行编译时,LaTeX 告诉框值是184.99954pt,但我只需要提取值,即184.9954仅提取pt不需要的值,这可能吗?

答案1

用于\strip@pt删除尺寸:

\documentclass{book}
\usepackage{graphicx}

\newbox\fightbox
\newcount\fightcount

\newcommand{\test}[1]{
\setbox\fightbox=\vbox{#1}%184.99pt
}

\begin{document}

\test{\includegraphics{example-image}}

\makeatletter
\strip@pt\ht\fightbox
\makeatother

Running text

\end{document}

相关内容