5
$\begingroup$

I found \[NonBreakingSpace] but I haven't found a non-breaking hyphen (I want to use them in text mode in notebooks). I must be missing something obvious.

$\endgroup$
2
  • 1
    $\begingroup$ Maybe you could use \[DiscretionaryHyphen]? $\endgroup$ Commented Sep 20, 2018 at 20:48
  • $\begingroup$ Isn't a discretionary hyphen one that CAN and DOES break, under certain circumstances? If so, that is the opposite of what is requested. $\endgroup$ Commented Sep 20, 2018 at 21:24

2 Answers 2

5
$\begingroup$

Guess you can do

\[NoBreak]\[Hyphen]\[NoBreak] 

enter image description here

Those lines are the same except the first one has nobreaks:

enter image description here

$\endgroup$
5
$\begingroup$

You can directly input the unicode character for the non-breaking hyphen in a cell:

\:2011

You can also create an input alias to allow direct input of a unicode non-breaking hyphen.

SetOptions[EvaluationNotebook[],InputAliases ->Append[Options[EvaluationNotebook[], "InputAliases"][[1, 2]], {"nbh" -> "\:2011"}]] 

Mathematica (13.3.1 MacOS) respects the non-breaking hyphen.

I use InputAliases to access a lot of Unicode characters

{"%" -> "%", "(" -> "⟮", ")" -> "⟯", "{" -> "⟦", "}" -> "⟧","=?" -> "≟", "=def" -> "≝", "_a" -> "ₐ", "_e" -> "ₑ", "_o" -> "ₒ","_x" -> "ₓ", "_n" -> "ₑ", "_+" -> "₊", "_-" -> "₋", "_=" -> "₌","_(" -> "₍", "_)" -> "₎", "_1" -> "₁", "_2" -> "₂", "_3" -> "₃","_4" -> "₄", "_5" -> "₅", "_6" -> "₆", "_7" -> "₇", "_8" -> "₈","_9" -> "₉", "_0" -> "₀", "^+" -> "⁺", "^-" -> "⁻", "^=" -> "⁼","^(" -> "⁽", "^)" -> "⁾", "^1" -> "¹", "^2" -> "²", "^3" -> "³","^4" -> "⁴", "^5" -> "⁵", "^6" -> "⁶", "^7" -> "⁷", "^8" -> "⁸","^9" -> "⁹", "^0" -> "⁰", "^n" -> "ⁿ"} 

I find them very handy for formatting chemical symbols that I don't what interpreted as mathematical symbols e.g. Na⁺ or H₂O.

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.