# [texhax] checking if a piece of text stays on one line or more than one line

Mon Oct 10 12:40:46 CEST 2011

On Mon, Oct 10, 2011 at 08:34:22PM +1100, Vafa Khalighi wrote:

> Suppose you create a macro similar to \mytextbf, is there a way that you can
> check if the text inside \mytextbf will stay on one line or more than one
> (if the text inside \textbf statys on just one line do something , but if
> stays on more than one line do something else). I guess this is a bit tricky
> because:
>
> 1) you could have shorter or longer lines
>
> 2) you might start using \textbf at the middle or realy end of a specific
> line
>
> So is this checking doable?

Project zref, package zref-savepos.
It uses \pdfsavepos from pdfTeX/LuaTeX/XeTeX (works independent from mode).

Yours sincerely
Heiko Oberdiek