[Tex/LaTex] tabular columns too wide

columnstables

I want to fit the following table on a beamer slide.

\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
A & B & C & D & E & F & G & H & I & J & K & L & M & N & O & P & Q & R & S & T & U & V & W &   X & Y & Z \\
G & T & U & J & C & P & L & D & O & R & Y & W & X & Z & F & I & V & Q & S & K & A & N & E & M & H & B \\
\end{tabular}

However it won't fit, because there is too much space in a single column. If the borders were to perfectly enclose the letters, it would fit.

Does anyone know how to do that?

Best Answer

Modify the length \tabcolsep to compress the table horizontally.

\documentclass[smaller]{beamer}
\usepackage[T1]{fontenc}
\usepackage{fix-cm}

\setlength{\tabcolsep}{2pt}

\begin{document}
  \begin{frame}
    \begin{tabular}{|*{26}{c|}}
      A & B & C & D & E & F & G & H & I & J & K & L & M & N & O & P & Q & R & S & T & U & V & W &   X & Y & Z \\
      G & T & U & J & C & P & L & D & O & R & Y & W & X & Z & F & I & V & Q & S & K & A & N & E & M & H & B \\
    \end{tabular}
  \end{frame}
\end{document}
Related Question