Text FormattingHow can we get smaller spacing with tabular

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
casperyc
Posts: 50
Joined: Thu Oct 15, 2009 11:23 pm

How can we get smaller spacing with tabular

Post by casperyc »

Hi,

Code: Select all

\documentclass{article}

\begin{document}

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

\end{document}
This seems to be pretty BIG spaced.

How could I change to a smaller spacing like in the PDF file attached?

Thanks.

casper
Attachments
wanted.pdf
(38.41 KiB) Downloaded 215 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

How can we get smaller spacing with tabular

Post by localghost »

Modify the length \tabcolsep. It determines the separation of columns in a tabular environment.

Code: Select all

\documentclass{article}

\begin{document}
  \begin{table}[!ht]
    \centering
    \setlength{\tabcolsep}{1pt}
    \begin{tabular}{*{27}{c}}
      plain text & 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 \\
    \end{tabular}
  \end{table}
\end{document}

Best regards
Thorsten
casperyc
Posts: 50
Joined: Thu Oct 15, 2009 11:23 pm

Re: tabular problem

Post by casperyc »

why it did not 'seem' to effect the colsep of 'plaintext'?
i thought if i do that, it would set the column width to be the same as 'A-Z'.

Thanks.

casper
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

How can we get smaller spacing with tabular

Post by localghost »

It's not about the widths of the single columns. These are determined by their contents. You can see the effect of the length \columnsep by adding a vertical between the columns and modifying this length again.
Post Reply