3

i have the problem that the Hyphenation ist nor working correctly when i have loaded the Font Times New Roman.

I'm using LuaLaTex and here you can see my MWE:

\documentclass[%
a4paper,
12pt,
DIV=calc,
oneside,
parskip=half                
]
{scrreprt}

\usepackage[a4paper, left=3cm, right=2.5cm, top=2.5cm, bottom=2.5cm, includefoot]{geometry}

\usepackage{fontspec}
\usepackage{polyglossia}

\setdefaultlanguage{german}
\setmainfont{Times New Roman}

\begin{document}
Ligatures: fi fl ffl
whitespace Keynesian dwarfish calflike wolffish rufflike rooftop  \\ \\
Für die Autorisierung und Zugriffsverwaltung innerhalb und gegenüber dem X.500-Verzeichnisdienst wurden X.509-Zertifikate definiert, deren Zertifikatssyntax als \textit{Abstract Syntax Notation One} (ASN.1) bezeichnet wird.  Detailliertere Informationen zu ASN.1 sind zu entnehmen.
\end{document}

I tried also adding \hyphenation{X.500=Ver-zeich-nis-dienst} before \begin{document} but has no effect.

When i run the example without the command \setmainfont{Times New Roman} or use instead Times New Roman the Font Trebuchet MS, it is working fine.

So could this be a problem with the Times New Roman Font? Or where is the problem?

Opa114
  • 437

2 Answers2

4

LaTeX normally doesn't hyphenate a "word" which has a hyphen in other places. Use the babelshorthand "= to allow hyphenation in the rest of the word. Regarding the font: Different fonts means different line breaking.

\documentclass[%
a4paper,
12pt,
DIV=calc,
oneside,
parskip=half
]
{scrreprt}

\usepackage[a4paper, left=3cm, right=2.5cm, top=2.5cm, bottom=2.5cm, includefoot]{geometry}

\usepackage{fontspec}
\usepackage[babelshorthands]{polyglossia}

\setdefaultlanguage{german}
\setmainfont{Times New Roman}

\begin{document}
Ligatures: fi fl ffl
whitespace Keynesian dwarfish calflike wolffish rufflike rooftop  \\ \\
Für die Autorisierung und Zugriffsverwaltung innerhalb und gegenüber dem X.500"=Verzeichnisdienst wurden X.509-Zertifikate definiert, deren Zertifikatssyntax als \textit{Abstract Syntax Notation One} (ASN.1) bezeichnet wird.  Detailliertere Informationen zu ASN.1 sind zu entnehmen.
\end{document}

enter image description here

Ulrike Fischer
  • 327,261
3

It's not a problem with Times or any other font.

LuaTeX introduces new hyphenation features, but it doesn't change the fact that a character with zero \lccode ends the search for a word to hyphenate.

Thus \hyphenation{X.500=Ver-zeich-nis-dienst} does nothing at all, because .500 all have zero \lccode.

\documentclass[%
  a4paper,
  12pt,
  DIV=calc,
  oneside,
  parskip=half                
]
{scrreprt}

\usepackage[a4paper, left=3cm, right=2.5cm, top=2.5cm, bottom=2.5cm, includefoot]{geometry}

\usepackage{fontspec}
\usepackage{polyglossia}

\setdefaultlanguage{german}
\setmainfont{Times New Roman}

\begin{document}

\lccode`.=`. \lccode`5=5 \lccode`0=`0
\hyphenation{X.500=Ver-zeich-nis-dienst}

Ligatures: fi fl ffl

whitespace Keynesian dwarfish calflike wolffish rufflike rooftop

Für die Autorisierung und Zugriffsverwaltung innerhalb und gegenüber 
dem X.500-Verzeichnisdienst wurden X.509-Zertifikate definiert, deren 
Zertifikatssyntax als \textit{Abstract Syntax Notation One} (ASN.1) 
bezeichnet wird.  Detailliertere Informationen zu ASN.1 sind zu entnehmen.

\end{document}

enter image description here

egreg
  • 1,121,712
  • but another problem: how can i hyphen this word: \textit{PolicyInformation}-Objekten in the sentence Die Erweiterung besteht aus einer Sequenz von einer oder mehreren \textit{PolicyInformation}-Objekten. It did not break the word because the first part is inside the \textit command. – Opa114 Mar 31 '16 at 21:51
  • 1
    @Opa114 For this you need the "= method. But how many times do you have such a beast? Just add \- where you need. – egreg Mar 31 '16 at 21:59
  • ok. not often yes, so maybe the best solution will be to use \- – Opa114 Mar 31 '16 at 22:02
  • Could you please link to documentation of these "new hyphenation features" LuaLaTeX introduces? – lblb Oct 08 '17 at 20:11
  • 1
    @lblb The LuaTeX manual, section 4.3 – egreg Oct 08 '17 at 20:13