9

Is it possible to hyphenate text without inserting a hyphen.

\documentclass{article}

%\usepackage{courier}
%\usepackage{bera}
%\usepackage{arev}

\begin{document}
\ttfamily\hyphenchar\font=\defaulthyphenchar\relax
LoremipsumdolorsitametconsectetueradipiscingelitAeneancommodo
ligulaegetdolorAeneanmassaCumsociisnatoquepenatibusetmagnisdis
parturientmontesnasceturridiculusmusDonecquamfelisultriciesnec
\end{document}

If I replace \defaulthyphenchar by 255 it works for CM, but not with Bera Mono. So is there a \char number of the word joiner (Unicode U+2060) that works with all fonts?

Tobi
  • 56,353
  • 3
    I only know how to define a hyphenation point manually that does not insert anything: \def\+{\discretionary{}{}{}}. Using \+ gives you such a point but I don't know how to make this work for the automatically generated hyphenation points. – Christian Lindig Feb 21 '12 at 18:39

1 Answers1

5

There is no character in position 255 in Computer Modern Typewriter Type in OT1 encoding. If you add the line

\usepackage[T1]{fontenc}

and replace \defaulthyphenchar with 255, you'll get ß as the "hyphen".

The package bera loads the font in T1 encoding, so you get ß as well.

If the font is OT1 encoded, any number between 128 and 255 (extremes included) will work, as there's no character there; if the font is T1 encoded, you can use (abuse, actually) the "compound word mark", which is in position 23.

egreg
  • 1,121,712