3

I create a single column table using tabu.

\documentclass[preprint,5p,12pt]{elsarticle}
\usepackage{tabu}

\begin{document}

\begin{table}[htbp]
    \footnotesize
    \begin{center}
        \label{T:my_table}
        \everyrow{\hline}
        \tabulinesep=1.2mm
        \begin{tabu} to \linewidth {|X{l}|}
            \textbf{Headline 1} \\
            a \\
            b \\
            c \\
            \hline \hline
            \textbf{Headline 2} \\
            d \\
            e \\
            f \\
            g \\
        \end{tabu}
        \caption{Meaningful caption}
    \end{center}
\end{table}

\end{document}

This renders without a line on the right. How can i get a right border for all rows? enter image description here

1 Answers1

0

If you want an X column with left alignment (ragged right), use

X[l]

With X{l} you're asking for two columns, rather than one.

Full example:

\documentclass[preprint,5p,12pt]{elsarticle}
\usepackage{tabu}
\usepackage{lipsum}

\begin{document}

\begin{table}[htbp]
\centering
\footnotesize

\everyrow{\hline}
\tabulinesep=1.2mm

\begin{tabu} to \linewidth {|X[l]|}
\textbf{Headline 1} \\
\lipsum*[4] \\
b \\
c \\
\hline\hline
\textbf{Headline 2} \\
d \\
e \\
f \\
g \\
\end{tabu}

\caption{Meaningful caption}
\label{T:my_table}

\end{table}

\end{document}
  1. \lipsum is just for showing the final result for a long text in the column
  2. Don't use \begin{center}, but \centering as shown.
  3. The \label should go after \caption.

enter image description here

egreg
  • 1,121,712