2

I have text inside an equation that is too long for one line:

\documentclass{amsart}
\newcommand{\sset}[1]{\{ #1 \}}

\begin{document}
    We have $(x, y, z) \in \sset{(a, b, c) \in \mathbb{N}^3 \mid \text{they satisfy a very complicated condition that can only be described in text}}$.
\end{document}

This renders like in the picture.I do not want this to happen: the text runs over the margin of my document.

As you can see, the text goes outside the boundaries of my document, which is bad. Instead, I want it to look something like this:I want it to look more or less like this. I have produced this with

\documentclass{amsart}

\begin{document}
    We have $(x, y, z) \in \{(a, b, c) \in \mathbb{N}^3 \mid \text{they satisfy a very complicated condition that}$
    $\text{ can only be described in text}\}$.
\end{document}

This looks like really bad style. (For instance, what happens when I add a sentence in front? Then I have to rearrange the split. Also I can not use my custom command \sset here, but that's OK I guess.)

I have tried to use \linebreak or \allowbreak inside the \text, but they seem to do nothing.

What I would like to have is a command that I can use inside \text that allows the text to break at that point. Then I can put this command at multiple positions and LaTeX will decide where to put the break.

An alternative would be a command \breaktext for breakable text which I can use instead of \text.

5
  • Why not close the inline math before the text? Commented Aug 6 at 11:28
  • 1
    Off-topic: if your tex distribution isn't completely outdated, you no longer need \usepackage[utf8]{inputenc} Commented Aug 6 at 11:29
  • @samcarter_is_at_topanswers.xyz Thanks, I have deleted the inputenc-line in the question.
    – NerdOnTour
    Commented Aug 6 at 11:55
  • 1
    @samcarter_is_at_topanswers.xyz I read your comment as "Why not do We have $(x, y, z) \in \{(a, b, c) \in \mathbb{N}^3 \mid $ they satisfy a very complicated condition that can only be described in text $\}$", is that correct? I don't know, it feels wrong. The text belongs (semantically) to the inline math expression. So it should stay inside it, I think. In particular, this approach would force me to split the braces $\{ ... \}$ up into two inline math environments.
    – NerdOnTour
    Commented Aug 6 at 11:58
  • yes, at least if you want to stay with inline math. Or you could introduce a variable for the condition and then explain what the variable is in text. This way you can keep your } inside the inline math. Commented Aug 6 at 12:02

1 Answer 1

7

Exit from math mode. But consider that your readers will have a very hard time in looking for the closing brace.

\documentclass{amsart}

\begin{document}

\section{Bad}

We have $(x, y, z) \in \{(a, b, c) \in \mathbb{N}^3 \mid$ they satisfy a
very complicated condition that can only be described in text$\}$.

\section{Good}

We have $(x, y, z)$ in the set of all triples $(a, b, c) \in \mathbb{N}^3$,
where $(x,y,z)$ satisfies a very complicated condition that can only be
described in text.

\end{document}

enter image description here

You must log in to answer this question.

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