If you use the amsmath package, you could employ its \nobreakdash
macro to insert a dash or en-dash after which no line break is allowed.
Three examples (all from the user guide of the amsmath
package):
$p$\nobreakdash-adic
$n$\nobreakdash-dimensional
pages 1\nobreakdash--9
Basically, where you'd normally write -
("dash") in the input file, you would now write \nobreakdash-
, and where you'd normally write --
("en-dash"), you would now write \nobreakdash--
.
The joined-up expression $n$\nobreakdash-dimensional
is quite long and might create bad line breaks. To keep this from happening, while still prohibiting a linebreak after $n$-
, you could write
$n$\nobreakdash-\hspace{0pt}dimensional
That way, if need be, LaTeX can find a line break somewhere inside the "dimensional" substring. Presumably, you're OK with $n$-dimen-
being at the end of one line and sional
at start of the next line. If you have a lot of instances of "n-dimensional" in your document, it may make sense to set up a macro such as
\newcommand\ndim{$n$\nobreakdash-\hspace{0pt}dimensional}
in the preamble and to write \ndim{}
everywhere in the body of the document.