Is there a shorthand/ instruction for math mode to simply retain words and not collapse the whitespace? I.e. rather than manually inserting spacing after each word with \, and friends.

Here is the text I would like to have be treated like text with math symbols:

$${(i,t) where i \in {Truths} and t \in {Actuals Sets} and {Truths_i} \cap {Actuals_t} \ne \o}$$

The result is that the non-symbol words are collapsed into a mush:

enter image description here

While it is possible to fix this manually (using \, and friends):

$${(i,t)\, where\, i \in {Truths}\, and\, t \in {Actuals Sets}\, and\, {Truths_i} \cap {Actuals_t} \ne \o}

.. resulting in :

enter image description here That seems like too much manual work.

What are the options here?

  • Are you interested in something like this? – Werner Dec 12 '18 at 5:12
  • @Werner yes. care to spill the beans? – javadba Dec 12 '18 at 5:17
  • You're going to have to do some legwork, since you're setting textual content in math mode. Is this supposed to be in a $$...$$ display? And you're using Pandoc? Try with (i,t) \mbox{ where } i \in \mathrm{Truths} \mbox{ and } t \in \mathrm{Actuals~Sets} \mbox{ and } \mathrm{Truths}_i \cap \mathrm{Actuals}_t \neq \mbox{\o}. – Werner Dec 12 '18 at 5:22
  • wow that's even more work than \, and ilk. No way to en masse get a "phrase" to be parsed like a sentence ? Well i'm guessing not then .. Is there no package that can help? – javadba Dec 12 '18 at 5:23
  • 1
    There's no magical way to detect that t in (i,t) should be math while t in Actuals should not text. And the same goes for all the other non-symbols you're using. So, no, there is no en masse magical way to do it. If you're interested in a quality end result, then you're going to have to spill some beans here and there... ;) Maybe someone else has a better suggestions with fewer keystrokes since that seems to be a concern for you here... – Werner Dec 12 '18 at 5:47

The following screenshot provides solutions for both inline math mode and display math mode. The solutions rely on the \text and \textup macros. \textup (or \textnormal) should be used for variable names; that way, they'll get typeset in the upright regardless of whether the surrounding happens to be typeset in italics (say, because the material occurs in the body of a theorem).

I also suggest replacing \o with \emptyset.

enter image description here

\usepackage{amsmath} % for "\text" macro
$(i,t)$, where $i\in\textup{Truths}$ and $t\in\textup{Actuals Sets}$
and $\textup{Truths}_i\cap\textup{Actuals}_t \ne \emptyset$
\text{$(i,t)$, where $i\in\textup{Truths}$ and $t\in\textup{Actuals Sets}$
and $\textup{Truths}_i\cap\textup{Actuals}_t \ne \emptyset$}
  • 1
    looks like we had similar thoughts on this. – javadba Dec 12 '18 at 6:20
  • While “where” can be in \text, the other parts are names of variables and should probably be \textup or \textnormal. – egreg Dec 12 '18 at 10:54
  • @egreg - Many thanks for this suggestion; I've modified the LaTeX code accordingly. – Mico Dec 12 '18 at 13:21
  • @DavidCarlisle You seem to have missed my answer that preceded this one and includes \text{} . Oh - you _did see it .. but did not credit it in your comment. More fair to say would be there are similarities and differences. – javadba Dec 12 '18 at 15:53

You should define a suitable environment for such “textual equations”:

Here I define textequation* (based on equation*); a textequation version for numbering is similar. I also increase the baselineskip, which is common in displayed material.

The optional argument (default 0.8) is a factor for setting a width, see the example below.


\usepackage{lipsum} % for context

\newcommand{\tvar}[1]{% textual variable


  $(i,t)$ where $i \in \tvar{Truths}$ and $t \in \tvar{Actuals Sets}$ and
  $\tvar{Truths}_i \cap \tvar{Actuals}_t \ne \emptyset$
  $(i,t)$ where $i \in \tvar{Truths}$ and $t \in \tvar{Actuals Sets}$ and
  $\tvar{Truths}_i \cap \tvar{Actuals}_t \ne \emptyset$


Using a special command for the “textual variables” is recommended, so you don't have surprises when typesetting them.

enter image description here

  • How much of this structure is applicable to a markdown doc with various snippets of tex and that is processed by pandoc ? It seems the document header portion is instead handled by the pandoc yaml header .. ? – javadba Dec 13 '18 at 19:55
  • @javadba I really don't know. Markdown seems to me quite inadequate for complex tasks. – egreg Dec 13 '18 at 20:57

After some more looking the best I could find so far is to use \text{some prose here} (oh and also breaking it into two lines and aligning) :

      \{(i,t)\text{ where i}\in \{TruthGrpIds\}\text{ and }t \in \{Actuals SetIds\} \\
      \text{ and }\{Truths_i\} \cap \{Actuals_t\} \ne \varnothing \} \\

enter image description here

While I will keep an eye out for some further improvements, this will likely be the approach for the near term.

  • 1
    A couple of things: The insertion of \text is similar to \mbox in my comments above. Also, TruthGrpIds have some "not nice" spacing between the characters, since they're considered symbols (letters) multiplied by one another in math mode. Note the horrible kerning between I and d when compared to (say) \mathit{TruthGrpIds}. Also, note the space missing in Actuals SetIds... you need a ~. Finally, why aligned and not gathered? – Werner Dec 12 '18 at 6:24
  • aligned not gathered : since I have a one-word vocabulary so far. trying the latter on for size now – javadba Dec 12 '18 at 6:26
  • got this: Erroneous nesting of equation structures; (amsmath) trying to recover with _aligned_ btw feel free to add an answer: you have useful ideas and at least can upvote it – javadba Dec 12 '18 at 6:29
  • This is the output when using gathered - it centres things rather than having them right-aligned as in your setup. – Werner Dec 12 '18 at 6:35
  • 1
    also you should not use $$ in latex, and not use aligned if you have no alignment points (&) – David Carlisle Dec 12 '18 at 10:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.