# Discretionary hyphens for words in dot-notation

we're working on a technical document with some special requirement identifier, which use a dot-notation. For example:

FRQ.SW.MOD.GUI.1
FRQ.DATA.LOG.OUT.PRINT.1


As you might expect we get a lot of overfull box messages and theses "words" get not split by the hyphenation mechanism.

So I'm looking for another solution. Is there a way defining a discretionary-rule or something else to get these words wrapped? We don't want to use something like \url. The user experience should be smooth as possible.

This question is a follow up to Replacing # for use inside \label

• why not \url don't you have some command already wrapping these identifiers for font change at least, or do you just use the text font with no markup? (I posted an answer suggesting \url then noticed you said not that, so it is deleted, but it seems like the right answer to me:-) – David Carlisle Jan 20 '16 at 14:45
• you have tagged this luatex, although you do not mention that in the text, does that mean a lua-only solution is acceptable? – David Carlisle Jan 20 '16 at 14:47
• in your linked example all such words appear inside \req so why not just define \req using url package so that it breaks at the . ? – David Carlisle Jan 20 '16 at 15:33

use the url package and

\path|FRQ.DATA.LOG.OUT.PRINT.1|


and it will allow breaking at .

You could define a command with a different name if needed, see the url package documentation.

Adding this to your example from the linked question, and setting up @ as a safer way to input # gives

\documentclass[a4paper]{scrartcl}
\usepackage[left=2cm,right=2cm,top=2.5cm,bottom=2cm]{geometry}
\setlength\parindent{0pt}

\usepackage{url}

\makeatletter
\newcommand{\req}[2]{%
\begingroup
\textbf{\url{#1}}%
\def\@currentlabel{\protect\url{#1}}\label{req:#1}~#2\par
\endgroup
}

\DeclareNewTOC[%
type=requirement, %
types=requirements, %
name=Anforderung, %
listname={List of Requirements} %
]{lor}
\setuptoc{lor}{chapteratlist}

\def\UrlBigBreaks{\do\.}
\mathchardef\UrlBigBreakPenalty=50
\let\oldUrlSpecials\UrlSpecials
\def\UrlSpecials{\oldUrlSpecials\do\@{\texttt\#}}
\begin{document}
\section{Test}
\req{MY.REQ.ID.42}{Lorem ipsum dolor sit amet,...}

\req{MY.REQ.ID.43@BROKEN}{this requirement is broken,...}

xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx
xxx xxx xxx xxx xxx
Please have a look at \ref{req:MY.REQ.ID.42} on page~\pageref{req:MY.REQ.ID.42}

x x x x x x x x x x x x x x x x x x x x x x
x x x x x x x x x x x
Please have a look at \ref{req:MY.REQ.ID.43@BROKEN} on page~\pageref{req:MY.REQ.ID.42}

\listofrequirements

\end{document}