考虑这个例子:
\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}
在整个文档中,我经常需要该术语,并希望以正确、奇特的方式对其进行排版,使用斜线/反斜线将两个术语分开。两个术语也都有标记\textregistered
。生成的复合文本现在无法正确换行,如编译示例中所示:
Mat-lab
我怎样才能教 LaTeX 像和一样换行Si-mu-link
,同时基本上忽略/携带textregistered
?我正在使用 LuaTeX。
答案1
这似乎实现了你想要的:可接受的断点是
MAT-LAB®/Si-mu-link®
(包括斜线)。
\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}