How to prevent a line breaking at the character - in phrases such as $k$-algebra, without having to write like $k$\nobreak-\nobreak algebra?
Asked
Active
Viewed 32 times
1
Jinwen
- 8,518
-
Have you tried using a NON-BREAKING HYPHEN (U+02011) ? – Ingmar Jun 13 '22 at 11:03
-
@Ingmar Thank you for this suggestion, but how should I input this character? – Jinwen Jun 13 '22 at 11:04
-
1Copy & paste (from here, e.g. ‑) or https://tex.stackexchange.com/questions/34604/entering-unicode-characters-in-latex – Ingmar Jun 13 '22 at 11:13
-
1@Ingmar Thank you, this works just as fine as Mico's answer below :) – Jinwen Jun 13 '22 at 11:15
1 Answers
1
The amsmath package provides the \nobreakdash macro for just this case:
$k$\nobreakdash-algebra
The symbol that follows \nobreakdash need not necessarily be a - ("dash") character. It could aslo be something like
pages 1\nobreakdash--9
to indicate that no line break is allowed after "1\endash".
Mico
- 506,678