6

I'm attempting to create a multiline equation with some characters than span both lines.

Target equation

I've come closer by using the amsmath package

\begin{multline*}
Pr[X\leftarrow DECODE(\Delta;r_1,...,r_\ell) | 
\displaystyle{(\Delta;q_1,...,q_\ell)\leftarrow QUERY(1^\lambda;J)} \\
\displaystyle{\Lambda (\Lambda^\ell _{j=1})}
]
\end{multline*}

But I'm at a loss as this does not allow me to span some characters on both lines Bad multiline

Any suggestions would be appreciated.

  • What about insert the right contents in array with 2 rows? – Sigur Dec 16 '18 at 15:19
  • Please tell us a bit more what \Lambda stands for? E.g., is is an "operator", like \sum, \prod, or \int? – Mico Dec 16 '18 at 20:19
4

My main suggestions are (a) use \biggl[, \biggm|, and \biggr] to structure the equation and (b) use a two-row array environment for the material between \biggm| and \biggr]. I wouldn't use a multline* environment, though. An unnumbered single-line display math environment does fine.

enter image description here

\documentclass{article}
\usepackage{amsmath}
\usepackage{array}   % for '\newcolumntype' macro
\newcolumntype{L}{>{\displaystyle}l} % automatic displaystyle math mode
\begin{document}
\[
\Pr\biggl[
X\leftarrow \mathit{DECODE}(\Delta;r_1,\dots,r_\ell) 
\biggm| 
\begin{array}{@{}L@{}}
   (\Delta;q_1,\dots,q_\ell)\leftarrow \mathit{QUERY}(1^\lambda;J) \\
   \Lambda \bigl(\Lambda^\ell_{j=1}\leftarrow \mathit{RESPOND}(X^{(j)};q_j)\bigr)
\end{array}
\biggr]
\]
\end{document} 
4

The image has several inconsistencies in the typesetting.

I suggest to define semantic commands in order to be sure that similar objects are always typeset the same.

I don't like \ell, but you can use it in place of the plain l.

\documentclass{article}
\usepackage{amsmath}

\newcommand{\func}[1]{\mathit{#1}}

\begin{document}

\begin{equation*}
\Pr\left[
  X \gets \func{DECODE}(\Delta;r_1,\dots,r_l)
\;\middle|\;
  \begin{matrix}
  (\Delta;q_1,\dots,q_l) \gets \func{QUERY}(1^\lambda;J) \\
  \Lambda(\Lambda_{j=1}^l \gets \func{RESPOND}(X^{(j)};q_j))
  \end{matrix}
\right]
\end{equation*}

\end{document}

enter image description here

A slightly different approach, where you specify the brackets as inherently attached to \Pr and can choose their size (see the documentation of \DeclarePairedDelimiter in mathtools). Basically, \Pr* selects automatic size, \Pr[\big] (or any other delimiter size changing command in the optional argument) selects the stated size.

\documentclass{article}
\usepackage{amsmath,mathtools}

\newcommand{\func}[1]{\mathit{#1}}

\renewcommand{\Pr}{\operatorname{Pr}\brackets}
\DeclarePairedDelimiterX{\brackets}[1]{[}{]}{#1}
\newcommand{\given}{\;\delimsize|\;\mathopen{}}

\begin{document}

\begin{equation*}
\Pr*{
  X \gets \func{DECODE}(\Delta;r_1,\dots,r_l)
\given
  \begin{matrix}
  (\Delta;q_1,\dots,q_l) \gets \func{QUERY}(1^\lambda;J) \\
  \Lambda(\Lambda_{j=1}^l \gets \func{RESPOND}(X^{(j)};q_j))
  \end{matrix}
}
\end{equation*}

\begin{equation*}
\Pr[\Big]{
  X \gets \func{DECODE}(\Delta;r_1,\dots,r_l)
\given
  \begin{matrix}
  (\Delta;q_1,\dots,q_l) \gets \func{QUERY}(1^\lambda;J) \\
  \Lambda(\Lambda_{j=1}^l \gets \func{RESPOND}(X^{(j)};q_j))
  \end{matrix}
}
\end{equation*}

\begin{equation*}
\Pr[\bigg]{
  X \gets \func{DECODE}(\Delta;r_1,\dots,r_l)
\given
  \begin{matrix}
  (\Delta;q_1,\dots,q_l) \gets \func{QUERY}(1^\lambda;J) \\
  \Lambda(\Lambda_{j=1}^l \gets \func{RESPOND}(X^{(j)};q_j))
  \end{matrix}
}
\end{equation*}

\end{document}

enter image description here

4

enter image description here

by use of array:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\[
\Pr \left[X\leftarrow\text{DECODE}(\Delta;r_1,\dotsc,r_\ell)\ \middle|
    \begin{array}{l}
    (\Delta;q_1,\dotsc,q_\ell)\leftarrow \text{QUERY}(1^\lambda;J) \\
     \Lambda(\Lambda^\ell _{j=1}) \leftarrow\text{RESPOND}(X^{(j)}:q_j)
     \end{array}
    \right]
\]
\end{document}
  • 1
    You won by few seconds. lol – Sigur Dec 16 '18 at 15:27
  • 1
    Also, missing \dots. – Sigur Dec 16 '18 at 15:27
  • 1
    thank you very much to all who pointed me to weakness/errors in my code. i was to much focused to show solution how to write right part of expression in two left aligned lines. – Zarko Dec 16 '18 at 15:42
  • It is missing ) after q_j. :-) – Sigur Dec 17 '18 at 10:39

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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