4

i globally declared the hyphenation of a word like this

\hypenation{dis-tri-bu-tion-point-objekt}

The Word is a mix of english an german (the last part objekt is in german language). But the word will not be separated and so it goes out of box and lays on the right space of the letter and not in the next line.

I tried it also manually with \= but then LuaLaTeX prints out the two characters in the text.

I'm using lualatex, so where is the problem? thanks!

EDIT Added MWE.

\documentclass[%
a4paper,
12pt,                           
DIV=calc,                   
oneside,
parskip=half,       
captions=nooneline,
numbers=noenddot, 
listof=totocnumbered,
bibliography=totocnumbered
]
{scrartcl}
\usepackage[a4paper, left=3cm, right=2.5cm, top=2.5cm, bottom=2.5cm, includefoot]{geometry}
\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{german}


\begin{document}
Die Erweiterung besteht aus einer Sequenz von DistributionPoint-Objekten. Das Distribution-Point-Objekt wiederum besteht aus drei optionalen Feldern distributionPoint, reasons und cRLIssuer. Allerdings darf das Objekt nicht nur auf dem reasons-Feld bestehen. Es muss entweder das Feld distributionPoint oder cRLIssuer vorhanden sein. Allerdings darf das Objekt nicht nur auf dem reasons-Feld bestehen. Es muss entweder das Feld distributionPoint oder cRLIssuer vorhanden sein. Allerdings darf das Objekt nicht nur auf dem reasons-Feld bestehen. Es muss entweder das Feld distributionPoint oder cRLIssuer vorhanden sein. Allerdings darf das Objekt nicht nur auf dem reasons-Feld bestehen. Es muss entweder das Feld distributionPoint oder cRLIssuer vorhanden sein.
\end{document}
6

If you specify

\hyphenation{dis-tri-bu-tion-point=objekt}

in the preamble, the German language has not yet been loaded. You have to delay this at begin document. Note = to denote a - in the word.

\documentclass[%
a4paper,
12pt,
DIV=calc,
oneside,
parskip=half,
captions=nooneline,
numbers=noenddot,
listof=totocnumbered,
bibliography=totocnumbered
]
{scrartcl}
\usepackage[a4paper, left=3cm, right=2.5cm, top=2.5cm, bottom=2.5cm, includefoot]{geometry}
\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{german}

\begin{document}
\hyphenation{dis-tri-bu-tion-point=objekt}

Die Erweiterung besteht aus einer Sequenz von DistributionPoint-Objekten.
Das DistributionPoint-Objekt wiederum besteht aus drei optionalen Feldern
distributionPoint, reasons und cRLIssuer.

\end{document}

enter image description here

A way for adding the hyphenations in the preamble, in multiple languages and avoiding \selectlanguage that has the defect of writing things in the auxiliary files.

\documentclass{article}

\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{german}
\setotherlanguage{english}

\newcommand{\sethyphenation}[2]{%
  \begin{otherlanguage*}{#1}\hyphenation{#2}\end{otherlanguage*}%
}

\sethyphenation{german}{dis-tri-bu-tion-point=objekt}
\sethyphenation{english}{as-df-gh-jkl}

\begin{document}

\parbox{0pt}{DistributionPoint-Objekt}

\bigskip

\begin{otherlanguage*}{english}
\parbox{0pt}{asdfghjkl}
\end{otherlanguage*}

\end{document}

The \parbox{0pt} is just to show hyphenations.

enter image description here

If you want a break also after the explicit hyphen, you can do

\sethyphenation{german}{dis-tri-bu-tion-point={}{}{}objekt}

Here's the output in this case

enter image description here

  • great. the =did the trick. Can i place the \hypenation command before \begin{document}? – Opa114 Feb 17 '16 at 18:52
  • @Opa114 I tried a few ways, but only \AtBeginDocument{\hyphenation{...}} works, which would be quite bad for documents in multiple languages. :( I'll try something more. – egreg Feb 17 '16 at 18:55
  • 2
    @egreg: You should activate the language: \selectlanguage{german} \hyphenation{dis-tri-bu-tion-point=objekt} then it will work in the preamble too. – Ulrike Fischer Feb 17 '16 at 19:01
  • @UlrikeFischer That's what I wanted to avoid. – egreg Feb 17 '16 at 19:06
  • @egreg no problem for me; both ways are working and that is enough for me :) – Opa114 Feb 17 '16 at 19:08

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.