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

Vafa Khalighi vafaklg at gmail.com
Tue Oct 11 11:52:57 CEST 2011

Thanks heaps. This is what I tried but still the color range is wrong. I am
using xecolor which uses xetex font color feature so it has no problem in

On Tue, Oct 11, 2011 at 8:02 PM, Heiko Oberdiek <
heiko.oberdiek at googlemail.com> wrote:

> On Tue, Oct 11, 2011 at 07:40:27PM +1100, Vafa Khalighi wrote:
> > This is wonderful. I still do not know why it is not working for right to
> > left text but I will investigate that. I have another question:
> You have to change the test for the horizontal x-position.
> How it can be tested, whether the current text mode is
> right to left or left to right?
> > Now suppose that we test the argument of \mytextbf and our test shows
> that
> > the text inside \mytextbf stays on more than one line, in this condition,
> > would it be possible to automatically insert
> >
> > 1) \foo at beginning of \mytextbf
> > 4)\foot at the end of \mytextbf
> Yes, both easy, change the line with \textcolor{red} to your needs:
>  \textcolor{red}{#1} => \foo#1\foo
> > 3)\foo at the beginning of each line
> > 2) \foo at the end of each line
> No. Then you have to use LuaTeX that allows the modification of
> node lists even after typesetting (assuming \foo does not change,
> how the lines are broken across lines).
> Maybe yes, but expensive. Look at soul, it can split a text
> in unbreakable portions (at hyphenation points). Then you have
> to add labels for *each* portion. Then you have the positions of
> the portions and know, where a line starts and ends.
>  This may work (within the limitations of package `soul',
> see its documentation) with small texts. But for larger uses,
> keep in mind that the hash table in TeX is limited.
> Yours sincerely
>  Heiko Oberdiek
> _______________________________________________
> TeX FAQ: http://www.tex.ac.uk/faq
> Mailing list archives: http://tug.org/pipermail/texhax/
> More links: http://tug.org/begin.html
> Automated subscription management: http://tug.org/mailman/listinfo/texhax
> Human mailing list managers: postmaster at tug.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texhax/attachments/20111011/4033f338/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.tex
Type: application/x-tex
Size: 1039 bytes
Desc: not available
URL: <http://tug.org/pipermail/texhax/attachments/20111011/4033f338/attachment-0001.tex>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.pdf
Type: application/pdf
Size: 11098 bytes
Desc: not available
URL: <http://tug.org/pipermail/texhax/attachments/20111011/4033f338/attachment-0001.pdf>

More information about the texhax mailing list