# Problem with dash using XeLaTeX

I am writting with LaTeX my bachelor thesis. I am using XeLaTeX because you can easily highlight text with the xesearch package.

My problem is that words with a dash like HTML-Request are not broken properly. In the PDF file there are two dashes at the end of the line.

I suppose the problem is the usage of \UndoBoundary{-}. I am using it because otherwise notionssuch as Web-Verifier won't be highlighted.

Could you help me, please?

I post the full head maybe you could give me some other hints, too. I am using KomaScript.

%\documentclass[a4paper, twoside,12pt,abstracton,parskip=half]{scrreprt}
\documentclass[a4paper,12pt,abstracton,parskip=half]{scrreprt}

\usepackage[ngerman]{babel}
\usepackage[babel, german=quotes]{csquotes}

\usepackage[german=quotes]{csquotes}

\MakeOuterQuote{"}

\usepackage{graphicx}
\usepackage{url}
\usepackage{extsizes}
\usepackage{hyperref}
\usepackage{xltxtra}
\usepackage{xesearch}
\usepackage{tabularx}
\usepackage{microtype}
\usepackage{titleref}

\usepackage[textwidth=16cm]{geometry}

\usepackage{xcolor}

\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}
\setmainfont[Ligatures=TeX]{Arial}

%\setmainfont{Times New Roman}

\usepackage[
backend=biber,
style=numeric,
sortlocale=de_DE,
natbib=true,
url=false,
doi=true,
eprint=false
]{biblatex}

\clearpairofpagestyles
\cfoot[\pagemark]{\pagemark}

\setlength{\parindent}{0pt}

\UndoBoundary{-}
\SearchList{i4}{\textit{#1}}{Web-Verifier}
\SearchList{i5}{\textit{#1}}{Web-Verifiers}
\SearchList{i6}{\textit{#1}}{Single Page Web Application}

%\SearchList{i8}{\textit{#1}}{}
%\SearchList{i9}{\textit{#1}}{}

\hyphenation{Web-Verifier}
\hyphenation{Web-Verifiers}

\newcounter{savepage}
\begin{document}

\thispagestyle{empty}

\begin{abstract}
\thispagestyle{plain}
Web-Verifier HTTP-Request HTTP-Response HTTP-Request HTTP-Response HTTP-Request HTTP-Response
HTTP-Request HTTP-Response HTTP-Request HTTP-Response HTTP-Request HTTP-Response
\end{abstract}
\end{document}


EDIT:

I commented \UndoBoundary{-} and \SearchList out. The dash at the end of the line works as expected, now.

But I would like to highlight words with dashes (e.g. Web-Verifier) in my document with \SearchList.

Could anybody help me with this problem?

PS: @admins Sorry for the inconvenience.

• An example of text producing the issue is needed. – egreg Jul 21 '14 at 14:25
• Thanks for your comment. I added an example which show the issue. – Johannes Jul 21 '14 at 14:36

I have found a working solution for me. It's probably not the best. I use the package hyphenat and replace the dash in words, which should not be highlighted, with \hyp{}.

Now it looks like this:

%\documentclass[a4paper, twoside,12pt,abstracton,parskip=half]{scrreprt}
\documentclass[a4paper,12pt,abstracton,parskip=half]{scrreprt}

\usepackage[ngerman]{babel}
\usepackage[babel, german=quotes]{csquotes}

\MakeOuterQuote{"}

\usepackage{extsizes}
\usepackage{hyperref}
\usepackage{xltxtra}
\usepackage{xesearch}
\usepackage{microtype}
\usepackage{titleref}

\usepackage{hyphenat}

\usepackage[textwidth=13cm]{geometry}

\usepackage{xcolor}

\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}
\setmainfont[Ligatures=TeX]{Arial}

\clearpairofpagestyles
\cfoot[\pagemark]{\pagemark}

\setlength{\parindent}{0pt}

\UndoBoundary{-}
\SearchList{i4}{\textit{#1}}{Web-Verifier}
\SearchList{i5}{\textit{#1}}{Web-Verifiers}
\SearchList{i6}{\textit{#1}}{Single Page Web Application}

\newcounter{savepage}
\begin{document}

\thispagestyle{empty}

\begin{abstract}
\thispagestyle{plain}
Web-Verifier HTTP\hyp{}Request HTTP\hyp{}Response HTTP\hyp{}Request HTTP\hyp{}Response HTTP\hyp{}Request HTTP\hyp{}Response
HTTP\hyp{}Request HTTP\hyp{}Response HTTP\hyp{}Request HTTP\hyp{}Response HTTP\hyp{}Request HTTP\hyp{}Response
\end{abstract}
\end{document}