# Serious problems with table layout

I have some issues when creating my OLS regression in LaTeX and really hope, that some of you could help me. (I do not know how to make more columns and to add text like: dependent/independent/reference)

I would like to create a table, which look like this:

My preamble look like this:

\documentclass[a4paper,12pt,oneside]{article}
\usepackage[english]{babel}
\usepackage{tikz}
\usepackage{pgf}
\usetikzlibrary{shapes,arrows,positioning,calc,threeparttable}
\usepackage{tabu}
\usepackage{hyperref}
\usepackage{longtable}
\usepackage{array}
\usepackage{multirow,tabularx,booktabs}
\begin{document}

\begin{table}[H]
\centering
\begin{threeparttable}
\caption{OLS}\label{OLS}
\medskip
\begin{tabular*}{1.0\textwidth}{
@{\extracolsep{\fill}}
l
S[table-format=4.0]
S[table-format=3.0]
S[table-format=3.0]
S[table-format=3.0]
S[table-format=2.0]
}
\toprule
& \multicolumn{2}{c}{Name1 Option1/Option2} & \multicolumn{2}{c}{Name2 Option1/Option2} & \multicolumn{2}{c}{Name3 Option1/Option2} & \multicolumn{2}{c}{Name4 Option1/Option2} \\
\cmidrule(lr){2-3} \cmidrule(lr){4-5}
& {Model 1} & {Model 2} & {Model 3} & {Model 4} & {Model 5} & {Model 6} & {Model 7} & {Model 8}
& & {Factor} & {Factor} & {Factor} & {Factor} & {Factor} & {Factor} & {Factor} & {Factor} & {Factor} & {Factor}
\\
\midrule
Name 1 & 0.39 (0.49) && 0.39 (0.49) && 0.39 (0.49) && 0.39 (0.49) && 0.39 (0.49) && 0.39 (0.49) && 0.39 (0.49) && 0.39 (0.49) \\
Name 2 & 0.39 (0.49) && 0.39 (0.49) && 0.39 (0.49) && 0.39 (0.49) && 0.39 (0.49) && 0.39 (0.49) && 0.39 (0.49) && 0.39 (0.49) \\
Name 1 x Name 2 & & 0.39 (0.49) & &  0.39 (0.49) & &  0.39 (0.49) & &  0.39 (0.49) \\
R2 \\
Name 1 \\
Name 2 \\
\bottomrule
\end{tabular*}
\begin{tablenotes}
\item[Note:] Long note
\end{tablenotes}
\end{threeparttable}
\end{table}


If the lines below "Option1/Option2" could be like this, it would be perfect.

All comments and other OLS setups are OK.

Here Mico:

Name 1$\times$ \ \ \ Name 2 & & 0.39 & & 0.39 & &  0.39 & & 0.39 \\
& & (0.49) & & (0.49) & & (0.49) & & (0.49) \\


A.F. -- It should be:

Name 1$\times$ & & 0.39 & & 0.39 & & 0.39 & & 0.39 \\
\ \ \ Name 2   & & (0.49) & & (0.49) & & (0.49) & & (0.49) \\


I daresay there's no danger, especially if "Name 2" is indented a bit, of your readers starting to think that " Name 2" is a different variable...

-

## 1 Answer

I've rearranged various parts of your code to make it look more like the images you've posted, since this is apparently how you would like the table to look. In particular, do note that if you want the standard errors associated with the coefficient estimates to show up below the coefficients, they need to be in their own separate row, not in the form 0.39 (0.49).

The most basic challenge you're facing is that you're attempting to convey an awful lot of information in one table, with 8 data columns as well as a header column. Assuming you're typesetting your document with "normal" margin settings (e.g., 1in all around), you've got to abbreviate the variable names quite aggressively to make every thing fit into the width of the text block. Even with these simplifications, it may not be possible to fit in 8 data columns if the numbers are wider than of the simple 0.38 type -- unless you start reducing the font size used to typeset the table (via directives such as \small or \footnotesize).

\documentclass[a4paper,12pt]{article}
\usepackage[english]{babel}
\usepackage[margin=1in]{geometry} % set margins as per your requirements
\usepackage{threeparttable,booktabs,siunitx}
\sisetup{input-symbols = ()} % don't treat parens as "uncertainty indicators"
\begin{document}
\begin{table}
\begin{threeparttable}
\caption{OLS}\label{OLS}
\medskip
\setlength\tabcolsep{1pt}  % Set this to some very small value ...
\begin{tabular*}{\textwidth}{ @{} p{2cm}
@{\extracolsep{\fill}}   % and let LaTeX provide the necessary "fill" amount
*{8}{S[table-format=2.3]} @{}}
\toprule
\emph{Ref.\ 1/0}
& \multicolumn{2}{c}{Name1}
& \multicolumn{2}{c}{Name2}
& \multicolumn{2}{c}{Name3}
& \multicolumn{2}{c@{}}{Name4}\\
& \multicolumn{2}{c}{Opt.1/Opt.2}
& \multicolumn{2}{c}{Opt.1/Opt.2}
& \multicolumn{2}{c}{Opt.1/Opt.2}
& \multicolumn{2}{c@{}}{Opt.1/Opt.2} \\
\cmidrule(lr){2-3} \cmidrule(lr){4-5}
\cmidrule(lr){6-7} \cmidrule(l){8-9}
& {(1)} & {(2)} & {(3)} & {(4)}
& {(5)} & {(6)} & {(7)} & {(8)} \\
\emph{Dep.\ var.}
& {Factor} & {Factor} & {Factor} & {Factor}
& {Factor} & {Factor} & {Factor} & {Factor} \\
\midrule
\emph{Indep.\ var.}\\
Name 1 & 0.39 & 0.39 & 0.39 & 0.39 & 0.39 & 0.39 & 0.39 & 0.39 \\
& (0.49) & (0.49) & (0.49) & (0.49) & (0.49) & (0.49) & (0.49) & (0.49) \\
Name 2 & 0.39 & 0.39 & 0.39 & 0.39 & 0.39 & 0.39 & 0.39 & 0.39 \\
& (0.49) & (0.49) & (0.49) & (0.49) & (0.49) & (0.49) & (0.49) & (0.49) \\
N1$\times$N2 & & 0.39 & & 0.39 & &  0.39 & & 0.39 \\
& & (0.49) & & (0.49) & & (0.49) & & (0.49) \\
\cmidrule{1-1}
R\textsuperscript{2} \\
Name 1 \\
Name 2 \\
\bottomrule
\end{tabular*}
\begin{tablenotes}
\item[Note:] Long note
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}


As a general piece of advice, I would like to suggest you consider showing just four data columns (and at most six) per table of this type. Paper (and electronic memory) are very cheap; there's no downside -- and plenty of upside -- to creating two tables, each with a header column and 4 (or 6) data columns. If you spring overly dense tables on your readers, you may encounter resistance as well as some outright hostility. That, or they will just refuse to read whatever you have to say in those tables...

-
You are my man, Mico. I know eight column are too much, but I have to present four OLS with 8 factors, why it would be OLS overkill, to present 8 tables. If I want the following name on two lines, how should I write this: N1$\times$N2 ? I mean "Name1 X Name2" would make extra unnecessarily space between numbers? – A. F. Dec 7 '13 at 19:24
Thanks for the compliment. :-) Could you write "Name 1 $\times$" on one line and "\ \ \ Name 2" on the next? (the backslash characters followed by space serve to indent the main text ("Name 2"). – Mico Dec 7 '13 at 19:29
It won't work. I do this: {Name 1 & & 0.39 & & 0.39 & & 0.39 & & 0.39 \\ & & (0.49) & & (0.49) & & (0.49) & & (0.49) \\ \ \ $\times$ Name 2 } – A. F. Dec 7 '13 at 19:40
It doesn't look that good. Should i delete "\\" after the numbers or? – A. F. Dec 7 '13 at 19:40
I have now edited my post. At the end, you can see if I am doing it wrong - or maybe direct me? – A. F. Dec 7 '13 at 19:55