4

Is there a way to increase the length of my rules using \toprule, \bottomrule, and \midrule? I want them to extend past the text on both sides of the table a little bit.

Here's my minimal code:

\documentclass{article}
\usepackage{booktabs}

\begin{document}

\begin{table}[h]
\centering
\begin{tabular}{lc}
\toprule 
\emph{X} & \emph{Y} \\
\midrule 
1 & 2\\
3 & 4\\
\bottomrule
\end{tabular}
\end{table}

\end{document}

Thanks!

  • a quick solution is changing {lc} to something like {@{~~~}lc@{~~~}}. – chan1142 Oct 15 '16 at 2:43
  • Welcome! They already do extend a bit to the left and right. How much more extension do you wish? Off-topic: do not use h as the sole location option for a float. – cfr Oct 15 '16 at 2:55
3

You can force the space between columns using the @{<stuff>} column specification, where <stuff> could be \hspace{<len>} for a specific length. Using these on the outer columns you can make the horizontal rules extend out horizontally:

enter image description here

\documentclass{article}

\usepackage{booktabs}

\begin{document}

\begin{tabular}{ l c }
  \toprule 
  \emph{X} & \emph{Y} \\
  \midrule 
  1 & 2\\
  3 & 4\\
  \bottomrule
\end{tabular}

\bigskip

\begin{tabular}{ @{\hspace{2\tabcolsep}} l c @{\hspace{2\tabcolsep}} }
  \toprule 
  \emph{X} & \emph{Y} \\
  \midrule 
  1 & 2\\
  3 & 4\\
  \bottomrule
\end{tabular}

\end{document}

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.