0

I'm learning to use LaTeX with Overleaf and I cannot solve this problem.

I want to center both vertically and horizontally the first row, while increasing the space between lines and adding enumerate. Everything I try doesn´t work.

This is the code:

\begin{table}
\begin{center}
\setlength{\tabcolsep}{10pt} % Default value: 6pt
\renewcommand{\arraystretch}{1.5} % Default value: 1
\begin{tabular}{p{8cm}}
\toprule
\centerline{\textbf{Titleeeeeeeeeee}}  \\
\hline
\begin{enumerate}
  \item aaaaaaaaaaaa
  \item bbbbbbbbbbbbbbbb
  \item cccccccccccccccccccccc
  \item ddddddddd
  \item eeeeeeeeeeeeeeeeeeeeeeeeeeeeee
\end{enumerate}\\
\toprule
\end{tabular}
\caption{\label{tab:xxxxx} xxxxxxxxxxxxxxxxxxxxxxxx}
\end{center}
\end{table}

And this is the result,

enter image description here

3
  • 2
    Welcome to TeX.SX! Please help us (and also you) and add a minimal working example (MWE), that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass and ending with \end{document}.
    – Bobyandbob
    Jun 27 '18 at 10:05
  • see tex.stackexchange.com/questions/347253.
    – Zarko
    Jun 27 '18 at 11:21
  • Why do you use \toprule for the line at the bottom of the table instead og \bottomrule? Regarding the centered alignment in the first row, you might want to use \multicolumn or \makecell instead of \centerline.
    – leandriis
    Jun 27 '18 at 12:43
1

That-a-way? Note you shouldn't use the centerenvironment within table, as it adds unwanted vertical spacing. Use the \centering directive instead. The makecell package allows for line breaks in standard cells and a common formatting for cells introduced by \makecell or \thead. Last, you can define ‘cell gapes’ which are vertical spacing added at the top and bottom of cells with the \makegapedcells command.

\documentclass{article}
\usepackage{makecell, booktabs}
\usepackage{enumitem}
\renewcommand{\theadfont}{\normalsize\bfseries}
\makeatletter
\newcommand*{\compress}{\@minipagetrue}
\makeatother

\begin{document}

\begin{table}
\centering
\setlength{\tabcolsep}{10pt} % Default value: 6pt
\setcellgapes{10pt}\makegapedcells
\begin{tabular}{>{\compress}p{8cm}}
\toprule
\thead{Titleeeeeeeeeee} \\
\midrule
\begin{enumerate}[after=\vspace*{-\dimexpr\baselineskip + \partopsep}, wide=0pt, leftmargin=*]
  \item aaaaaaaaaaaa
  \item bbbbbbbbbbbbbbbb
  \item cccccccccccccccccccccc
  \item ddddddddd
  \item eeeeeeeeeeeeeeeeeeeeeeeeeeeeee
\end{enumerate}\\
\bottomrule
\end{tabular}
\caption{\label{tab:xxxxx} xxxxxxxxxxxxxxxxxxxxxxxx}
\end{table}

\end{document} 

enter image description here

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.