3

I am suprised that in the code below no hyphenation is done. And I can not find something about that on the web. Maybe I used the wrong words for searching.

\documentclass{scrartcl}
\usepackage{xltxtra}
\usepackage{polyglossia}
\setdefaultlanguage[spelling=new]{german}
\usepackage{tabu}

\begin{document}
\begin{ttfamily}
\begin{tabu} spread \textwidth {X[l]|X[l]|X[l]|X[l]}
    A&
    B&
    Sichtweise, Haltung, Akzeptanz, useability, Anwenderfreundlichkeit&
    D\\
\end{tabu}
\end{ttfamily}
\end{document}

enter image description here

2
  • Does Anwenderfreundlichkeit hyphenate in regular text?
    – Zarko
    Feb 2, 2016 at 15:00
  • 2
    LaTeX doesn't hyphenate typewriter type text
    – egreg
    Feb 2, 2016 at 15:09

2 Answers 2

3

By default, LaTeX doesn't hyphenate typewriter type text.

With fontspec you can revert this decision quite easily, but you have to newly define a monospaced font.

\documentclass{scrartcl}
\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage[spelling=new]{german}

\setmonofont{Latin Modern Mono}[HyphenChar={-}]

\usepackage{tabu}

\begin{document}
\begin{ttfamily}
\begin{tabu} spread \textwidth {X[l]|X[l]|X[l]|X[l]}
    A&
    B&
    Sichtweise, Haltung, Akzeptanz, useability, Anwenderfreundlichkeit&
    D\\
\end{tabu}
\end{ttfamily}
\end{document}

enter image description here

2
  • I don't think that [HyphenChar={-}] is needed, I get a font with hyphenation directly with \setmonofont{Latin Modern Mono}. As far as I can see fontspec sets hyphenchar to -1 only for the default lmtt. Feb 3, 2016 at 9:18
  • @UlrikeFischer Possibly, but I think it's clearer this way. Since legacy monospaced fonts all disable hyphenation, I can't exclude fontspec will do the same in the future.
    – egreg
    Feb 3, 2016 at 10:14
3

This solves the problem.

\usepackage[htt]{hyphenat}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .