When it comes to style-based code, tikz
and its derivatives lead the way. In terms of tables in TeX
, the pgfplotstable
seems to fit the bill perfectly for this question.
It has many, many different options, as detailed in the manual. The pgfplotstableset
command can be used at any stage in the document- if used in the preamble as follows (for example), then it will apply the style to every occurrence of pgfplotstabletypeset
% global settings
\pgfplotstableset{
every head row/.style={
before row=\toprule,after row=\midrule},
every last row/.style={
after row=\bottomrule},
col sep = &,
row sep=\\,
string type,
}
Most of these options should be fairly self-explanatory; of course, these particular settings rely on loading the booktabs
package. In the document, you now only have to type
\pgfplotstabletypeset{
person & singEnglish & singGaeilge & pluralEnglish & pluralGaeilge\\
1st & at me & agam & at us & againn\\
2st & agat & at you & agaibh & other \\
3rd & at him & aige & at them & acu\\
& at her & aici & &\\
}
and you will get a beautiful table

If you choose to have your data separated by a comma (perhaps you're reading it from a file), then you override the settings locally:
\pgfplotstabletypeset[col sep=comma]{
person , singEnglish , singGaeilge , pluralEnglish , pluralGaeilge\\
1st , at me , agam , at us , againn\\
2st , agat , at you , agaibh , other \\
3rd , at him , aige , at them , acu\\
, at her , aici , ,\\
}
There are so many more options that you can play with, as detailed in the documentation
, including using the array
and colortbl
packages.
A complete MWE follows
\documentclass{article}
\usepackage{booktabs}
\usepackage{pgfplotstable}
% global settings
\pgfplotstableset{
every head row/.style={
before row=\toprule,after row=\midrule},
every last row/.style={
after row=\bottomrule},
col sep = &,
row sep=\\,
string type,
}
\begin{document}
\pgfplotstabletypeset{
person & singEnglish & singGaeilge & pluralEnglish & pluralGaeilge\\
1st & at me & agam & at us & againn\\
2st & agat & at you & agaibh & other \\
3rd & at him & aige & at them & acu\\
& at her & aici & &\\
}
\pgfplotstabletypeset[col sep=comma]{
person , singEnglish , singGaeilge , pluralEnglish , pluralGaeilge\\
1st , at me , agam , at us , againn\\
2st , agat , at you , agaibh , other \\
3rd , at him , aige , at them , acu\\
, at her , aici , ,\\
}
\end{document}