# General Understanding

Basically, what I'm trying to do is streamline the entire process of creating tables for one or possibly a number of scientif papers. The ultimate objective would be to find something like a common style for tables, i.e. a rough draft/frame for (regular) tables as well as long tables. It should be said that I would like to cover strictly scientific tables.

I'm well aware of the fact that one should pose questions that are rather designed to have a clear answer than to trigger a discussion. Nevertheless, a stream of "Best practice questions" has emerged here, yet an issue like this one was never really dealt with. I've read quite a lot through the basics of typography of tables, scientific rules and packages relevant for tables; here's what I found most helpful:

However, I would like to take this a step further, and address how users actually employ packages and code to create tables.

Most importantly, I want these types of tables to look the same to the extent possible.

## Questions that could be addressed:

• What packages do you use? (Is there something more sofisticated that makes sense, like tabu etc.?)
• How do you scale to textwidth or whatever? (Personally, I find the resize/scalebox-approach quite appealing, because it gives you continous scalability as compared to discrete fontsizes. Anyway, I also kind of see the pitfalls and it won't work for longtables, right? Or, do you always use something like tabularx etc.)
• In which cases do you go to landscape mode?
• How do you choose to align columns? Is there a sensible way to align something like "56 (16%)" or would you choose two columns?
• How do you include formulae/equations in your tables?
• How do you achieve consistency in terms of style between regular and long tables? (As far as I'm concerned, the standard design seems to be quite dissimilar)
• How do you format your table notes? Iyo, what should be the smallest fontsize for table contents and notes compared to regular textsize?
• +Pretty much whatever comes to you mind
• How do you make sure you use this standardized tablesetting? I've created .xml files with the environment names/definitions, but have also seen new environments defined in the preamble.

Anyway, to sum this up, what I'm looking for is the answer to the question how do you personally fomat your tables.

To get an idea, in the following I will post an MWE for a regular and a long table:

# MWE/Environments

Preamble/Packages

\usepackage{longtable}
\usepackage{ifthen}
\usepackage{array}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage[flushleft]{threeparttable}
\usepackage{threeparttablex}
\usepackage{dcolumn}

\usepackage[labelfont=bf,format=plain,labelsep=colon,textformat=period,font={small,singlespacing},justification=justified,singlelinecheck=false,skip=6pt,belowskip=-6pt]{caption}


Standard Table

\begin{table}[htb]
\newcolumntype{.}{D{.}{.}{}}
\scalebox{1}{
\begin{threeparttable}
\begin{tabular}{ll}
\toprule
\midrule
\bottomrule
\end{tabular}
\begin{tablenotes}
\footnotesize
\end{tablenotes}
\end{threeparttable}}
\caption{}
\label{tab:}
\end{table}


Long Table

\begin{ThreePartTable}
\begin{TableNotes}
\vspace{-12pt}
\scriptsize\singlespacing
\item[a]

\end{TableNotes}
\begin{longtable}{ll}

\toprule
\toprule
\multicolumn{4}{c}{\textbf{Two-Stage Cross-Sectional Regressions}}\\

\multicolumn{4}{c}
{{\bfseries\tablename\ \thetable{}} -- {\itshape continued}}\\ \\

%\midrule
%\multicolumn{3}{|r|}{{Continued~on~next~page}}
%\\
%\midrule
\endfoot

\endlastfoot

%Tablecontents
%&//* &//

\insertTableNotes\\
\caption{}
\label{tab:}
\end{longtable}
\end{ThreePartTable}


Gladly, I will accept other tips for the automatization of including data into Latex tables. Also, I will do the necessary to keep this topic as well organized as possible. Please cosider keeping it open for a while, maybe I will be able to create a guideline from it.

# Edit:

Ok, there seems to be a need to further clarify what I am aiming at. Since I'm trying to figure out what a best practice - either in general or for my personal purposes - could look like, I would like to see glimpses or more of the "table practice". So if anyone who uses a somewhat standardized approach that goes beyond just typing in some basic tabular environment and is willing to share it, please do so!

• not sure the question is really clear enough to have an answer but never scale tables would be my advice. Feb 18 '16 at 17:10
• Feb 18 '16 at 17:37
• the ams has a preferred style for table captions. many (most?) of the available table packages set captions in a style that differs to varying degrees from the ams style, so when an author submits a manuscript for publication, the caption style has to be adjusted. this is not only a nuisance, in some cases it isn't at all easy to do. so i would plead for the ability to adjust caption styles in a manner that is flexible and uniform (if possible). Feb 18 '16 at 17:48
• Sounds like tex.stackexchange.com/questions/13744/… would be relevant to you :) Feb 18 '16 at 19:37
• Thanks so far! @DavidCarlisle: Ok, but is scaling really infinitely bad? It seems to be so much more efficient regarding time and white space. @Zarko: This is really more about implementation than about how tables should ideally look like. @cmhughes: This really comes closest to what I'm looking for. The pgfplotstable is something I hadn't taken into consideration, but I will look into it.
– Xima
Feb 19 '16 at 13:22

Ok, what I've come up with so far and what pretty much satisfies my requirements is the following:

This sets a common tablenotesize:

\makeatletter
\makeatother


And then I usually use tables that spread to textwidth. Thus in the longtable environment the width of the notes must be adopted manually. Furthermore, I pulled the notes closer to the table and alter the code in case the note is no reference to a mark in the table to avoid indentation.

\begin{ThreePartTable}
\singlespacing
\setlength\LTleft{0pt}
\setlength\LTright{0pt}
\renewcommand\TPTminimum{\textwidth}
\begin{TableNotes}
\vspace{-0.5em}
\item \leavemode\kern-\scriptspace\kern-\labelsep Notes:
%\item[a]

\end{TableNotes}
{%\fontsize
\begin{longtable}{@{\extracolsep{\fill}}ll}

\toprule
\midrule

\multicolumn{#columns}{c}
{\small{\bfseries\tablename\ \thetable{}} -- {\itshape continued}} \vspace{6pt}\\
\toprule

\midrule
%\multicolumn{#columns}{c}{{Continued~on~next~page}}
\\
\midrule
\endfoot

\endlastfoot
%Tablecontents
\insertTableNotes\\
\caption{}
\label{tab:}
\end{longtable}
\end{ThreePartTable}


Then for column-alignment I use the dcolumn-package and define the following column types and definitions or something similar. Depending on the numbers you have in your table and want to align columntypes could look like this:

\newcolumntype{.}{D{.}{.}{2.2}}
\newcolumntype{j}{D{.}{.}{1.2}}


I usually define them directly in the table-environment. Moreover, I put the following in the preable in order to use and align bold numbers in the tables as well in a convenient fashion. Make sure though that the columntypes of the bold multicolumn cells must coincide in dimensions with the general column definition: e.g. {2.2} to {2.2}

\makeatletter
\newcolumntype{B}[3]{>{\boldmath\DC@{#1}{#2}{#3}}c<{\DC@end}}
\newcolumntype{Z}[3]{>{\mathversion{nxbold}\DC@{#1}{#2}{#3}}c<{\DC@end}}
\makeatother

\newcommand\mcb[1]{\multicolumn{1}{Z{.}{.}{2.2}}{#1}} % shortcut macro


What I haven't been able to figure out yet, is how to have bold extented figures in the table using the mathptmx-package for example. In this case, one can always refer to the non-extended version, the Z-columntype for the code above.