# Error on table inside a beamer

I'm preparing a presentation using the beamer class, and I need to put a tabular environment inside it and I always get the errors

Undefined control sequence \end{frame}

and

Missing number, treated as zero \end{frame}

The document is not compiling.

I'm kinda new to LaTeX and I keep all my packages from document to document, I forgot what are some for. Do you have an idea what is happening?

\PassOptionsToPackage{table}{xcolor}
\documentclass[xcolor=dvipsnames]{beamer}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{graphicx}
\usepackage[french]{babel}
\usepackage{xlop} %opérations de beau gosse
\hypersetup{pdfpagemode=FullScreen} %probablement fullscreen at launch
\graphicspath{{images/}}
\usepackage{graphicx}

\usetheme{Berkeley}
\definecolor{color1}{RGB}{0,165,50} %creer une couleur
\setbeamercolor{normal text}{bg=white,fg=black}
\usecolortheme[named=color1]{structure} %utiliser une couleur

\theoremstyle{definition} %pour des boites a théorèmes
\newtheorem*{dfn}{Définition}

\usepackage{multicol}
\usepackage{setspace}
\usepackage{hyperref}
\usepackage{lastpage}
\usepackage{textcomp}
\usepackage{rotating}

%\usepackage{colortbl}
\usepackage[table]{xcolor}

\usepackage{setspace}

\begin{document}
\begin{frame}
\begin{figure}[H]
\doublespacing
\begin{center}
\begin{tabular}{cccc}

\hline
\textbf{Wear mechanisms} & \textbf{Applications} & \textbf{Deposited materials} & \textbf{Deposition processes}\\
\hline
Abrasive wear & Pump shafts & Cr-Co & HOVF, plasma, detonation\\
\hline
Adhesive wear & Pistons, brakes & Mo, Ni-Cr, Cu-Ni-In & Plasma, flame, HOVF\\
\hline
Contact wear & Aircraft leading edge & Tungsten carbide, Co & Detonation HVOF\\
\hline
Erosion & Power plant fan & Tungsten carbide, $\textnormal{Al}_{2}\textnormal{O}_{3}$, $\textnormal{Cr}_{2}\textnormal{O}_{3}$ & Detonation, HVOF\\
\hline

\end{tabular}
\caption{Examples of thermal sprayed coatings against wear}
\end{center}
\end{figure}
\end{frame}
\end{document}

• It will be easy to help you if you provide us with a complete example, starting with \documentclass and finishing with \end{document}. It should include all packages and styles you need to reproduce the problem which is different from all packages and styles you use in your complete document. Jan 8, 2014 at 15:25
• All packages used is the document added to the code. Jan 8, 2014 at 15:49
• Comment out \doublespacing and your code will compile. Jan 8, 2014 at 15:58
• You surely don't need all those packages to reproduce your problem. Jan 8, 2014 at 16:41
• Welcome to TeX.SX! Please note that it's recommended to use \centering inside a figure environment instead of the center environment. See tex.stackexchange.com/questions/23650/… for more details. Jan 8, 2014 at 16:55

As I told you, the problem with your code was command \doublespacing. Commenting it out, your code will compile without problems. You wanted it to "wider" table spacing. If this means a larger distance between tabular text and separation lines you have several alternatives. One of them consists in fixing \extrarowheight from array package. Next code (taken from "The LaTeX Companion, 2ed") shows how to use it and its effects on rows height.

\begin{tabular}{|>{\large}c|>{\large\bfseries}l|>{\itshape}c|}
\hline A & B & C\\\hline 100 & 10 & 1\\\hline
\end{tabular}

\setlength\extrarowheight{4pt}
\begin{tabular}{|>{\large}c|>{\large\bfseries}l|>{\itshape}c|}
\hline A & B & C\\\hline 100 & 10 & 1\\\hline
\end{tabular}


In any case I prefer to use booktabs package and its \top-\mid-\bottomrule commands. I think results are good enough without any other adjustments.

Next code shows an example typesetting your table inside a beamer frame. I've made some adjustments to fit all table in one frame.

1. Used \small to reduce font size
2. Used array package for >{decl} and center cell text
3. Used p{column width} cell types
4. Used booktabs package

The complete code is

\PassOptionsToPackage{table}{xcolor}
\documentclass[xcolor=dvipsnames]{beamer}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[french]{babel}

\usetheme{Berkeley}
\definecolor{color1}{RGB}{0,165,50} %creer une couleur
\setbeamercolor{normal text}{bg=white,fg=black}
\usecolortheme[named=color1]{structure} %utiliser une couleur

%\usepackage{lastpage}
\usepackage{textcomp}
\usepackage{booktabs}
\usepackage{array}
%\usepackage[table]{xcolor}

%\usepackage{setspace}

\begin{document}
\begin{frame}
\begin{figure}%[H]
\centering

{\small\begin{tabular}{%
>{\centering\hspace{0pt}}p{.2\textwidth}
>{\centering\hspace{0pt}}p{.2\textwidth}
>{\centering\hspace{0pt}}p{.2\textwidth}
>{\centering\hspace{0pt}}p{.2\textwidth}}

\toprule
\textbf{Wear mechanisms} & \textbf{Applications} & \textbf{Deposited materials} & \textbf{Deposition processes}\tabularnewline
\midrule
Abrasive wear & Pump shafts & Cr-Co & HOVF, plasma, detonation\tabularnewline
\midrule
Adhesive wear & Pistons, brakes & Mo, Ni-Cr, Cu-Ni-In & Plasma, flame, HOVF\tabularnewline
\midrule
Contact wear & Aircraft leading edge & Tungsten carbide, Co & Detonation HVOF\tabularnewline
\midrule
Erosion & Power plant fan & Tungsten carbide, $\textnormal{Al}_{2}\textnormal{O}_{3}$, $\textnormal{Cr}_{2}\textnormal{O}_{3}$ & Detonation, HVOF\tabularnewline
\bottomrule

\end{tabular}}
\caption{Examples of thermal sprayed coatings against wear}

\end{figure}
\end{frame}

\begin{frame}

\begin{tabular}{|>{\large}c|>{\large\bfseries}l|>{\itshape}c|}
\hline A & B & C\\\hline 100 & 10 & 1\\\hline
\end{tabular}

\setlength\extrarowheight{4pt}
\begin{tabular}{|>{\large}c|>{\large\bfseries}l|>{\itshape}c|}
\hline A & B & C\\\hline 100 & 10 & 1\\\hline
\end{tabular}

\end{frame}

\end{document}


The final result is