[Tex/LaTex] Tabbing alignment and over-length sentence auto line break

aligncasesline-breakingtabbing

【Question】When using "tabbing" under math mode with cases, how can I achieved the following at the same time:

(1) alignment in cases by "tabbing"

(2) over length element such as a long sentence in "tabbing" will automatically line break instead of going out of the page?

enter image description here

【Problematic CODE】

 \documentclass[12pt]{article}
 \usepackage{amsmath}
 \usepackage{tabularx}
 \begin{document}

 \begin{tabbing}
 $\begin{cases}

\= \text{trade}, \= p(\text{trade})=\dfrac{y}{v}, \= \text{when there is a long sentence in tabbing, it will break automatic instead of going out of the page}\\

\> \text{no trade}, \> p(\text{no trade})=1-\dfrac{y}{v}

 \end{cases}$
 \end{tabbing}

 \end{document}

Best Answer

With tabbing you can't have automatic break of lines: you always have to specify a paragraph width for this (explicitly or computed).

Since this appears much like a math display, I suggest using cases alone:

\documentclass[12pt]{article}
\usepackage{amsmath}

\usepackage{lipsum} % for mock text

\begin{document}

\lipsum*[2]
\[
\begin{cases}
\text{trade}, & p(\text{trade})=\dfrac{y}{v},\ %
  \parbox[t]{.6\displaywidth}{
    when there is a long sentence in tabbing, it will break
    automatically instead of going out of the page
  }
\\ \\[-1ex]
\text{no trade}, & p(\text{no trade})=1-\dfrac{y}{v}
\end{cases}
\]
\lipsum[3]

\end{document}

The empty line with a slight compensation is the simplest thing to move the two real lines far apart from each other.

The width 0.8\displaywidth is “eye computed”.

enter image description here