I would like to have math mode expressions in dollar signs always to stay on the same line, which is what happens to a sequence of characters with no spaces while not in math mode. Is there a way to avoid having to do this manually by adding line breaks every time (which is terrible style, and gets very messy if one has to go back and change things, altering everithing that comes after)?
The following two lines put at the document preamble should help:
It is a good idea to add
However, this will completely forbid implicit linebreaks inside inline mathematics. I don't think it is a good idea. Better idea would be to set the pelanties to some value that will discourage the breaks, but allow them if really necessary:
The usual way to typeset a function is
will do. You can of course define a macro for this:
to be called as
but I believe this is unnecessary. Just check the line during the final revision, adding