3

I am asking the same question as this post:

How to type a non-breaking hyphen (dash, "-" character) in scientific or technical documents

but I don't want to use any package (just to understand how it may be done in Plain TeX with just the primitives of the language).

\mbox{non-linear}
non\mbox{-}linear

will prevent hyphenation

What about:

non-\nobreak linear

I don't know how to check where the possible break points are in TeX.

2 Answers2

3

your suggested use of \nobreak does not prevent a breeak as can be seen by


\vbox{\hsize=1pt
a
non-\nobreak linear
}

\bye

enter image description here

The first two suggestions with \mbox are not plain TeX, but if you use \hbox they would prevent a break.


\vbox{\hsize=1pt
a
\hbox{non-linear}
non\hbox{-}linear
}

\bye

enter image description here

David Carlisle
  • 757,742
3

With non-\nobreak linear you don't inhibit a line break after the hyphen, unless you specify \exhyphenpenalty=10000 and \nobreak is redundant.

\vbox{\hsize=0pt \parindent=0pt
  \hskip0pt non-\nobreak linear
}
\vbox{\hsize=0pt \parindent=0pt \exhyphenpenalty=10000
  \hskip0pt non-linear
}
\bye

enter image description here

On the other hand, setting \exhyphenpenalty to 10000 seems too drastic and you get no hyphenation in the rest of the word anyway.

\def\nbh{%
  \leavevmode % one never knows
  \hbox{-}% this won't allow a line break
  \nobreak % no line break here
  \hskip0pt % allow hyphenation on the rest of the word
}

\vbox{\hsize=0pt \parindent=0pt \hskip0pt non\nbh linear }

\bye

enter image description here

egreg
  • 1,121,712