Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
5  
You can use @{}c@{} instead of c to remove the cell spacing. Also try to set \tabcolsep to 0pt. –  Martin Scharrer Dec 14 '11 at 14:28
2  
have you considered to redefine \tabcolsep, the separation between columns. Also you could delete it completely with {@{}c@{}...}. A smaller font would probably be better. Maybe using tabularx you can squeeze it to textwidth. A working example would be good. Some beamer themes have a side bar and some don't... –  Martin H Dec 14 '11 at 14:29
3  
@MartinScharrer's suggestion should work just fine for you. Note that you can use the * notation to make things a little easier on you. You won't have to change 26 occurences. Just go |@{}c@{}*{25}{|@{}c@{}}|. –  Roelof Spijker Dec 14 '11 at 14:35
1  
The @{}c@{} method works! The result fits, but a little bit of spacing would be ok. Is there a way to do a little bit of spacing and keep the *-notation? –  Ben Ruijl Dec 14 '11 at 15:49

2 Answers 2

up vote 6 down vote accepted

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}
share|improve this answer
    
How can I, if I even can, use this hint with tabular* environment? I've tried structure \begin{tabular*}{\textwidth}{cccc} and table was narrower than text width but \hlines were exceeding the table (they have full width). –  Crowley Feb 1 '12 at 11:00
\documentclass{beamer}
\begin{document}
  \begin{frame}
  \resizebox{\linewidth} {\height}{%
    \setlength\tabcolsep{2pt}%
    \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}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.