0

I searched the internet to solve my problem and tried several hints and tips, but nothing worked.

Manual hyphenation is working, but within the hyphenation command not.

(I don't want to hyphenate every instance of the word. And no hacks to make a newcommand and use this instead.)

It doesn't hyphenate the word Quidditch-Weltmeisterschaft (Quidditch world cup)

Example:

%% This is XeTeX, Version 3.141592653-2.6-0.999993 (MiKTeX 21.8) 
%% (preloaded format=xelatex 2021.8.13)  6 SEP 2021 12:00

\documentclass[fontsize=11pt]{scrbook}
\usepackage[paperwidth=154mm, paperheight=216mm, inner=1.9cm, outer=1.7cm, top=1.9cm, bottom=1.7cm]{geometry}

\usepackage{fontspec}
\setmainfont{Libertinus Serif}
\usepackage[ngerman]{babel}
%\usepackage[protrusion=basictext]{microtype}

\selectlanguage{ngerman}
\hyphenation{Quid-ditch-Welt-meis-ter-schaft}      % not working
%\hyphenation{Quid\-ditch\-Welt\-meis\-ter\-schaft} % produces errors

\listfiles
\begin{document}
%\hyphenation{Quid-ditch-Welt-meis-ter-schaft}      % this is not working also

% \hyphenation not working.
Es war recht kühl und der Mond stand noch am Himmel. Nur ein grünlicher Schleier am östlichen Horizont 
kündigte den kommenden Tag an. Harry dachte an die Tausende von Zauberern, die alle 
zur Quidditch-Weltmeisterschaft kommen wollten, und beschleunigte seine Schritte, 
bis er Mr Weasley eingeholt hatte.

% manual hyphenation
Es war recht kühl und der Mond stand noch am Himmel. Nur ein grünlicher Schleier am östlichen Horizont 
kündigte den kommenden Tag an. Harry dachte an die Tausende von Zauberern, die alle 
zur Quid\-ditch-Welt\-meis\-ter\-schaft kommen wollten, und beschleunigte seine Schritte, 
bis er Mr Weasley eingeholt hatte.

\end{document}

enter image description here

 %%*File List*
 %%scrbook.cls          2021/06/25 v3.34 KOMA-Script document class (book)
%%scrkbase.sty          2021/06/25 v3.34 KOMA-Script package (KOMA-Script-dependent bas
%%ics and keyval usage)
 %%scrbase.sty          2021/06/25 v3.34 KOMA-Script package (KOMA-Script-independent b
%%asics and keyval usage)
%%scrlfile.sty          2021/06/25 v3.34 KOMA-Script package (file load hooks)
%%scrlfile-hook.sty     2021/06/25 v3.34 KOMA-Script package (using LaTeX hooks)
 %%scrlogo.sty          2021/06/25 v3.34 KOMA-Script package (logo)
  %%keyval.sty          2014/10/28 v1.15 key=value parser (DPC)
%%tocbasic.sty          2021/06/25 v3.34 KOMA-Script package (handling toc-files)
%%scrsize11pt.clo       2021/06/25 v3.34 KOMA-Script font size class option (11pt)
%%typearea.sty          2021/06/25 v3.34 KOMA-Script package (type area)
%%geometry.sty          2020/01/02 v5.9 Page Geometry
  %%ifvtex.sty          2019/10/25 v1.7 ifvtex legacy package. Use iftex instead.
   %%iftex.sty          2020/03/06 v1.0d TeX engine tests
%%geometry.cfg
%%fontspec.sty          2020/02/21 v2.7i Font selection for XeLaTeX and LuaLaTeX
  %%xparse.sty          2021-08-04 L3 Experimental document command parser
   %%expl3.sty          2021-07-12 L3 programming layer (loader) 
%%l3backend-xetex.def   2021-08-04 L3 backend support: XeTeX
%%fontspec-xetex.sty    2020/02/21 v2.7i Font selection for XeLaTeX and LuaLaTeX
 %%fontenc.sty
%%fontspec.cfg
  %%ts1cmr.fd           2019/12/16 v2.5j Standard LaTeX font definitions
 %%***********

What am I doing wrong?

1 Answer 1

3

This is the default behavior with pdftex and xetex - a word with an explicit hyphen is not further hyphenated.

Option 1. With these engines write Quidditch"=Weltmeisterschaft when this word appears in the text (every instance). But you said you don’t want to do that, so—

Option 2. Switch to luatex and just write in the preamble:

\hyphenation{Quid-ditch=Welt-meis-ter-schaft} 

Here = means an explicit hyphen.

1
  • Thanks. That's a usefull explanation. I don't plan to use luatex, so I had to bite the bullet.
    – Daniel
    Sep 6, 2021 at 12:23

You must log in to answer this question.

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