# Linebreak composed term with Registered sign and slash

Consider this example:

\documentclass{scrreprt}

\newcommand{\mtlb}{MATLAB\textsuperscript{\textregistered}}%
\newcommand{\mtlbsmlnk}{\mtlb{}\kern-0.25em\slash\smlnk{}}%

%This does not seem to help:

\begin{document}
\hspace{14em}Thanks to \verb|\slash|, this works (mostly): \mtlbsmlnk{}.

\hspace{20em}This runs into trouble: \mtlbsmlnk{}.

\hspace{29em}So does this: \mtlbsmlnk{}.

\noindent\rule{\textwidth}{1cm}

\renewcommand{\mtlb}{MATLAB\hspace{0pt}\textsuperscript{\textregistered}}

\hspace{25em}This allows a break: \mtlbsmlnk{}.
This is the wanted behaviour (same is also wanted for 'Simulink').

\hspace{5em}But it also allows the word and trademark sign to be separated: \mtlbsmlnk{}
\end{document}


Across the document, I often need the term and want to typeset it in the correct, fancy way, with a slash / backslash separating the two terms. Both terms also have the \textregistered mark. The resulting composite does not line break correctly right now, as can be seen in the compiled example:

How can I teach LaTeX to linebreak like Mat-lab and Si-mu-link, while essentially ignoring/carrying with the textregistered? I am using LuaTeX.

This seems to achieve what you want: the admissible break points are

MAT-LAB®/Si-mu-link®


(including the slash).

\documentclass{scrreprt}

\newcommand{\smlnk}{%
\nobreak % don't allow a break here
\textsuperscript{\textregistered}%
}
\newcommand{\mtlb}{%
MATLAB%
\nobreak % don't allow a break here
\textsuperscript{\textregistered}%
}

\newcommand{\mtlbsmlnk}{%
\mtlb % MATLAB
\kern-0.25em % move the slash back
\slash % allow a break after the slash
\nobreak % the next space is not allowed for a break
\hspace{0pt}% allow the next word to be hyphenated
\smlnk
}

\begin{document}

\parbox{0pt}{\hspace{0pt}\mtlbsmlnk}

\end{document}