2

My codes are below:

\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}

when I do compilation, LaTeX told the box value is 184.99954pt, but I need to extract the value only, i.e. 184.9954 only, that pt is not required, is this possible?

MadyYuvi
  • 13,693
  • You should use \sbox\fightbox{#1}. Can you please tell why you need the number? – egreg Jan 29 '18 at 12:57
  • @egreg can you share your mail id, so that I'll explain my requirement – MadyYuvi Jan 30 '18 at 04:38
  • @egreg actually I need to automate number of lines to be hang in wrapfigure, so the figure height can detect by auto without pt value, but it didn't accept the values in decimal format, please suggest... – MadyYuvi Jan 30 '18 at 11:00

1 Answers1

2

Use \strip@pt to remove dimensions:

\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}