2

Consider this example:

\documentclass{scrreprt}

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

%This does not seem to help:
\hyphenation{Mat-lab Si-mu-link}

\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:

enter image description here

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.

2

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

MAT-LAB®/Si-mu-link®

(including the slash).

\documentclass{scrreprt}

\newcommand{\smlnk}{%
  Simulink%
  \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
}

\hyphenation{Mat-lab Si-mu-link}

\begin{document}

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

\end{document}

enter image description here

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.