# Creating a Table using LuaLaTex

I am just trying to create a simple table in LuaLaTex that summarizes an experiment. I needed to use it (LuaLaTex) to typset my document in Times New Roman font.

I am using Macbook Pro with OSX El Capitan. I have the latest version of LaTex installed for my OS.

Any help is appreciated!

• Please provide a bit more information about this mysterious table. E.g., how many rows and columns is it supposed to have? Will you be using "straight" LaTeX methods to create the table, or is there some Lua-specific programming involved? Can you at least post a scan of a hand-sketched outline of the table structure? – Mico Nov 18 '15 at 20:41
• My apologies! If there's a way to use just the "straight" LaTex methods, that'd be ideal. I'm just looking for a simple table: Title, two columns, with ten rows. That's it! – deathcat05 Nov 18 '15 at 20:43
• example \begin{tabular}{ll} \hline \multicolumn{2}{c}{Team sheet} \\ \hline GK & Paul Robinson \\ LB & Lucas Radebe \\ DC & Michael Duberry \\ DC & Dominic Matteo \\ RB & Dider Domi \\ MC & David Batty \\ MC & Eirik Bakke \\ MC & Jody Morris \\ FW & Jamie McMaster \\ ST & Alan Smith \\ ST & Mark Viduka \\ \hline \end{tabular} from en.wikibooks.org/wiki/LaTeX/Tables – touhami Nov 18 '15 at 20:59
• thank you @touhami! That was extremely helpful! I can figure it out from there! I didn't know if it was as easy as using {tabular} and \hline. Turns out, it is! Thanks again! – deathcat05 Nov 18 '15 at 21:00

You haven't exactly provided a lot of details about the table you wish to create. In the following example, a table environment is set up to house a \caption (along with a \label so that the table may be cross-referenced elsewhere in the document) as well as a two-column tabular environment. The macros \toprule, \midrule, and \bottomrule -- all provided by the booktabs package -- are used to draw well-spaced horizontal rules.

For more introductory-level information about how to create tables in LaTeX, I would like to suggest you read sections 2.11.6 ("tabular") and 2.12 ("floating bodies") of the The not so Short Introduction to LaTeX2e. The user guide of the booktabs package provides excellent information on how to go about creating professional-looking tables.

% !TEX TS-program = lualatex
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Times Roman} % Times Roman text font
\usepackage{booktabs,caption}

\begin{document}

\begin{table}
\caption{A two-column table}
\label{tab:twocol}
\centering
\begin{tabular}{cc}
\toprule
\midrule
a & b \\
c & d \\
e & f \\
g & h \\
i & j \\
k & l \\
m & n \\
o & p \\
q & r \\
s & t \\
\bottomrule
\end{tabular}
\end{table}
\end{document}

• I appreciate the resource you offered. Didn't know where to look specifically. I have some reading to do! – deathcat05 Nov 18 '15 at 21:02
• @Mico, consider being clear that there's nothing Lua specific about it... – PTNobel Nov 19 '15 at 3:18
• @PTNobel - Maybe not Lua-specific, but there's \usepackage{fontspec} and \setmainfont{Times Roman} in the preamble, both to pick up one of the few details the OP provided... Both instructions work only with LuaLaTeX and XeLaTeX... – Mico Nov 19 '15 at 4:38