3

How to make the starred tabular to center text:

\documentclass[varwidth]{standalone}
\begin{document}
    \begin{tabular*}{\linewidth}{@{}c@{\extracolsep{\fill}}}
        \hline
            Text to be centered \\
        \hline
    \end{tabular*}
\end{document}

Result:

enter image description here

How is that possible to make the text centered?

2
  • For what is the \extracolsep{\fill} used for? Try it without. Also tabular* might just extend the table rules but not increase the cell width. Jul 3, 2013 at 10:29
  • @MartinScharrer \extracolsep is the documented interface to changing \tabskip in LaTeX so it wasn't a bad guess even though it doesn't work. (Especially as I don't think any documented use works in this instance) Jul 3, 2013 at 11:00

1 Answer 1

3

This may not be quite the documented interface....

\documentclass[varwidth]{standalone}
\begin{document}

{\tabskip=\fill\newskip\tabskip
    \begin{tabular*}{\linewidth}{@{}c@{}}
        \hline
            Text to be centered \\
        \hline
    \end{tabular*}}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .