I know there are various techniques to keep things on the same line. I have a two-word variable input. For example, Settings App.

Let's say there are a group of apps, and I would like them always formatted the same.

I could go about this different ways. The straightforward solution is to write each one manually:


This is not really a good solution, because I cannot differentiate between other \textit{} text and \textit{} app text.

So, I put it into a variable/macro.

\app{Settings App}

or LaTeX3 syntax

\app{Settings App}

The problem is, other people who might be writing text will forget the tilde. The consequence is not ensuring an unlinebreakable space and not being able to easily search for occurrences of an app name.

So, my question is whether there is something I can add into my macro definition above that will ensure a non-linebreakable space without the explicit tilde?

  • How about an \mbox{...}?
    – sodd
    Apr 19, 2016 at 5:04
  • @hooy Is \mbox{} not linebreakable? That would be easy. Apr 19, 2016 at 5:04
  • It is not linebreakable, no.
    – sodd
    Apr 19, 2016 at 5:06
  • @hooy Please provide an answer and let's get this thing wrapped up then :) Apr 19, 2016 at 5:08

1 Answer 1


You can use one of the horizontal boxes, for example \mbox, as that will not allow linebreaks. For more examples of horizontal boxes, see @egreg's answer here. Although \mbox prevents linebreaks, it will have the side effect of not stretching or shrinking with the rest of the text, see @egreg's answer here for a solution to such a problem.

So a "quick, easy fix" would be as follows:

\app{Settings App}


\app{Settings App}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .