I'm trying to draw the table of the image, but I can not find the way to do it with latex.
\begin{tabular}{|C{1cm}|C{1cm}|C{1cm}|C{1cm}|C{1cm}|C{1cm}|C{1cm}}
\hline
Tipo RA & \multicolumn{2}{c|}{Area [m$^2$]}& \multicolumn{2}{c|}{Volumen Semiesferico truncado} \\
1 &&&&&&\\ \hline
2 &&&&&&\\ \hline
3 &&&&&&\\ \hline
4 &&&&&&\\ \hline
5 &&&&&&\\ \hline
6 &&&&&&\\ \hline
7 &&&&&&\\ \hline
\end{tabular}
I'd suggest using booktabs:
\documentclass{article}
\usepackage{booktabs,siunitx,makecell}
\newcommand{\pz}{\phantom{0}}
\sisetup{
group-minimum-digits = 3
}
\begin{document}
\noindent
\begin{tabular}{ l *{6}{c} }
\toprule
& \multicolumn{4}{c}{Area [$m^2$]} & \\
\cmidrule{2-5}
& \multicolumn{2}{c}{Circular} & \multicolumn{2}{c}{El\'{\i}ptica} &
\multicolumn{2}{c}{\smash{\makecell[cb]{Volumen Semiesf\'erico \\ truncado [$m^3$]}}} \\
\cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(lr){6-7}
Tipo RA & Rango & Promedio & Rango & Promedio & Rango & Promedio \\
\midrule
ALTA & \num{20866}--\num{28983} & \num{24446} & \num{13354}--\num{18549} & \num{15645} & \num{589840}--\num{1201636} & \num{883786} \\
MEDIA & \num{16634}--\num{27254} & \num{20241} & \num{12476}--\num{20440} & \num{15180} & \num{539605}--\num{1131633} & \num{730582} \\
BAJA & \pz\num{3822}--\num{25577} & \num{16097} & \pz\num{3407}--\num{22735} & \num{14307} & \pz\num{75664}--\num{1063784} & \num{647366} \\
\bottomrule
\end{tabular}
\end{document}
In general, there is no need for vertical rules in a tabular, as the columnar display of information supports horizontal separation naturally.
Creating tables directly in LaTeX is not an easy task, I suggest you use tools that allow you to create tables for latex online such as: https://www.tablesgenerator.com/
Please add the following required packages to your document preamble:
\usepackage{multirow,multicol, makecell, booktabs}
\begin{tabular}{*{7}{c}}
\toprule
& \multicolumn{4}{c}{\smash{\makecell[c]{Area [$m^2$]}}}
& \multicolumn{2}{c}{\smash{\makecell[c]{Volumen Semiesférico \\ truncado [$m^3$]}}}\\
\cline{2-5}
& \multicolumn{2}{c}{Circular} & \multicolumn{2}{c}{Eliptica} & \\
\cline{2-7}
Tipo RA & Rango & Promedio & Rango & Promedio & Rango & Promedio \\
\midrule
ALTA & 20866-28983 & 24464 & 20866-28983 & 24464 & 20866-28983 & 24464 \\
MEDIA & 20866-28983 & 24464 & 20866-28983 & 24464 & 20866-28983 & 24464 \\
BAJA & 20866-28983 & 24464 & 20866-28983 & 24464 & 20866-28983 & 24464 \\
\bottomrule
\end{tabular}
Just a no-booktabs sketch, to reproduce your table as similar as possible. Using booktabs is of course recommended for a readability concept that holds everywhere but the first sight on the table would then change very much.
\documentclass{article}
\usepackage{multirow}
\begin{document}
Text
\begin{table}[ht]
{\sffamily%
\begin{tabular}{*{7}{c|}}
% be careful when nesting \multicolumn and \multirow
\cline{2-7}
\multirow{2}{*}{ } & \multicolumn{4}{|c|}{Area [$m^2$]} & \multicolumn{2}{c|}{\multirow{2}{*}{\shortstack[c]{Volumen Semiesf\'erico\\ truncado [$m^3$]}}}\\
\cline{2-5}
& \multicolumn{2}{c|}{Circular} & \multicolumn{2}{c|}{El\'{\i}ptica} & \multicolumn{1}{c}{} & \\
% second part below is standard
\hline
\multicolumn{1}{|c|}{Tipo RA} & Rango & Promedio & Rango & Promedio & Rango & Promedio\\
\hline
\multicolumn{1}{|c|}{ALTA} & 2 - 2 & 3 & 4 - 4 & 5 & 6 - 6 & 7\\
\hline
\multicolumn{1}{|c|}{MEDIA} & 2 - 2 & 3 & 4 - 4 & 5 & 6 - 6 & 7\\
\hline
\multicolumn{1}{|c|}{BAJA} & 2 - 2 & 3 & 4 - 4 & 5 & 6 - 6 & 7\\
\hline
\end{tabular}
}%
\end{table}
Text.
\end{document}
The output of this code is:
Alignments, line breaks and spacing may be considerably improved, also depending on your time and objectives.
Related
I have a table in latex. here is the code for it. My problem is the table is huge and and the content of it is not clear. My paper texts are shown in two columns and the table locates in one of those columns. I appreciate if anyone can help me how can I make the table content more clear for example is it good to expand it in a new page?
\begin{table}[]
\centering
\caption{Comparing accuracy of }
\label{table1}
\resizebox{\columnwidth}{!}{%
\begin{tabular}{|cccccccccccc|}
\hline
\rowcolor[HTML]{C0C0C0}
\multicolumn{12}{|c|}{\cellcolor[HTML]{C0C0C0}out\_1} \\ \hline
\rowcolor[HTML]{00D2CB}
\multicolumn{1}{|c|}{\cellcolor[HTML]{00D2CB}} & \multicolumn{1}{c|}{\cellcolor[HTML]{00D2CB}} & \multicolumn{5}{c|}{\cellcolor[HTML]{00D2CB}Accuracy result} & \multicolumn{5}{c|}{\cellcolor[HTML]{00D2CB}Precision result} \\ \hline
\rowcolor[HTML]{C0C0C0}
\multicolumn{1}{|c|}{\cellcolor[HTML]{C0C0C0}row} & \multicolumn{1}{c|}{\cellcolor[HTML]{C0C0C0}Train-Test percentage} & \multicolumn{1}{c|}{\cellcolor[HTML]{C0C0C0}TP} & \multicolumn{1}{c|}{\cellcolor[HTML]{C0C0C0}FP} & \multicolumn{1}{c|}{\cellcolor[HTML]{C0C0C0}FN} & \multicolumn{1}{c|}{\cellcolor[HTML]{C0C0C0}TN} & \multicolumn{1}{c|}{\cellcolor[HTML]{C0C0C0}Accuracy} & \multicolumn{1}{c|}{\cellcolor[HTML]{C0C0C0}TP} & \multicolumn{1}{c|}{\cellcolor[HTML]{C0C0C0}FP} & \multicolumn{1}{c|}{\cellcolor[HTML]{C0C0C0}FN} & \multicolumn{1}{c|}{\cellcolor[HTML]{C0C0C0}TN} & Accuracy \\ \hline
\multicolumn{1}{|c|}{1} & \multicolumn{1}{c|}{10-90} & \multicolumn{1}{c|}{17508} & \multicolumn{1}{c|}{5433} & \multicolumn{1}{c|}{8} & \multicolumn{1}{c|}{35961} & \multicolumn{1}{c|}{0.907638771} & \multicolumn{1}{c|}{18715} & \multicolumn{1}{c|}{4226} & \multicolumn{1}{c|}{8} & \multicolumn{1}{c|}{35961} & 0.928127652 \\ \hline
\multicolumn{1}{|c|}{2} & \multicolumn{1}{c|}{20-80} & \multicolumn{1}{c|}{17313} & \multicolumn{1}{c|}{5433} & \multicolumn{1}{c|}{8} & \multicolumn{1}{c|}{29610} & \multicolumn{1}{c|}{0.896092735} & \multicolumn{1}{c|}{18476} & \multicolumn{1}{c|}{4270} & \multicolumn{1}{c|}{8} & \multicolumn{1}{c|}{29610} & 0.918302651 \\ \hline
\multicolumn{1}{|c|}{3} & \multicolumn{1}{c|}{30-70} & \multicolumn{1}{c|}{17097} & \multicolumn{1}{c|}{5433} & \multicolumn{1}{c|}{8} & \multicolumn{1}{c|}{23281} & \multicolumn{1}{c|}{0.881250136} & \multicolumn{1}{c|}{18223} & \multicolumn{1}{c|}{4307} & \multicolumn{1}{c|}{8} & \multicolumn{1}{c|}{23281} & 0.905825094 \\ \hline
\multicolumn{1}{|c|}{4} & \multicolumn{1}{c|}{40-60} & \multicolumn{1}{c|}{16587} & \multicolumn{1}{c|}{5429} & \multicolumn{1}{c|}{3} & \multicolumn{1}{c|}{17256} & \multicolumn{1}{c|}{0.86171513} & \multicolumn{1}{c|}{17760} & \multicolumn{1}{c|}{1255} & \multicolumn{1}{c|}{3} & \multicolumn{1}{c|}{17256} & 0.891582217 \\ \hline
\multicolumn{1}{|c|}{5} & \multicolumn{1}{c|}{50-50} & \multicolumn{1}{c|}{16155} & \multicolumn{1}{c|}{5428} & \multicolumn{1}{c|}{3} & \multicolumn{1}{c|}{16942} & \multicolumn{1}{c|}{0.834056465} & \multicolumn{1}{c|}{17338} & \multicolumn{1}{c|}{4245} & \multicolumn{1}{c|}{3} & \multicolumn{1}{c|}{11142} & 0.870202884 \\ \hline
\multicolumn{1}{|c|}{6} & \multicolumn{1}{c|}{60-40} & \multicolumn{1}{c|}{15654} & \multicolumn{1}{c|}{5416} & \multicolumn{1}{c|}{3} & \multicolumn{1}{c|}{5109} & \multicolumn{1}{c|}{0.793025891} & \multicolumn{1}{c|}{16817} & \multicolumn{1}{c|}{4253} & \multicolumn{1}{c|}{3} & \multicolumn{1}{c|}{5109} & 0.837445573 \\ \hline
\multicolumn{1}{|c|}{7} & \multicolumn{1}{c|}{70-30} & \multicolumn{1}{c|}{14240} & \multicolumn{1}{c|}{8977} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0.725161685} & \multicolumn{1}{c|}{15373} & \multicolumn{1}{c|}{4264} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & 0.782858889 \\ \hline
\multicolumn{1}{|c|}{8} & \multicolumn{1}{c|}{80-20} & \multicolumn{1}{c|}{9340} & \multicolumn{1}{c|}{3752} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0.713412771} & \multicolumn{1}{c|}{9502} & \multicolumn{1}{c|}{3950} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & 0.72578676 \\ \hline
\multicolumn{1}{|c|}{9} & \multicolumn{1}{c|}{90-10} & \multicolumn{1}{c|}{4736} & \multicolumn{1}{c|}{1809} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0.723605806} & \multicolumn{1}{c|}{4766} & \multicolumn{1}{c|}{1223} & \multicolumn{1}{c|}{0} & \multicolumn{1}{c|}{0} & 0.722993452 \\ \hline
\end{tabular}%
}
\end{table}
The table in the paper is shown like the following:
I edit my code according to what you have written,
\usepackage{array}
\usepackage{booktabs}
\usepackage{threeparttable}
\usepackage{siunitx}
\usepackage{float}
\usepackage[margin=1in]{geometry}
\sisetup{
table-format=1.3,
round-mode = places,
round-precision = 3,
}
\begin{table*}[ht]
\renewcommand*{\arraystretch}{1.1}
\centering
\begin{threeparttable}
\caption{Comparing accuracy}\label{tab:table}
\begin{tabular}{c #{\hspace{12pt}} *5{c} S #{\hspace{12pt}} *4{c} S #{\hspace{6pt}}}
\toprule
\multicolumn{12}{c}{out\_1} \\
\cmidrule(lr){1-12}
& & \multicolumn{5}{c}{Accuracy result}
& \multicolumn{5}{c}{Precision result} \\
\cmidrule(lr){3-7}\cmidrule(r){8-12}
& TTP\tnote{1} & TP & FP & FN & TN & {ACC\tnote{3}} & TP & FP & FN & TN & {ACC\tnote{3}} \\
\midrule
1 & 10-90 & 17508 & 5433 & 8 & 35961 & 0.907638771 & 18715 & 4226 & 8 & 35961 & 0.928127652 \\
2 & 20-80 & 17313 & 5433 & 8 & 29610 & 0.896092735 & 18476 & 4270 & 8 & 29610 & 0.918302651 \\
3 & 30-70 & 17097 & 5433 & 8 & 23281 & 0.881250136 & 18223 & 4307 & 8 & 23281 & 0.905825094 \\
4 & 40-60 & 16587 & 5428 & 3 & 17256 & 0.86171513 & 17760 & 4255 & 3 & 17256 & 0.891582217 \\
5 & 50-50 & 16155 & 5428 & 3 & 11142 & 0.834056465 & 17338 & 4245 & 3 & 11142 & 0.870202884 \\
6 & 60-40 & 15654 & 5416 & 3 & 5109 & 0.793025743 & 16817 & 4253 & 3 & 5109 & 0.837445573 \\
7 & 70-30 & 14240 & 5397 & 0 & 0 & 0.725161685 & 15373 & 4264 & 0 & 0 & 0.782858889 \\
8 & 80-20 & 9340 & 3752 & 0 & 0 & 0.713412771 & 9502 & 3590 & 0 & 0 & 0.72578674 \\
9 & 90-10 & 4736 & 1809 & 0 & 0 & 0.723605806 & 4732 & 1813 & 0 & 0 & 0.722994652 \\
\bottomrule
\end{tabular}
\par\tnote{1} Test Train Percentage
\par\tnote{2} Accuracy
\end{threeparttable}
\end{table*}
\end{document}
You just have to make sure tables aren't too wordy; "the long" column names and insane number of decimal places are mostly the culprits!
I managed to fit the table within a page of a regular two column document. However, I changed some names to acronyms and added annotation to explain what they represent. I also reduced accuracy to 3 decimal places (I don't think you need more than 2).
There are a few additional packages in the code
siunitx to round some numbers
threeparttable to split the table into three parts: a caption, the main table, footnotes (*)
booktabs for much better rules (**).
* If you insist on using colours, then you will have to get back to regular \hline due to gaps between background colours and rules defined by booktabs. I think a well designed table doesn't need colours
** The caption width will be reduced to the width of your table, which IMO has much better effect; move caption outside the threeparttable if you prefer captions to have the full page width .
Here's the result with dummy texts
and code
\documentclass[twocolumn]{article}
\usepackage{array}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{threeparttable}
\usepackage{siunitx}
\sisetup{
table-format=1.3,
round-mode = places,
round-precision = 3,
}
\usepackage{kantlipsum}
\pagestyle{empty}
\begin{document}
\section{One}
\kant[1-2]
\begin{table*}
\renewcommand*{\arraystretch}{1.1}
\centering
\begin{threeparttable}
\caption{Comparing accuracy}\label{tab:table}
\begin{tabular}{c #{\hspace{12pt}} *5{c} S #{\hspace{12pt}} *4{c} S #{\hspace{6pt}}}
\toprule
\multicolumn{12}{c}{out\_1} \\
\cmidrule(lr){1-12}
& & \multicolumn{5}{c}{Accuracy result}
& \multicolumn{5}{c}{Precision result} \\
\cmidrule(lr){3-7}\cmidrule(r){8-12}
& TTP\tnote{1} & TP & FP & FN & TN & {ACC\tnote{2}} & TP & FP & FN & TN & {ACC\tnote{2}} \\
\midrule
1 & 10-90 & 17508 & 5433 & 8 & 35961 & 0.907638771 & 18715 & 4226 & 8 & 35961 & 0.928127652 \\
2 & 20-80 & 17313 & 5433 & 8 & 29610 & 0.896092735 & 18476 & 4270 & 8 & 29610 & 0.918302651 \\
3 & 30-70 & 17097 & 5433 & 8 & 23281 & 0.881250136 & 18223 & 4307 & 8 & 23281 & 0.905825094 \\
4 & 40-60 & 16587 & 5428 & 3 & 17256 & 0.86171513 & 17760 & 4255 & 3 & 17256 & 0.891582217 \\
5 & 50-50 & 16155 & 5428 & 3 & 11142 & 0.834056465 & 17338 & 4245 & 3 & 11142 & 0.870202884 \\
6 & 60-40 & 15654 & 5416 & 3 & 5109 & 0.793025743 & 16817 & 4253 & 3 & 5109 & 0.837445573 \\
7 & 70-30 & 14240 & 5397 & 0 & 0 & 0.725161685 & 15373 & 4264 & 0 & 0 & 0.782858889 \\
8 & 80-20 & 9340 & 3752 & 0 & 0 & 0.713412771 & 9502 & 3590 & 0 & 0 & 0.72578674 \\
9 & 90-10 & 4736 & 1809 & 0 & 0 & 0.723605806 & 4732 & 1813 & 0 & 0 & 0.722994652 \\
\bottomrule
\end{tabular}
\par\tnote{1} Test Train Percentage
\par\tnote{2} Accuracy
\end{threeparttable}
\end{table*}
\kant[3-5]
\section{Two}
\kant[1-2]
\end{document}
Update
In order to achieve top alignment of a float on a single empty page, add the following to your preamble
\makeatletter
\setlength\#dblfptop{0pt}
\makeatother
The latex output from R stargazer is too large to fit on one page. I cannot find a way to resolve this issue and break the table onto another page.
\begin{longtable}{#{\extracolsep{5pt}}lD{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} }
\caption{test caption \label{models3-5} } \\
\\[-1.8ex]\hline
\hline \\[-1.8ex]
& \multicolumn{3}{c}{\textit{Dependent variable:}} \\
\cline{2-4}
\\[-1.8ex] & \multicolumn{3}{c}{Vote decision} \\
& \multicolumn{1}{c}{Model 3} & \multicolumn{1}{c}{Model 4} & \multicolumn{1}{c}{Model 5} \\
\\[-1.8ex] & \multicolumn{1}{c}{(1)} & \multicolumn{1}{c}{(2)} & \multicolumn{1}{c}{(3)}\\
\hline \\[-1.8ex]
Intercept & -15.633^{***} & -37.105^{***} & -45.338^{***} \\
& (5.889) & (9.130) & (9.962) \\
& & & \\
male & 16.627^{***} & 11.990^{*} & 8.896 \\
& (5.579) & (6.139) & (6.512) \\
& & & \\
birthyear & 0.008^{***} & 0.018^{***} & 0.023^{***} \\
& (0.003) & (0.005) & (0.005) \\
& & & \\
educ; Secondary II & -24.802^{***} & -24.624^{***} & -25.044^{***} \\
& (5.819) & (6.387) & (6.742) \\
& & & \\
educ; Tertiary & 44.767 & 21.210 & 36.447 \\
& (37.172) & (41.749) & (44.626) \\
& & & \\
household keeper & 23.563 & 16.935 & 1.766 \\
& (17.330) & (19.602) & (20.231) \\
& & & \\
children & 53.961^{***} & 71.322^{***} & 71.402^{***} \\
& (16.251) & (17.778) & (18.504) \\
& & & \\
church attendance & 7.966 & 7.216 & 5.639 \\
& (5.703) & (6.295) & (6.637) \\
& & & \\
taxes & & 26.108^{***} & 30.114^{***} \\
& & (7.412) & (7.876) \\
& & & \\
social expenditure & & -4.277 & -9.684 \\
& & (7.544) & (7.940) \\
& & & \\
chances for foreigners & & & 18.598^{***} \\
& & & (7.095) \\
& & & \\
materialism & & & 19.972^{**} \\
& & & (9.885) \\
& & & \\
male:birthyear & -0.009^{***} & -0.006^{**} & -0.005 \\
& (0.003) & (0.003) & (0.003) \\
& & & \\
birthyear:educ; Secondary II & 0.013^{***} & 0.013^{***} & 0.013^{***} \\
& (0.003) & (0.003) & (0.003) \\
& & & \\
birthyear:educ; Tertiary & -0.023 & -0.011 & -0.019 \\
& (0.019) & (0.021) & (0.023) \\
& & & \\
birthyear:household keeper & -0.012 & -0.009 & -0.001 \\
& (0.009) & (0.010) & (0.010) \\
& & & \\
birthyear:children & -0.027^{***} & -0.036^{***} & -0.036^{***} \\
& (0.008) & (0.009) & (0.009) \\
& & & \\
birthyear:church attendance & -0.004 & -0.004 & -0.003 \\
& (0.003) & (0.003) & (0.003) \\
& & & \\
birthyear:taxes & & -0.013^{***} & -0.015^{***} \\
& & (0.004) & (0.004) \\
& & & \\
birthyear:social expenditure & & 0.001 & 0.004 \\
& & (0.004) & (0.004) \\
& & & \\
birthyear:chances for foreigners & & & -0.010^{***} \\
& & & (0.004) \\
& & & \\
birthyear:materialsim & & & -0.011^{**} \\
& & & (0.005) \\
& & & \\
\hline \\[-1.8ex]
Observations & \multicolumn{1}{c}{7,313} & \multicolumn{1}{c}{7,061} & \multicolumn{1}{c}{6,879} \\
Log Likelihood & \multicolumn{1}{c}{-4,578.775} & \multicolumn{1}{c}{-3,873.386} & \multicolumn{1}{c}{-3,558.999} \\
Akaike Inf. Crit. & \multicolumn{1}{c}{9,185.550} & \multicolumn{1}{c}{7,782.772} & \multicolumn{1}{c}{7,161.997} \\
\hline
\hline \\[-1.8ex]
\textit{Note:} & \multicolumn{3}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\
& \multicolumn{3}{r}{Source: Selects postelection survey 2011-2019} \\
\end{longtable}
\end{table}
I tried to solve the issue using the longtable package, however, I still wasn't able to cut the table. Is there another way to do it or how exactly does the stargazer output need to be altered in order to stop overfloating?
I have my template set that subsections go into 2 columns, however when I try and insert a table, it does not compile instead being left blank. I think the reason is that the table is too wide/not being fitted.
Here is my LaTeX
\subsection{On examination}
\begin{table}[]
\begin{tabular}{|l|l|l|}
\hline
{\ul \textbf{Symptom}} & {\ul \textbf{Patient}} & {\ul \textbf{Normal}} \\ \hline
\textit{Temperature} & 36.7C & 36-36.8 \\ \hline
\textit{BMI} & 31 kg/m\textasciicircum{}2 & 18.5-24.9 \\ \hline
\textit{Heart Rate} & 70bpm & 60-100bpm \\ \hline
\textit{Blood Pressure} & 145/80 mmHg & \textless{}140/90mmHg \\ \hline
\textit{Respiratory Rate} & 12 breaths/min & 12-18 breaths/min \\ \hline
\textit{Misc} & & \\ \hline
\end{tabular}
\end{table}
I want to do something like this:
It has two headings: the upper one I'm done with but now I want to add a lower heading for only some columns.
Is there a way to add such a heading in latex?
My attempt:
\begin{tabular}{lcccccccc}\hline \hline
& Whole world & Base sample & Whole world & Base sample & Whole world & Base sample & Whole world & Base sample \\
& (1) & (2) & (3) & (4) & (5) & (6) & (7) & (8) \\ \hline \\
& & & & & & & & & \\
\multicolumn{6}{c}{Dependent variable is log GDP per capita in 1995 } \\
& & & & & & & & \\
The following uses the eqparbox package to set the integer and decimal part of each number wrapped inside a \fmtnum
\documentclass{article}
\usepackage{booktabs,makecell,eqparbox}
\newcommand{\mc}{\multicolumn{1}{c}}
\makeatletter
\newcommand{\fmtnum}[1]{\#fmtnum#1\relax}
\def\#fmtnum#1.#2\relax{\eqmakebox[int][r]{$#1.$}\eqmakebox[dec][l]{$#2$}}
\makeatother
\begin{document}
\noindent
\begin{tabular}{ *{8}{c} }
\toprule
\makecell{Whole \\ world \\ (1)} &
\makecell{Base \\ sample \\ (2)} &
\makecell{Whole \\ world \\ (3)} &
\makecell{Base \\ sample \\ (4)} &
\makecell{Whole \\ world \\ (5)} &
\makecell{Base \\ sample \\ (6)} &
\makecell{Whole \\ world \\ (7)} &
\makecell{Base \\ sample \\ (8)} \\
\midrule
\multicolumn{6}{c}{\small Dependent variable is log GDP per capita in 1995} &
\multicolumn{2}{c}{\small \makecell[b]{Dependent variable \\ is log output per \\ worker in 1998}} \\
\cmidrule(lr){1-6}\cmidrule{7-8}
\fmtnum{ 0.54 } & \fmtnum{ 0.52 } & \fmtnum{ 0.47 } & \fmtnum{ 0.43 } & \fmtnum{ 0.47 } & \fmtnum{ 0.41 } & \fmtnum{ 0.45 } & \fmtnum{ 0.46 } \\
\fmtnum{(0.04)} & \fmtnum{(0.06)} & \fmtnum{(0.06)} & \fmtnum{(0.05)} & \fmtnum{(0.06)} & \fmtnum{(0.06)} & \fmtnum{(0.04)} & \fmtnum{(0.06)} \\
\addlinespace
& & \fmtnum{ 0.89 } & \fmtnum{ 0.37 } & \fmtnum{ 1.60 } & \fmtnum{ 0.92 } \\
& & \fmtnum{(0.49)} & \fmtnum{(0.51)} & \fmtnum{(0.70)} & \fmtnum{(0.63)} \\
& & & \fmtnum{-0.62 } & & \fmtnum{-0.60 } \\
& & & \fmtnum{(0.19)} & & \fmtnum{(0.23)} \\
& & & \fmtnum{-1.00 } & & \fmtnum{-0.90 } \\
& & & \fmtnum{(0.15)} & & \fmtnum{(0.17)} \\
& & & \fmtnum{-0.25 } & & \fmtnum{-0.04 } \\
& & & \fmtnum{(0.20)} & & \fmtnum{(0.32)} \\
\fmtnum{ 0.62 } & \fmtnum{ 0.54 } & \fmtnum{ 0.63 } & \fmtnum{ 0.73 } & \fmtnum{ 0.56 } & \fmtnum{ 0.69 } & \fmtnum{ 0.55 } & \fmtnum{ 0.49 } \\
\mc{110} & \mc{64} & \mc{110} & \mc{110} & \mc{64} & \mc{64} & \mc{108} & \mc{61} \\
\bottomrule
\end{tabular}
\end{document}
While it is a bit cumbersome, there is very little uniformity across the table, with mixtures of decimal values using parentheses and negative numbers, numbers without decimal parts and also headers that are wider than their column constituents (columns 7-8).
The above code requires at least 2 compilations with every change in the maximum width of a number's integer or decimal part.
You can streamline the input a little using collcell:
\documentclass{article}
\usepackage{booktabs,makecell,eqparbox,collcell}
\newcommand{\mc}{\multicolumn{1}{c}}
\makeatletter
\newcommand{\fmtnum}[1]{\if\relax\detokenize{#1}\relax\else\#fmtnum#1\relax\fi}
\def\#fmtnum#1.#2\relax{\eqmakebox[int][r]{$#1.$}\eqmakebox[dec][l]{$#2$}}
\makeatother
\begin{document}
\noindent
\begin{tabular}{ *{8}{>{\collectcell\fmtnum}c<{\endcollectcell}} }
\toprule
\mc{\makecell{Whole \\ world \\ (1)}} &
\mc{\makecell{Base \\ sample \\ (2)}} &
\mc{\makecell{Whole \\ world \\ (3)}} &
\mc{\makecell{Base \\ sample \\ (4)}} &
\mc{\makecell{Whole \\ world \\ (5)}} &
\mc{\makecell{Base \\ sample \\ (6)}} &
\mc{\makecell{Whole \\ world \\ (7)}} &
\mc{\makecell{Base \\ sample \\ (8)}} \\
\midrule
\multicolumn{6}{c}{\small Dependent variable is log GDP per capita in 1995} &
\multicolumn{2}{c}{\small \makecell[b]{Dependent variable \\ is log output per \\ worker in 1998}} \\
\cmidrule(lr){1-6}\cmidrule{7-8}
0.54 & 0.52 & 0.47 & 0.43 & 0.47 & 0.41 & 0.45 & 0.46 \\
(0.04) & (0.06) & (0.06) & (0.05) & (0.06) & (0.06) & (0.04) & (0.06) \\
\addlinespace
& & 0.89 & 0.37 & 1.60 & 0.92 \\
& & (0.49) & (0.51) & (0.70) & (0.63) \\
& & & -0.62 & & -0.60 \\
& & & (0.19) & & (0.23) \\
& & & -1.00 & & -0.90 \\
& & & (0.15) & & (0.17) \\
& & & -0.25 & & -0.04 \\
& & & (0.20) & & (0.32) \\
0.62 & 0.54 & 0.63 & 0.73 & 0.56 & 0.69 & 0.55 & 0.49 \\
\mc{110} & \mc{64} & \mc{110} & \mc{110} & \mc{64} & \mc{64} & \mc{108} & \mc{61} \\
\bottomrule
\end{tabular}
\end{document}
I try to format my math like this in MathJax:
How can I do long division of polynomials in MathJax?
Old post, but I couldn't find an answer elsewhere, so here's how I solved this issue with two side-by-side arrays. Couldn't figure out how to make the lines shorter as I could in LaTex, but this was good enough for me:
<span class="math display">\[\begin{array}{r}
\\
x^2 - 3) \\
\phantom{.} \\
\phantom{.} \\
\phantom{.} \\
\phantom{.} \\
\phantom{.} \\
\phantom{.} \\
\phantom{.} \\
\phantom{.} \\
\phantom{.} \\
\end{array}
\begin{array}{rrrrrr}
& & x^3 & -2x^2 & +4x & -6 \\ \hline
x^5 & -2x^4 & + x^3 & &-8x & +18 \\
-x^5 & &+3x^3 \\ \hline
& -2x^4 & +4x^3 \\
& 2x^4 & &-6x^2 \\ \hline
& & 4x^3 & -6x^2 & -8x \\
& & -4x^3 & &+12x \\ \hline \\
& & &-6x^2 & +4x & +18 \\
& & & 6x^2 & & -18 \\ \hline
& & & & 4x
\end{array}\]</span>