4

What is the proper way to typeset this set comprehension that has a lot of words in it? Is \textrm with manual spaces really the only way?

$$D = (S,
       \{(a,b) \,|\, \exists s,x,y\in S^* \textrm{ and } 
                     i < j \textrm{ such that } 
                     w^i = sax \textrm{ and } w^j = sby\})$$
  • just text{...}. and instead of $$ is better to use \[ ... ]` or \begin{equation*} ... \end{equation*}. – Zarko Sep 28 '16 at 2:54
  • I would use \textnormal rather than \textrm or \text, or may be define \newcommand*\mathwords{\textnormal} and use \mathwords{ such that }, etc. Also a macro \given rather than writing directly \,|\,. There are multiple questions in this site where a nice of \set{ .. \given .. } is in the answers. – Manuel Sep 28 '16 at 5:27
5

With that answer, I'm concentrating on the "that has a lot of words in it" part on the question. The solution that is often used is \text{...} with $...$ snippets for the math parts inside of it, just as you would use in normal text mode. You example might then look like this:

\[
D = (S, \{(a,b) \mid \text{$\exists s,x,y\in S^*$ and $i < j$
                            such that $w^i = sax$ and $w^j = sby$}\})
\]
  • 1
    +1. The only thing I'd change is to replace \,|\, with \mid. (\mid is a relational operator and thus inserts thickspace, not thinspace, on either side of the vertical bar.) – Mico Sep 28 '16 at 5:56
  • @Mico \mid is indeed better, I added it to the answer – siracusa Sep 28 '16 at 6:31
  • I'd say that \mid is not good in general as it cannot be scaled. It is fine in most cases, but annoying when you want it scaled. – daleif Sep 28 '16 at 6:34
  • 1
    @daleif - Note that I did not say that "\mid is good in general". I was merely pointing out that for the formula at hand, using \mid was better than \,|\,. (If there was need to resize the vertical bar, I would have provided a different suggestion...) – Mico Sep 28 '16 at 8:34
  • my point is just that, many people use these pages as a guide as what to do, thus taking for granted that an ad hoc solution is the solution. – daleif Sep 28 '16 at 8:47
4

The idea is to keep set descriptions as short as possible. That long description hides the main parts at the end, where the reader will have a hard time to end at.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

Here is a possibility
\[
D = (S, \{(a,b) \mid w^i=sax, w^j=sby \text{ for some $s,x,y\in S^*$, $i < j$}\}
\]
but probably it is better if you describe the set in words.

For $w\in S$, define $T_{w}$ as the set of pairs $(a,b)\in S\times S$
such that there exist $s,x,y\in S^{*}$ and $i<j$ so that $w^i=sax$ and
$w^j=sby$. Set $D=(S,T_w)$; then ...

\end{document}

enter image description here

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.