3

I am trying to generate latex output as given below.

enter image description here

However, the types is not coming properly aligned. It looks like it subscribes to the previous array environment. Could you please point out the error?

My code is as follows -

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

\def    \R      {\mathbb{R}}

\begin{document}

\begin{equation}
    M_2=\left\{ 
    \begin{array}{r}
    variables : \left\{ \begin{array}{r} 
    inputs : x \\
    outputs : y 
    \end{array}
    \right.\\
    types : x,y \in \R \\   
    behaviors :  y = e^x \\  
    \end{array}
    \right.
\end{equation}
\end{document}
3

Here is what you need:

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

\def\R{\mathbb{R}}

\begin{document}

\begin{equation}
    M_2=\left\{ 
    \begin{array}{rl}
      \text{variables :} & \left\{
    \begin{array}{r} 
      \text{inputs :} x \\
      \text{outputs :} y 
    \end{array}
      \right.\\
      \text{types :} & x,y \in \R \\   
      \text{behaviors :} &  y = e^x \\  
    \end{array}
    \right.
\end{equation}
\end{document}

And the output is here:

enter image description here

Similarly to the tabular environment, you can define multiple columns in the array and separate them by &.

Additionally you can put some text in \text{} to typeset it in roman.

1
  • @MarcvanDongen Yes, I know, I realized it right after I posted the answer and edited it. Thanks anyway. – Václav Pavlík Sep 29 '14 at 11:31
6

I would use cases here:

% arara: pdflatex

\documentclass{article}
\usepackage{amssymb,mathtools}
\newcommand*\R{\mathbb{R}}

\begin{document}
    \begin{equation}
        M_2 = \begin{cases}
              \text{variables:} &\begin{cases}
                                 \text{inputs:} &x\\
                                 \text{outputs:} &y
                                 \end{cases}\\
              \text{types:}     &x,y \in \R\\
              \text{behaviors:} &y = e^x
              \end{cases}
    \end{equation}
\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.