11

The publisher requires that most of short words (shorter then 4 chars, and all the prepositions, etc.) should not be left last on the line but kept with the following word.

Wrong:

Following the last theorem, we
can see that ...

Right:

Following the last theorem, 
we can see that ...

Yes I can use sed to replace such spaces with ~ but that's not right a solutionas it will affect math.

P.S. We are using a standard extbook class. Thanks in advance.

saabeilin
  • 213
  • You might also be interested in handling hyphenations. – Stephen Dec 17 '12 at 19:26
  • Good, I just thought that there might have been some rule regarding the minimal number of letters before/after a hyphenation, in which case Egreg's linked answer would have been helpful. Anyway, maybe somebody else looking at your question can be helped by Egreg's answer to the other question. – Stephen Dec 17 '12 at 19:48

1 Answers1

7

I don't think a pure TeX solution is feasible (luatex might be possible).

If you can not accurately spot your math markup using sed/perl etc You could insert \shortwordspace rather than ~ directly and then define

 \protected\def\shortwordspace{\ifmmode\else~\fi}

so it does nothing in math mode.

David Carlisle
  • 757,742