1

I want to prevent the hyphenation of type-II at the dash. I tried type\nobreakdash-II and mbox as workaround, but

  • this is not very readable in the code and
  • I want to separate layout information from the text where possiple.

How can I configure LuaLaTeX that it should never hyphenate a word at the dash, if less than 3 characters are left in the first or second part?

% Checked the variables:
\the\lefthyphenmin and \the\righthyphenmin 
2 and 3

I wonder why I got a hyphenation type- II while \righthyphenmin is set to 3.

  • 1
    “In the case of plain TeX, empty discretionaries are therefore inserted after hyphens and dashes. (Each font has an associated \hyphenchar, which we can assume for simplicity is equal to ‘-’.)” The TeXbook, page 95. – Henri Menke Apr 24 at 9:36
  • @HenriMenke I see, but what is the consequence? Does this mean type-II has a \hyphenchar inside which overwrites \righthyphenmin? – Jonas Stein Apr 24 at 9:56
  • 1
    No, type-II becomes type-\discrectionary{}{}{}II and for explicit discretionaries word hyphenation limits do not apply. – Henri Menke Apr 24 at 10:00
  • You can insert an explicit kern to suppress the automatic discretionary type-\kern0pt II. – Henri Menke Apr 24 at 10:08
1

One option is to define a more-readable macro \typeII and \TypeII that expand to \mbox or \nobreakdash and prevent hyphenation. You might want to add the xspace package to avoid the need to write \typeII{} or {\TypeII}.

Another is to \usepackage[shortcuts]{extdash}, which allows you to write type\=/II.

Including microtype on LuaLaTeX or PDFLaTeX might help, since font expansion can drastically cut down on the amount of hyphenation.

  • Thank you for the workarounds, but these require to write code instead of content for every case. – Jonas Stein Apr 24 at 8:13
  • @JonasStein There are a few ways to suppress hyphenation, but the only one I can think of that doesn’t involve any code at all would be to load fontspec and insert a look-alike character such as U+2010. – Davislor Apr 24 at 15:42

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.