As you can see the problem in table notes in the figure below. I generated the latex code from stargazer function and manually adjusted it to meet my requirement. The table note troubled me however. how do I format the note to be the same height with the note contexts.
My latex code looks like below
\begin{table}[h] \centering
\begin{threeparttable}[b]
\caption{Regression results}
\label{results}
\begin{tabular}{#{\extracolsep{5pt}}lccccc}
\\[-1.8ex]\hline
\hline \\[-1.8ex]
& (1) & (2) & (3) & (4) & (5) \\
\hline\\[-1.8ex]
& \multicolumn{5}{c}{A. Daily Max 8-hour Ozone Concentration} \\
\hline \\[-1.8ex]
TreatedPost & 0.034$^{***}$ & 0.006 & $-$0.063$^{***}$ & $-$0.098$^{***}$ & $-$0.105$^{***}$ \\
& 0.012 & (0.007) & (0.017) & (0.023) & (0.023) \\
& & & & & \\[-1.8ex]
\hline\\[-1.8ex]
& \multicolumn{5}{c}{B. Daily PM2.5} \\
\hline \\[-1.8ex]
TreatedPost & $-$0.245$^{***}$ & $-$0.374$^{***}$ & $-$0.505$^{***}$ & 0.203$^{***}$ & 0.230$^{**}$ \\
& 0.051 & (0.025) & (0.053) & (0.067) & (0.080) \\
& & & & & \\[-1.8ex]
\hline \\[-1.8ex]
County fixed & & Yes & Yes & Yes & Yes \\
Time fixed & & & Yes & Yes & Yes \\
County-specific trend & & & & Yes & Yes \\
Climate control & & & & & Yes \\
\hline \\[-1.8ex]
\hline \\
\end{tabular}
\begin{tablenotes}
\item[Note:] In the table, column (1)-(5) represent different models. Column (1) refers to a simple linear model; Column(2) indicates a panel data regression with county-fixed effect; Column(3) represents a panel data model with county- and time-fixed effect; Column (4) introduces county-specific time trend; Column (5) furture includes climate control variables. For panel data models, errors are clustered at county level. {$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01}
\end{tablenotes}
\end{threeparttable}
\end{table}
Related
I am trying to create the following table in LaTex with the exact layout shown below.
I also want to have the following Latex statements in my table code. They allow me to set a caption and label, respectively according to the formatting of a specific journal.
% \caption{Model Execution Summary}
% \label{tab:tablelabel}
I have scoured Google and tried many different solutions but none of them can produce even close to the layout of my desired table. I am also new to LaTex so this is a struggle.
Can someone show me how to do this in Latex please?
\documentclass[a4paper,12pt]{article}
\usepackage{array, multirow}
\usepackage{pdflscape}
\pagestyle{empty}
\begin{document}
\begin{landscape}
\begin{table}
\centering
\caption{Model Execution Summary}
\label{tab:tablelabel}
\begin{tabular}{|c|l|r|r|r|}
\cline{2-5}
\multicolumn{1}{r|}{} & Algorithm & Column Shapes & Column Pair Trends & Quality Score\\
\hline
\multirow{4}{*}{Category 1546} & \textbf{Gaussian Copula} & \textbf{87.22\%} &\textbf{71.25\%} & \textbf{79.23\%} \\
& CTGAN Neural Network & 77.00\% & 79.96\% & 78.48\% \\
& CopulaGAN Neural Network & 75.92\% & 74.23\% & 75.08\% \\
& TVAE Autoencoders & 72.66\% & 74.27\% & 73.46\% \\
\hline
\multirow{4}{*}{Category 155} & \textbf{Gaussian Copula} &\textbf{91.57\%} & \textbf{80.17\%} & \textbf{85.87\%} \\
& CTGAN Neural Network & 84.14\% & 80.79\% & 82.47\% \\
& CopulaGAN Neural Network & 84.09\% & 80.56\% & 82.32\% \\
& TVAE Autoencoders & 85.50\% & 85.13\% & 85.41\% \\
\hline
\multirow{4}{*}{Category 8909} & \textbf{Gaussian Copula} & \textbf{95.64\%} & \textbf{81.96\%} &\textbf{88.80\%} \\
& CTGAN Neural Network & 81.15\% & 79.84\% & 80.50\% \\
& CopulaGAN Neural Network & 81.24\% & 82.18\% & 81.71\% \\
& TVAE Autoencoders & 75.98\% &75.54\%& 75.76\% \\
\hline
\multirow{4}{*}{Category 8189} &\textbf{Gaussian Copula} & \textbf{95.08\%} & \textbf{82.63\%} & \textbf{88.86\%} \\
& CTGAN Neural Network & 79.43\% & 85.87\% & 82.65\% \\
& CopulaGAN Neural Network & 78.82\% & 83.60\% & 81.21\% \\
& TVAE Autoencoders & 75.47\% & 77.57\% & 76.52\% \\
\hline
\multirow{4}{*}{Category 4162} & \textbf{Gaussian Copula} & \textbf{86.86\%} & \textbf{13.64\%} & \textbf{50.25\%} \\
&CTGAN Neural Network & 86.62\% & 11.71\% & 49.16\% \\
& CopulaGAN Neural Network & 87.60\% & 11.83\% & 49.71\% \\
& TVAE Autoencoders & 86.20\% & 10.91\% & 48.55\% \\
\hline
\end{tabular}
\end{table}
\end{landscape}
\end{document}
With the following output
the exact layout shown below leads to the following twerks:
using the landscape package, due to its size
using the the multicolumn{1}{r|}{} to achive that cell in the up right corner has no borders
I am working with Stata to create a balance table for some data using the balancetable ado package. While I believe the balancetable commands are working, the output LaTeX document won't run the table that it is trying to print. Given that I am still learning how to use LaTeX, any assistance with trying to see what the syntax issue is with this LaTeX code would be much appreciated. I'm getting issues related to the document name, typesetting and compiler issues.
\begin{tabular}{l*{3}c}
\hline\hline
& (1) & (2) & (3) \\
\hline
agesq&677.315&717.395&40.079\\
&(428.784)&(431.252)&(41.341)\\
educ&10.088&10.346&0.257\\
&(1.614)&(2.011)&(0.172)\\
black&0.827&0.843&0.016\\
&(0.379)&(0.365)&(0.036)\\
hisp&0.108&0.059&-0.048*\\
&(0.311)&(0.237)&(0.027)\\
married&0.154&0.189&0.035\\
&(0.361)&(0.393)&(0.036)\\
nodegree&0.835&0.708&-0.127***\\
&(0.372)&(0.456)&(0.039)\\
mosinex&17.862&18.492&0.630\\
&(5.574)&(4.911)&(0.511)\\
re74&2.107&2.096&-0.011\\
&(5.688)&(4.887)&(0.516)\\
re75&1.267&1.532&0.265\\
&(3.103)&(3.219)&(0.303)\\
\hline
Observations & 260 & 185 & 445 \\
\hline\hline
\end{tabular}
```!LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.1 \begin{tabular}
{l*{3}c}
?```
In LaTeX, there's some lines you should always have. \documentclass{article} (doesn't have to be the article format). Afterwards, there is the document environment where your tabular environment would be in. This would look like:
\documentclass{article}
\begin{document}
\begin{tabular}{l*{3}c}
\hline\hline
& (1) & (2) & (3) \\ \hline
agesq & 677.315 & 717.395 & 40.079 \\
& (428.784) & (431.252) & (41.341) \\
educ & 10.088 & 10.346 & 0.257 \\
& (1.614) & (2.011) & (0.172) \\
black & 0.827 & 0.843 & 0.016 \\
& (0.379) & (0.365) & (0.036) \\
hisp & 0.108 & 0.059 & -0.048* \\
& (0.311) & (0.237) & (0.027) \\
married & 0.154 & 0.189 & 0.035 \\
& (0.361) & (0.393) & (0.036) \\
nodegree& 0.835 & 0.708 & -0.127*** \\
& (0.372) & (0.456) & (0.039) \\
mosinex & 17.862 & 18.492 & 0.630 \\
& (5.574) & (4.911) & (0.511) \\
re74 & 2.107 & 2.096 & -0.011 \\
& (5.688) & (4.887) & (0.516) \\
re75 & 1.267 & 1.532 & 0.265 \\
& (3.103) & (3.219) & (0.303) \\
\hline
Observations & 260 & 185 & 445 \\
\hline\hline
\end{tabular}
\end{document}
Indentations and spacing aren't required but they do make the document more understandable for the writer. Here's what this document generates:
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 have sideways table that is slightly too large. I want it to make it smaller that it fits on the page. I tried \small \resizebox, nothing works. Any idea how it could work? Please find below the table.
I have sideways table that is slightly too large. I want it to make it smaller that it fits on the page. I tried \small \resizebox, nothing works. Any idea how it could work? Please find below the table.
\documentclass[a4paper, 12pt]{article}
\DeclareUnicodeCharacter{FB01}{fi}
\DeclareUnicodeCharacter{FB02}{fl}
%\usepackage[space]{grffile}
\usepackage{apacite}
\usepackage{makecell}
\usepackage{afterpage}
\usepackage{dblfloatfix}
\usepackage[referable]{threeparttablex}
\usepackage[paper=portrait,pagesize]{typearea}
\usepackage{subcaption}
\usepackage{mleftright}
\usepackage{lscape}
\usepackage{a4wide}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[onehalfspacing]{setspace}
\usepackage{float, afterpage, rotating, graphicx}
\usepackage{threeparttable}
\usepackage{multirow, booktabs, makecell, caption}
\begin{document}
\begin{sidewaystable}
\small
\caption{Portfolio return and risk performance}
\label{pfperformance}
\begin{threeparttable}
\begin{tabular*}{\linewidth}{l#{\extracolsep{\fill}}*{10}{c}}
\toprule
& \multicolumn{4}{c}{Sample covariance matrix} & & \multicolumn{4}{c}{Shrinkage covariance matrix} \\
\cmidrule{2-5} \cmidrule(l{1cm}){6-10}
& HRP & IV & MV & MD & & HRP & IV & MV & MD \\
\midrule
Pandel A: Window = 250 & & & & \\
\midrule
Annualized return & 2.8913 & 2.6522 & 2.3518 & 4.5343 & & 3.4178 & 2.6522 & 2.3515 & 3.4646 \\
Annualized volatility & 0.8819 & 0.8779 & 1.4456 & 2.8673 & & 0.9805 & 0.8779 & 1.0602 & 1.5449 \\
Value-at-Risk (5\%) & 0.0098 & 0.0005 & 0.0043 & 0.0130 & & 0.0135 & 0.0005 & 0.0010 & 0.0046 \\
Conditional Value-at-Risk (5\%) & 0.0019 & 0.0011 & 0.0005 & 0.0019 & & 0.0049 & 0.0011 & 0.0004 & 0.0019 \\
Drawdown & 0.3171 & 0.3540 & 0.7069 & 0.8459 & & 0.3817 & 0.3540 & 0.5822 & 0.7181 \\
Maximum drawdown & 0.4435 & 0.4389 & 0.7755 & 0.8834 & & 0.5152 & 0.4389 & 0.6920 & 0.7917 \\
Sharpe ratio & 0.1716 & 0.1581 & 0.0852 & 0.0828 & & 0.1825 & 0.1581 & 0.1161 & 0.1174 \\
Calmar ratio & 6.5185 & 6.0423 & 3.0326 & 5.1325 & & 6.6337 & 6.0423 & 3.3983 & 4.3760 \\
Sortino ratio & 0.0072 & 0.0066 & 0.0068 & 0.0121 & & 0.0081 & 0.0066 & 0.0063 & 0.0092 \\
\midrule
Panel B: Window = 500 & & & & \\
\midrule
Annualized return & 2.9839 & 2.7675 & 2.2262 & 4.7684 & & 3.4379 & 2.7675 & 2.2100 & 3.6598 \\
Annualized volatility & 0.9310 & 0.9295 & 0.9744 & 2.6048 & & 1.0319 & 0.9295 & 0.8484 & 1.5313 \\
Value-at-Risk (5\%) & 0.0175 & 0.0182 & 0.0160 & 0.0229 & & 0.0039 & 0.0182 & 0.0269 & 0.0215\\
Conditional Value-at-Risk (5\%) & 0.0132 & 0.0116 & 0.0081 & 0.0131 & & 0.0130 & 0.0116 & 0.0099 & 0.0125\\
Drawdown & 0.3171 & 0.3539 & 0.4944 & 0.8169 & & 0.3817 & 0.3539 & 0.2857 & 0.6883\\
Maximum drawdown & 0.4435 & 0.4389 & 0.6134 & 0.8611 & & 0.5152 & 0.4389 & 0.4251 & 0.7714\\
Sharpe ratio & 0.1677 & 0.1558 & 0.1195 & 0.0958 & & 0.1744 & 0.1558 & 0.1363 & 0.1251\\
Calmar ratio & 6.7275 & 6.3050 & 3.6293 & 5.5371 & & 6.6729 & 6.3050 & 5.1982 & 4.7444\\
Sortino ratio & 0.0077 & 0.0071 & 0.0066 & 0.0130 & & 0.0084 & 0.0071 & 0.0060 & 0.0098\\
\midrule
Panel C: Window = 750 & & & & \\
\midrule
Annualized return & 2.9737 & 2.8767 & 2.2161 & 5.5427 & & 3.4330 & 2.8767 & 2.7677 & 3.9270 \\
Annualized volatility & 0.9832 & 1.0010 & 0.9142 & 2.7918 & & 1.0737 & 1.0010 & 1.2177 & 1.6674 \\
Value-at-Risk (5\%) & 0.0650 & 0.0596 & 0.0804 & 0.0793 & & 0.0546 & 0.0596 & 0.0684 & 0.0706 \\
Conditional Value-at-Risk (5\%) & 0.0077 & 0.0060 & 0.0048 & 0.0095 & & 0.0062 & 0.0060 & 0.0057 & 0.0074 \\
Drawdown & 0.3171 & 0.3539 & 0.3213 & 0.8069 & & 0.3817 & 0.3539 & 0.5395 & 0.6784 \\
Maximum drawdown & 0.4059 & 0.4389 & 0.4792 & 0.8525 & & 0.4719 & 0.4389 & 0.6651 & 0.7633 \\
Sharpe ratio & 0.1583 & 0.1504 & 0.1268 & 0.1039 & & 0.1674 & 0.1504 & 0.1190 & 0.1233 \\
Calmar ratio & 7.3246 & 6.5537 & 4.6244 & 6.5014 & & 7.2750 & 6.5537 & 4.1616 & 5.1448 \\
Sortino ratio & 0.0079 & 0.0076 & 0.0067 & 0.0153 & & 0.0087 & 0.0076 & 0.0076 & 0.0106 \\
\bottomrule
\end{tabular*}
\begin{tablenotes}[para,flushleft]
\footnotesize
\item\hspace{-2.5pt}\noindent\textit{Note:} The table presents portfolio performance and risk statistics using rolling-window sample and shrinkage covariance matrix estimates of 250, 500, and 750 days. The shrinkage covariance matrix is calculated following \cite{ledoit2004honey}, where the shrinkage target $S$ is a diagonal matrix of only variances with zeros elsewhere and the shrinkage constant is $\delta=0.3$. We use an annualization factor of 250 trading days. All series are in logarithmic first differences.
\end{tablenotes}
\end{threeparttable}
\end{sidewaystable}
\end{document}
You should use the adjustbox package which is the best and more flexible way to resize (among many other features) a box in LaTeX.
Just add
\usepackage{adjustbox}
in your pramble.
And enclose the box you want to resize with an adjustbox environment
\begin{sidewaystable}
\small
\caption{Portfolio return and risk performance}
\label{pfperformance}
\begin{adjustbox}{scale=0.95,center}
\begin{threeparttable}
....
\end{threeparttable}
\end{adjustbox}
\end{sidewaystable}
Just adapt the scale to your needs. You can also use
\begin{adjustbox}{width=\texwidth,center}
Without center, your box will be flushed left (and hence downwards in the sideway table).
I have created a table in Latex and it has stopped displaying it but I need it to work on the document I am currently working on. When I input into a new document, it works again. I am getting the following errors:
LaTex error: Illegal character in array arg. Overfull \Hbox (56.47151pt too wide) in paragraph at lines at lines 70--98
Error alignment tab has been changed to \cr.
It does not work either when I include the array package. I am using the following packages:
\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{url}
\usepackage[round]{natbib}
\usepackage{graphicx}
\usepackage[export]{adjustbox}
\usepackage{float}
\usepackage{amsmath}
\usepackage[toc,page]{appendix}
\begin{table}[h!]
\begin{center}
\caption{A comparison between Rwanda and The Gambia}
\begin{tabular}{l|s|r|m}
\textbf{Variable} &
\textbf{Specific Variable} &
\textbf{Rwanda} &
\textbf{Gambia} &
\hline \hline
\textit{Size} & Surface area (sq. km) & 26,340 & 11,300 \\
& Population (total) & 12,208,407 & 2,100,568 \\
\hline
\textit{Economy} & GDP growth (annual \%) & 6.1 & 4.6 \\
& GDP per capita & 720 & 680 \\
\hline
\textit{Education} & Literacy rate (gender parity index) & 1.029 & 0.851 \\
& School enrolment (primary \% gross) & 133.425 & 97.115 \\
& School enrolment (secondary \% gross) & 32.988 & 57.096 \\
& School enrolment (tertiary \% gross) & 6.695 & 3.094 \\
\hline
\textit{Health and Survival} & Life expectancy at birth (total years) & 67.129 & 61.193 \\
\hline
\textit{Politics} & Political Elections & 4 & 8 \\
& Freedom Rights Score & Not Free & Not Free \\
\hline
\textit{Gender Equality} & Gender equality rating & 4.5 & 3.5 \\
& The Global Gender Gap Report& 121 & 6 \\
\hline
\textit{Aid Rates} & Net ODA received per capita & 100.373 & 128.356 \\
& Net official development assistance & 37.3 & 46.8 \\
\end{tabular}
\end{center}
\end{table}
Concerning the first problem, "Illegal character in array arg", it is indeed cause by by an unrecognised argument to tabular.
Legal arguments are supposed to describe column types and are c (centered), l (left aligned), r (right aligned), p{width} (top aligned paragraph) and | to describe an intercolumn rule for the most common ones. There are packages that add extra column types, but in your code \begin{tabular}{l|s|r|m} 's' is unknown and do not correspond to a valid column type. 'm' exists to specify a middle aligned paragraph in the 'array' package; it would require the insertion of the package and an extra argument with the desired width of the paragraph. Just change 's' and 'm' wih legal parameters and all is OK. There are many documentation available that describe valid column types.
The second message says that you specify an array with four columns but the fist line contains 5 entries:
\textbf{Variable} &
\textbf{Specific Variable} &
\textbf{Rwanda} &
\textbf{Gambia} &
the fifth one is an empty entry following the ampersand after 'Gambia'. Replace it with an end-of-line to suppress the problem.
Here is a corrected version.
\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{url}
\usepackage[round]{natbib}
\usepackage{graphicx}
\usepackage[export]{adjustbox}
\usepackage{float}
\usepackage{amsmath}
\usepackage[toc,page]{appendix}
\begin{document}
\begin{table}[h!]
\begin{center}
\caption{A comparison between Rwanda and The Gambia}
\begin{tabular}{l|c|r|c}
\textbf{Variable} &
\textbf{Specific Variable} &
\textbf{Rwanda} &
\textbf{Gambia} \\
\hline \hline
\textit{Size} & Surface area (sq. km) & 26,340 & 11,300 \\
& Population (total) & 12,208,407 & 2,100,568 \\
\hline
\textit{Economy} & GDP growth (annual \%) & 6.1 & 4.6 \\
& GDP per capita & 720 & 680 \\
\hline
\textit{Education} & Literacy rate (gender parity index) & 1.029 & 0.851 \\
& School enrolment (primary \% gross) & 133.425 & 97.115 \\
& School enrolment (secondary \% gross) & 32.988 & 57.096 \\
& School enrolment (tertiary \% gross) & 6.695 & 3.094 \\
\hline
\textit{Health and Survival} & Life expectancy at birth (total years) & 67.129 & 61.193 \\
\hline
\textit{Politics} & Political Elections & 4 & 8 \\
& Freedom Rights Score & Not Free & Not Free \\
\hline
\textit{Gender Equality} & Gender equality rating & 4.5 & 3.5 \\
& The Global Gender Gap Report& 121 & 6 \\
\hline
\textit{Aid Rates} & Net ODA received per capita & 100.373 & 128.356 \\
& Net official development assistance & 37.3 & 46.8 \\
\end{tabular}
\end{center}
\end{table}
\end{document}