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?

  • 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 4: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
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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.