0

I would like to learn as how to typeset for such a expression in latex. enter image description here

Thank you

  • Please don't post screen shots. Instead, post a minimal working example. This allow people to cut and paste your code and hence trouble shoot. In particular, MWEs should be compilable latex code. – Andrew Oct 10 '16 at 10:08
  • Related: tex.stackexchange.com/a/240870/1952 – Ignasi Oct 10 '16 at 10:11
  • @Ignasi not quite related as the first part is vertically centered. – daleif Oct 10 '16 at 10:14
  • @daleif That's why multirow is used in second example. – Ignasi Oct 10 '16 at 10:39
  • @Ignasi compare the amount of typing to using aligned (as suggested by campa) – daleif Oct 10 '16 at 10:47
6

Assuming amsmath here is one method (only the brace part, the rest is up to you)

I agree with Andrew, we don't really like questions of the sort: "please make this for me", there should some effort.

Here I've just given the foundation (memoir is irrelevant, just my default class)

\documentclass[a4paper]{memoir}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
  \left\{
     (D_1,D_2,D_0): 
     \begin{aligned}
       & A \\ & B \\ & C \\ & D  \\ & E \\ & F
     \end{aligned}
  \right\}
\end{equation*}
\end{document}

Addition: If you have several set definitions in your doc, it might be an idea to make a syntax for it. This is an adaption of an example in the mathtools manual:

\documentclass[a4paper]{memoir}
\usepackage{amsmath,mathtools}
\providecommand\given{}
\newcommand\SetSymbol[1][]{:}
% see the mathtools manual for a definition of \SetSymbol that works
% with |
\DeclarePairedDelimiterX\Set[1]\{\}{
  \renewcommand\given{\SetSymbol[\delimsize]}
  #1
}
\begin{document}
\begin{equation*}
  \Set*{
     (D_1,D_2,D_0)
     \given
     \begin{aligned}
       & A \\ & B \\ & C \\ & D  \\ & E \\ & F
     \end{aligned}
  }
\end{equation*}
\end{document}
3

First possibility:

\documentclass[a4paper]{article}
\usepackage{amsmath,amssymb}

\newcommand*{\E}{\mathbb{E}}

\begin{document}
\begin{equation*}
  \renewcommand*{\arraystretch}{1.33333}
  S = \left\{
    (D_1,D_2,D_0) :
    \begin{array}{@{}l@{}}
      \multicolumn{1}{c}{\exists f_{1}, f_{2} \text{ s.t.}} \\ 
      \hat{X}_1 = f_1(Y_1),\\
      \hat{X}_2 = f_2(Y_2),\\
      D_1 \geq \E[d_1(X,\hat{X}_1)],\\
      D_2 \geq \E[d_2(X,\hat{X}_2)],\\
      D_0 \geq \E[d_0(\hat{X}_1,\hat{X}_2)],
    \end{array}
  \right\}
  ,
\end{equation*}
\end{document}

The output is

Output of the first code sample

But the printout shown in the picture is probably generated by

\documentclass[a4paper]{article}
\usepackage{amsmath,amssymb}

\newcommand*{\E}{\mathbb{E}}

\begin{document}
\begin{equation*}
  S \triangleq \left\{
    (D_1,D_2,D_0) :
    \begin{aligned}
      &\exists f_{1}, f_{2} \text{ s.t.} \\ 
      \hat{X}_1 &= f_1(Y_1),\\
      \hat{X}_2 &= f_2(Y_2),\\
      D_1 &\geq \E[d_1(X,\hat{X}_1)],\\
      D_2 &\geq \E[d_2(X,\hat{X}_2)],\\
      D_0 &\geq \E[d_0(\hat{X}_1,\hat{X}_2)],
    \end{aligned}
  \right\}
  ,
\end{equation*}
\end{document}

Indeed, this time the output is

Output of the second code sample


Addition

Just for fun, here is how I would implement @daleif’s suggestion of using a general-purpose command like \Set.

The following code defines two “style declarations”:

  • when \ColonSets is in force, the separator between the two parts of the definition of a set is a colon (this is the default);

  • when \MvertSets is in force, the separator is a vertical bar.

The \Set command can be employed as usual, that is:

  • in its starred form (i.e., \Set*{...}{...}) it provides auto-sizing braces (and vertical bar, if appropriate);

  • with an optional argument (e.g., \Set[\Big]{...}{...}), a size specification can be passed in that argument, which is applied to the braces, and to the vertical bar if applicable.

Moreover, I have followed the advice given in footnote 9 on page 27 of the mathtools manual, of providing an independent command, named \SetSuchThat, that typeset the separator, with an optional scale modifier.

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly 
                                 % declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.

\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{mleftright}

\newcommand*{\E}{\mathbb{E}}
\newcommand*{\N}{\mathbb{N}}
\newcommand*{\No}{\N_{0}}

\newcommand*{\SetSuchThat}[1][]{} % reserve the name
\newcommand*{\ColonSets}{%
    \renewcommand*\SetSuchThat[1][]{:}%
}
\newcommand*{\MvertSets}{%
    \renewcommand*\SetSuchThat[1][]{%
        \mathclose{}%
        \nonscript\;##1\vert\penalty\relpenalty\nonscript\;%
        \mathopen{}%
    }%
}
\ColonSets % default
\DeclarePairedDelimiterX \Set [2] {\lbrace}{\rbrace}
    {\,#1\SetSuchThat[\delimsize]#2\,}



\begin{document}

Description of a set: \( X = \Set*{\frac{n-1}{n}}{n\in\No} \).

A ``handmade'' version, which permits line breaks within itself:
\( X = \bigl\{\, \frac{n+1}{n} \SetSuchThat[\big] n\in\No \,\bigr\} \).

Second ``handmade'' version, again unbreakable:
\( X = \mleft\{ \frac{n+2}{n} \SetSuchThat[\middle] n\in\No \mright\} \).

The ``big set'' written first with \texttt{array}
\begin{equation*}
    \renewcommand*{\arraystretch}{1.2}
    S \triangleq
    \Set*{(D_1,D_2,D_0)}{
        \begin{array}{@{}l@{}}
            \multicolumn{1}{c}{\exists f_{1}, f_{2} \text{ s.t.}} \\ 
            \hat{X}_1 = f_1(Y_1), \\
            \hat{X}_2 = f_2(Y_2), \\
            D_1 \geq \E[d_1(X,\hat{X}_1)], \\
            D_2 \geq \E[d_2(X,\hat{X}_2)], \\
            D_0 \geq \E[d_0(\hat{X}_1,\hat{X}_2)]
        \end{array}
    }
    ,
\end{equation*}
and then with \texttt{aligned}
\begin{equation*}
    S \triangleq
    \Set*{(D_1,D_2,D_0)}{
        \begin{aligned}
            &\exists f_{1}, f_{2} \text{ s.t.} \\ 
            \hat{X}_1 &= f_1(Y_1), \\
            \hat{X}_2 &= f_2(Y_2), \\
            D_1 &\geq \E[d_1(X,\hat{X}_1)], \\
            D_2 &\geq \E[d_2(X,\hat{X}_2)], \\
            D_0 &\geq \E[d_0(\hat{X}_1,\hat{X}_2)]
        \end{aligned}
    }
    .
\end{equation*}

Now we'll repeat the whole thing with the \verb|\MvertSets| declaration in
force.

\bigbreak

\MvertSets

Description of a set: \( X = \Set*{\frac{n-1}{n}}{n\in\No} \).

A ``handmade'' version, which permits line breaks within itself:
\( X = \bigl\{\, \frac{n+1}{n} \SetSuchThat[\big] n\in\No \,\bigr\} \).

Second ``handmade'' version, again unbreakable:
\( X = \mleft\{ \frac{n+2}{n} \SetSuchThat[\middle] n\in\No \mright\} \).

The ``big set'' written first with \texttt{array}
\begin{equation*}
    \renewcommand*{\arraystretch}{1.2}
    S \triangleq
    \Set*{(D_1,D_2,D_0)}{
        \begin{array}{@{}l@{}}
            \multicolumn{1}{c}{\exists f_{1}, f_{2} \text{ s.t.}} \\ 
            \hat{X}_1 = f_1(Y_1), \\
            \hat{X}_2 = f_2(Y_2), \\
            D_1 \geq \E[d_1(X,\hat{X}_1)], \\
            D_2 \geq \E[d_2(X,\hat{X}_2)], \\
            D_0 \geq \E[d_0(\hat{X}_1,\hat{X}_2)]
        \end{array}
    }
    ,
\end{equation*}
and then with \texttt{aligned}
\begin{equation*}
    S \triangleq
    \Set*{(D_1,D_2,D_0)}{
        \begin{aligned}
            &\exists f_{1}, f_{2} \text{ s.t.} \\ 
            \hat{X}_1 &= f_1(Y_1), \\
            \hat{X}_2 &= f_2(Y_2), \\
            D_1 &\geq \E[d_1(X,\hat{X}_1)], \\
            D_2 &\geq \E[d_2(X,\hat{X}_2)], \\
            D_0 &\geq \E[d_0(\hat{X}_1,\hat{X}_2)]
        \end{aligned}
    }
    .
\end{equation*}

IMHO\@, the first alternative looks better!

\end{document}

The output follows:

Output of the third code sample

Comment

I’ve edited the code in the third example in order to achieve the correct spacing also in “unusual” situations (see addition of \mathclose{} and mathopen{}. Moreover, it should be remarked that it is very easy to implement Barbara Beeton’s suggestion of increasing the space on the right of the colon in the “big set” description, if you feel so inclined: it suffices to add an explicit spacing command, e.g. \;, at the beginning of the second argument of the \Set command, like this:

\Set*{(D_1,D_2,D_0)}{\; % <-- added space
    \begin{array}{@{}l@{}}
        \multicolumn{1}{c}{\exists f_{1}, f_{2} \text{ s.t.}} \\ 
        \hat{X}_1 = f_1(Y_1), \\
        \hat{X}_2 = f_2(Y_2), \\
        D_1 \geq \E[d_1(X,\hat{X}_1)], \\
        D_2 \geq \E[d_2(X,\hat{X}_2)], \\
        D_0 \geq \E[d_0(\hat{X}_1,\hat{X}_2)]
    \end{array}
}

You might also want to add a similar amount of space at the end of the first argument; for example, here is how to add a thin space:

\Set*{(D_1,D_2,D_0)\,}{\; % <-- look here
    \begin{aligned}
        &\exists f_{1}, f_{2} \text{ s.t.} \\ 
        \hat{X}_1 &= f_1(Y_1), \\
        \hat{X}_2 &= f_2(Y_2), \\
        D_1 &\geq \E[d_1(X,\hat{X}_1)], \\
        D_2 &\geq \E[d_2(X,\hat{X}_2)], \\
        D_0 &\geq \E[d_0(\hat{X}_1,\hat{X}_2)]
    \end{aligned}
}
  • you missed the triangle over the = ;-) – daleif Oct 10 '16 at 12:07
  • @daleif: What triangle? Edit: Ah, the first “=”; I can’t remember off the top of my head what’s the name of that symbol. – GuM Oct 10 '16 at 12:08
  • 1
    @daleif: The name of that relation symbol turned out to be quite obvious: \triangleq. – GuM Oct 10 '16 at 12:32
  • some additional space following the colon would be an improvement. – barbara beeton Oct 10 '16 at 19:10
  • @barbarabeeton: I’m not sure it would. IMHO, the spacing around the colon shoud be symmetrical. In any case, it’s very easy to replace : with, say, :\,… :-) Thank you for your comment, anyway. – GuM Oct 10 '16 at 20:48

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.