It know that I can prevent hyphenation of a whole word with \nohyphens, but how to avoid hyphenation at a character like _ (\_ in the source). \nohyphens doesn't even seem to work for _\.

I'm looking for any solution, i.e. one which excludes the character for hyphenation for the whole document or a command which I can apply on every occurance of \_ - the first approach is preferred.

  • 2
    by default you wpn't get hyphenation at \_ so you should (as always) give an example document showing the problem, but in general in classic tex or xetex you can prevent hyphenation at a character x by giving x a non zero lower case code (that prevents it being considered part of a word, so changes all the hyphenation not just at that letter – David Carlisle Sep 7 '17 at 6:51
  • It would be nice to have an example to see the real problem and give the proper solution, but I guess that \mbox{xxxx\_xxxx} should work. – Fran Sep 7 '17 at 7:57
  • @Fran \mbox{xxxx\_xxxx} works, thank you. I realialize that the question isn't good, I'll improve it as soon as I find the time. If you post an answer (somehow working around the missing explanation in the question), I'll accept it. – Karl Richter Sep 7 '17 at 14:40

Your Answer

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

Browse other questions tagged or ask your own question.