Super Script and Hyphenation Problems

I am using LuaLaTeX compiler with KOMA-scrbook class.

I need to define a command with superscript text, but I do not know why LaTeX disable the hyphenation of words with superscript text.

\documentclass{scrbook}

\usepackage[USenglish]{babel}

\begin{document}

\parbox{0.1cm}{

\parbox{0.1cm}{

\end{document}


Why the words "advanced" and "however" do not have hyphenation when used with \textsuperscript?

\textsuperscript is implemented using TeX's math mode, so however\textsuperscript{1} behaves similar to however$abc$. Since the inline math formula is not separated from the word and hyphenation of "words" partially consisting of mathematical expressions is not really well-defined, TeX does not try to hyphenate such constructs.

You can tell LuaTeX that the previous word ended by adding an explicit \wordboundary:

\documentclass{scrbook}

\usepackage[USenglish]{babel}

\begin{document}

\parbox{0.1cm}{

\parbox{0.1cm}{
\end{document}


• Neat! I just found out about the \wordboundary macro.
– Mico
Sep 17 at 6:17
• @Mico Not that it matters too much, but technically it's a primitive and not a macro. Sep 17 at 6:20
• Or applying \leavevmode\nobreak at the beginning of \@textsuperscript? OK, this might change many documents. Sep 17 at 9:07

Another workaround would be to use a font which has real superscripts, like Libertinus, EBGaramond, Erewhon, etc., together with the realscript package. Then your example would work out of the box.

\documentclass{scrbook}
\usepackage[USenglish]{babel}