4

I am currently having the following beamer frame but I would like it to be aligned the table next to the problem.

enter image description here

I would like to have the optimization problem to the left and the table to the right. I am not sure how to float the table to right

The code is here http://pastebin.com/CdZnGBc4

    \documentclass[t]{beamer}
    \usetheme{Madrid}
    \usepackage{graphicx}
    \usepackage{tikz}
    \usetikzlibrary{positioning}
    \usepackage{multirow}
    \usepackage{color}
    \usepackage{tablefootnote}
    \usepackage{amssymb}
    \usepackage{array}
    \usepackage{arydshln}

    \begin{document}

    \begin{frame}{}{}
    \begin{align*}
    \max \quad b^T y \\
    A^Ty + s &= c \\
    s &\geq 0 
    \end{align*}

    \begin{table}[]
    \centering

    \begin{tabular}{|c|l:c:l:l:l|l|l|l|l|l|}
    \hline
    obj                                                               & \multicolumn{1}{c:}{$0 \hdots 0$} & \multicolumn{4}{c:}{$-x_B^T$}                                   & \multicolumn{5}{l|}{$0 \hdots 0$}                  \\ \hline
    \multirow{4}{*}{\begin{tabular}[c]{@{}c@{}}\\y\\ \\ \\s\end{tabular}} & \multicolumn{1}{c:}{}        & \multicolumn{4}{c:}{}                                   & \multicolumn{5}{l|}{}    
    \\& \multicolumn{1}{c:}{I} & \multicolumn{4}{c:}{$A_B^-T$}                                   & \multicolumn{5}{l|}{$\quad 0$}\\& \multicolumn{1}{c:}{} & \multicolumn{4}{c:}{}                                   & \multicolumn{5}{l|}{}\\ \hdashline%\cline{2-11} 
                                                                      & \multirow{3}{*}{$\quad 0$}            & \multicolumn{4}{c:}{\multirow{3}{*}{$-A_N^TA_B^{-T}$}} & \multicolumn{5}{l|}{\multirow{3}{*}{$\quad I$}} \\
                                                                      &                               & \multicolumn{4}{c:}{}                                           & \multicolumn{5}{l|}{}                   \\
                                                                      &                               & \multicolumn{4}{c:}{}                                           & \multicolumn{5}{l|}{}                   \\ \hline
    \end{tabular}
    \end{table}

    \end{frame}
\end{document}
7

1 Answer 1

3

To position elements besides each other, columns are pretty convenient with beamer.

I took the liberty to simplify the table a bit. Please check if it displays as you want.

\documentclass[t]{beamer}
\usetheme{Madrid}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{multirow}
\usepackage{tablefootnote}
\usepackage{amssymb}
\usepackage{array}
\usepackage{arydshln}

\begin{document}


\begin{frame}
    \begin{columns}[T,onlytextwidth]

        \begin{column}{.3\textwidth}
            \begin{align*}
            \max \quad b^T y \\
            A^Ty + s &= c \\
            s &\geq 0 
            \end{align*}
        \end{column}

        \begin{column}{.6\textwidth}
            \renewcommand{\arraystretch}{2.2}
            \begin{tabular}{|c|c:c:c|}
                \hline
                obj     & $0\dots0$ & $-x_B^T$          & $0\dots0$\\\hline
                y       & I         & $A_B^-T$        & 0\\\hdashline
                s       & 0         & $-A_N^TA_B^{-T}$  & 1\\\hline
            \end{tabular}
        \end{column}        

    \end{columns}
\end{frame}

\end{document}

enter image description here

Or if you want more control over the width of the table columns:

\documentclass[t]{beamer}
\usetheme{Madrid}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{multirow}
\usepackage{tablefootnote}
\usepackage{amssymb}
\usepackage{array}
\usepackage{arydshln}

\begin{document}


\begin{frame}
    \begin{columns}[T,onlytextwidth]

        \begin{column}{.3\textwidth}
            \begin{align*}
            \max \quad b^T y \\
            A^Ty + s &= c \\
            s &\geq 0 
            \end{align*}
        \end{column}

        \begin{column}{.6\textwidth}
            \renewcommand{\arraystretch}{2.2}
            \begin{tabular}{|c|c:>{\centering\arraybackslash}p{2.5cm}:c|}
                \hline
                obj     & $0\dots0$ & $-x_B^T$          & $0\dots0$\\\hline
                y       & I         & $A_B^-T$        & 0\\\hdashline
                s       & 0         & $-A_N^TA_B^{-T}$  & 1\\\hline
            \end{tabular}
        \end{column}        

    \end{columns}
\end{frame}

\end{document}

enter image description here

5
  • should i be using any packages?
    – Morpheus
    Nov 10, 2016 at 18:29
  • 1
    @Morpheus No, in fact you have too many packages. \usepackage{graphicx}, \usepackage{color} can be removed as beamer already provides these functionalities. Nov 10, 2016 at 18:31
  • 1
    (And TikZ loads both anyway.) By the way, \setlength\extrarowheight{4pt} will help a bit for the superscript T in the first row. Nov 10, 2016 at 18:33
  • @samcarter Thanks a lot for simplifying it. The reason for multicolumn is sometimes i need to have the cells big or small. Can i change the width of the cell $x_B^T$ to double of what it is now?
    – Morpheus
    Nov 10, 2016 at 19:06
  • 1
    @Morpheus See the edit. Nov 10, 2016 at 19:26

You must log in to answer this question.

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