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

  • Does Anwenderfreundlichkeit hyphenate in regular text? – Zarko Feb 2 '16 at 15:00
  • 2
    LaTeX doesn't hyphenate typewriter type text – egreg Feb 2 '16 at 15:09
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

  • 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. – Ulrike Fischer Feb 3 '16 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 '16 at 10:14
3

This solves the problem.

\usepackage[htt]{hyphenat}

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.