0

I'm trying to make a table in which most columns have the same width, and text in them is centered. However, the columns are very narrow, and the typical answer (make a new column type using \centering) isn't working. LaTeX is making sure that there's some minimum padding on the left, resulting in this:

non-centered columns

(Notice how IF is pretty well centered, but EX and MEM are absolutely not.)

Right now my custom column type is done like this:

\newcolumntype{C}{>{\footnotesize\centering\arraybackslash}m{1.5ex}}

Does anyone have any idea how I can get this text to be truly centered?

  • 1
    Looks like & could be missing between MEM and WB. Please post the entire code for the tabular environment. – Mico May 4 '16 at 0:59
  • Nope. Just checked. \texttt{lw}&\texttt{\$t1, 0(\$s0)}&IF&ID&EX&MEM&WB&&&&&&&&&&&\\ – Adam Smith May 4 '16 at 1:00
  • 1
    You may have to reduce the inter-column spacing by adding something like \setlength{\tabcolsep}{<len>} before the tabular (or placing it inside a group to limit the scope of the change). Either fix <len> or use something relative, like .5\tabcolsep to reduce the current \tabcolsep to 50% of its value. – Werner May 4 '16 at 1:03
  • That did it Werner! Thanks. (If you want to make a real answer rather than a comment, I'll gladly accept it.) – Adam Smith May 4 '16 at 1:06
  • 1
    Please in the future always provide a complete compilable document. Why make people guess what you might or might not have written? If nobody comments or answers, will you be able to guess what people might have suggested had you provided them sufficient information to understand and diagnose the problem? You are in a better position to guess than us - at least you have the problem! – cfr May 4 '16 at 1:10
2

You may have to reduce the inter-column spacing by adding something like \setlength{\tabcolsep}{<len>} before the tabular (or placing it inside a group to limit the scope of the change, like inside a table environment). Either fix <len> or use something relative, like .5\tabcolsep to reduce the current \tabcolsep to 50% of its value.

\tabcolsep has a default value of 6pt under the regular document classes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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