Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jimratliff/e7a4389cb51e4fbf9548590d51070dc9 to your computer and use it in GitHub Desktop.
Save jimratliff/e7a4389cb51e4fbf9548590d51070dc9 to your computer and use it in GitHub Desktop.
Insert 6-column table with centered columns. #latex #snippet
\begin{table} [!htb] % p option positions table on its own page.
\centering
\caption{Generic 6-column table with centered columns}
%\label{table:NAME}
% Uncomment the below \rowcolors line to produce alternating shading of rows
%\rowcolors{2}{tableShade}{white} % start alternating shades from 2nd row (not counting header)
% K is my custom-specified column type, which is assumed to have been defined in the preamble as:
% \newcolumntype{K}[1]{>{\centering\arraybackslash}m{#1}}
% A "K" column is both centered horizontally and of the specified width
% To change to paragraph (full justification), change "K" to "m", which retains middle vertical alignment.
\begin{tabular}[t]{K{2.25cm}K{2.25cm}K{2.25cm}K{2.25cm}K{2.25cm}K{2.25cm}}
\toprule
1ColHeader & 2ColHeader & 3ColHeader & 4ColHeader & 5ColHeader & 6ColHeader \\
\midrule
R1C1 & R1C2 & R1C3 & R1C4 & R1C5 & R1C6 \\
R2C1 & R2C2 & R2C3 & R2C4 & R2C5 & R2C6 \\
R3C1 & R3C2 & R3C3 & R3C4 & R3C5 & R3C6 \\
\bottomrule
\end{tabular}
\end{table}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment