2
\begin{table}[ht]

\caption{Using Quasi-Experimental Variation}

\begin{center}

\begin{tabular}{@{}lccc@{}}

\hline

\hline
 & & Is the Good Rival in Consumption?: (Yes)

  & Is the Good Rival in Consumption?: (No)
\\

\hline

Is the Good Excludable?
 &  (Yes)
 & Private good (ice cream)
 & Impure public good (TV streaming)
 \\
\hline 
Is the Good Excludable?
& (No)
 &
Impure public good (crowded city sidewalk)
 & Pure public good (national defense)

\\
\hline

\hline 

\end{tabular}

\end{center}

\end{table}

enter image description here

For example, like the location I used the arrow to demonstrate. To move the "Is the Good Excludable" in front of third and fourth row.

2 Answers 2

3

Some suggestions:

  • Don't use table and center environments. There's no point in using table and figure environments in a beamer document since the environments don't "float" (in the Latex sense of the word).

  • Don't use \caption. Instead, move its argument to the argument of \frametitle.

  • Use a tabularx environment instead of a tabular environment, and allow line-wrapping in the two data columns.

  • Combine the first two columns, and provide more structure to the header row and the first column. Essentially, avoid repeating the questions Is the Good Rival in Consumption? and Is the Good Excludable?

  • Load the booktabs package and use its line-drawing macros in place of \hline.

enter image description here

\documentclass{beamer}
\usepackage{tabularx,booktabs}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\renewcommand\tabularxcolumn[2]{m{#1}}

\begin{document}
\begin{frame}[t]
\frametitle{Using Quasi-Experimental Variation}
\setlength{\tabcolsep}{4pt} % default: 6pt    
\begin{tabularx}{\textwidth}{@{} cCC @{}}
\toprule
 Is the Good Excludable? 
 & \multicolumn{2}{c@{}}{Is the Good Rival in Consumption?}\\
 \cmidrule(l){2-3}
 & Yes & No \\ 
\midrule
 Yes
 & Private good (ice~cream) & Impure public good (TV streaming) \\ 
\addlinespace
 No
 & Impure public good (crowded city sidewalk) & Pure public good (national defense) \\ 
\bottomrule
\end{tabularx}

\end{frame}
\end{document} 

Addendum to address the OP's follow-up request. Here are two alternative solutions, which both place the string "Is the Good Excludable" in a column by itself on the far-left, while allowing line-breaking in that column. The first alternative uses full-width rules, and the second employs rules that span columns 3 and 4 only. (Many thanks to @vonbrand for leaving a comment that suggested the second alternative!)

enter image description here

\documentclass{beamer}
\usepackage{tabularx,booktabs,multirow}
% define a centered, variable-width version of the 'X' column type:
\newcolumntype{C}[1]{>{\centering\arraybackslash%
        \hsize=#1\hsize\linewidth=\hsize}X}
\renewcommand\tabularxcolumn[1]{m{#1}}
\newlength\mylen
\settowidth\mylen{Excludable?} % measure width of first col.

\begin{document}
\begin{frame}
\frametitle{Using Quasi-Experimental Variation}

%%% First alternative solution: rules span full width of the text block
\begin{tabularx}{\textwidth}{@{} 
    >{\raggedright}p{\mylen} c C{1.1} C{0.9} @{}}
\toprule
 & & \multicolumn{2}{c@{}}{Is the Good Rival in Consumption?}\\
 \cmidrule(l){3-4}
 & & Yes & No \\
\midrule
 \multirow{3}{=}{Is the Good Excludable?}
 & Yes
 & Private good (ice~cream) 
 & Impure public good (TV streaming) \\ \addlinespace
 & No
 & Impure public good (crowded city sidewalk) 
 & Pure public good (national defense) \\
\bottomrule
\end{tabularx}

\bigskip\medskip
%%% Second alternative solution: rules span only columns 3 and 4
\begin{tabularx}{\textwidth}{@{} 
    >{\raggedright}p{\mylen} c C{1.1} C{0.9} @{}}
\cmidrule[\heavyrulewidth](l){3-4}
 & & \multicolumn{2}{c@{}}{Is the Good Rival in Consumption?}\\
 \addlinespace %
 & & Yes & No \\
\cmidrule[\lightrulewidth](l){3-4}
 \multirow{3}{=}{Is the Good Excludable?}
 & Yes
 & Private good (ice~cream) 
 & Impure public good (TV streaming) \\ \addlinespace
 & No
 & Impure public good (crowded city sidewalk) 
 & Pure public good (national defense) \\
\cmidrule[\heavyrulewidth](l){3-4}
\end{tabularx}
\end{frame}
\end{document}
6
  • I appreciate your answer, excellent. I want to modify the table a little bit. how can I move "Is the Good Excludable" in front of third and fourth row? Thanks a lot!
    – user149250
    Commented Feb 24, 2020 at 12:41
  • I showed you the location I wanted to move to below.
    – user149250
    Commented Feb 24, 2020 at 12:43
  • @user149250 - Please see the addendum I post a short while ago.
    – Mico
    Commented Feb 24, 2020 at 13:17
  • Thank you so much, I really appreciate.
    – user149250
    Commented Feb 24, 2020 at 13:38
  • 1
    I'd forget the line under the column header (for symmetry with the side "header").
    – vonbrand
    Commented Feb 25, 2020 at 22:04
0

You can use the command \resizebox around your tabular, if you import the graphicx package:

\usepackage{graphicx}

......

\resizebox{\linewidth}{!}
     {\begin{tabular{lccc}

      .......

      \end{tabular}
      }

enter image description here

2
  • 5
    If one recommends using \resizebox, one should automatically be willing to hand out magnifying glasses too...
    – Mico
    Commented Feb 24, 2020 at 11:25
  • Thank you very much! But I wanted the table in the middle of table with multiple lines in each cell. is that possible? Much appreciated.
    – user149250
    Commented Feb 24, 2020 at 11:33

You must log in to answer this question.

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