How do I draw the following table in LaTeX? The data inside is not that important.
I wrote the following code:
\begin{table}[H]
\centering
\begin{tabular}{cccccc}
\hline
\multicolumn{6}{|c|}{Feature Vector of Samples} \\
\hline
\headerrow & 1 & 2 & 3 & 4 & 5\\
1 & \(9.87*e^{-01}\) & \(8.67*e^{-17} \)& \(4.13*e^{-24}\) & \(1.16*e^{-17}\) & \(4.58*e^{-17}\) \\
2 & \(1.16*e^{-16}\) & \(9.99*e^{-01}\) & \(9.14*e^{-25}\) & \(3.63*e^{-22}\) & \(2.69*e^{-11}\) \\
3 & \(4.35*e^{-33}\) & \(7.85*e^{-34}\) & \(9.93*e^{-01}\) & \(3.74*e^{-04}\) & \(4.55*e^{-34}\) \\
4 & \(5.51*e^{-26}\)& \(5.13*e^{-31}\)& \(5.02*e^{-04}\) & \(9.99*e^{-01}\) & \(1.71*e^{-29}\) \\
5& \(9.60*e^{-18}\) & \(2.21*e^{-07}\)& \(2.52*e^{-25}\)& \(4.64*e^{-20}\)& \(9.99*e^{-01}\)
\end{tabular}
\caption{wasssss}
\label{tbl:wasss}
\end{table}
and here is the result:
What I need to add is one multi row, and the first row should not include the first column.
In theory you could create a table like this using the following code, but please have a look at http://betterposters.blogspot.com/2012/08/the-data-prison.html before you inflict such a table on your readers
\documentclass{article}
\usepackage{graphicx}
\usepackage{multirow}
\begin{document}
\begin{table}[htbp]
\centering
\begin{tabular}{|c|c|c|c|c|c|c|}
\hline
\multicolumn{2}{|c|}{} &\multicolumn{5}{|c|}{Feature Vector of Samples} \\
\cline{3-7}
\multicolumn{2}{|c|}{} & 1 & 2 & 3 & 4 & 5\\\hline
\multirow{5}{*}{\rotatebox{90}{samples}} & 1 & \(9.87*e^{-01}\) & \(8.67*e^{-17} \)& \(4.13*e^{-24}\) & \(1.16*e^{-17}\) & \(4.58*e^{-17}\) \\\cline{2-7}
&2 & \(1.16*e^{-16}\) & \(9.99*e^{-01}\) & \(9.14*e^{-25}\) & \(3.63*e^{-22}\) & \(2.69*e^{-11}\) \\\cline{2-7}
& 3 & \(4.35*e^{-33}\) & \(7.85*e^{-34}\) & \(9.93*e^{-01}\) & \(3.74*e^{-04}\) & \(4.55*e^{-34}\) \\\cline{2-7}
& 4 & \(5.51*e^{-26}\)& \(5.13*e^{-31}\)& \(5.02*e^{-04}\) & \(9.99*e^{-01}\) & \(1.71*e^{-29}\) \\ \cline{2-7}
& 5& \(9.60*e^{-18}\) & \(2.21*e^{-07}\)& \(2.52*e^{-25}\)& \(4.64*e^{-20}\)& \(9.99*e^{-01}\)\\
\hline
\end{tabular}
\caption{wasssss}
\label{tbl:wasss}
\end{table}
\end{document}
you can use the excel2latex. It's a powerful tool for tables write. You'll need add the packagins after, like it's on the follow script:
https://www.ctan.org/tex-archive/support/excel2latex
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{multirow} %for multirow
\usepackage{rotating} %for sideways, rotating "samples" at 90°"
\usepackage{bigstrut} %for bigstrut
\begin{document}
% Table generated by Excel2LaTeX from sheet 'Planilha1'
\begin{table}[htbp]
\centering
\caption{Add caption}
\begin{tabular}{|c|r|r|r|r|r|r|}
\hline
\multicolumn{2}{|c|}{\multirow{2}[4]{*}{}} & \multicolumn{5}{c|}{Feature Vector of Samples} \bigstrut\\
\cline{3-7} \multicolumn{2}{|c|}{} & 1 & 2 & 3 & 4 & 5 \bigstrut\\
\hline
\multirow{5}[10]{*}{\begin{sideways}samples\end{sideways}} & 1 & Value & Value & Value & Value & Value \bigstrut\\
\cline{2-7} & 2 & Value & Value & Value & Value & Value \bigstrut\\
\cline{2-7} & 3 & Value & Value & Value & Value & Value \bigstrut\\
\cline{2-7} & 4 & Value & Value & Value & Value & Value \bigstrut\\
\cline{2-7} & 5 & Value & Value & Value & Value & Value \bigstrut\\
\hline
\end{tabular}%
\label{tab:addlabel}%
\end{table}%
\end{document}
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
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}
How can I recreate this table in latex? I didn't want to create a simple document in Word for my documentation and I'm trying my hand.
For now I have trivially solved the problem by integrating this table as a png.
Thank you for your time
Have a look at https://www.tablesgenerator.com/
Here is a sample based on your query:
Sample table LaTeX code
% Please add the following required packages to your document preamble:
% \usepackage{multirow}
\begin{table}[]
\begin{tabular}{llll}
use case \#6 & \multicolumn{3}{l}{Aggiungi} \\
& \multicolumn{3}{l}{} \\
& \multicolumn{3}{l}{} \\
& \multicolumn{3}{l}{} \\
\multirow{2}{*}{Description} & Step & Iscritto & Sistema \\
& & &
\end{tabular}
\end{table}
Here is a sketch:
\documentclass{article}
\usepackage{multirow}
\usepackage[table]{xcolor}
\begin{document}
\setlength{\tabcolsep}{.5em}
\renewcommand{\arraystretch}{1.2}
\begin{table}[htbp]
\begin{tabular}{|p{.2\textwidth}|p{.08\textwidth}|p{.33\textwidth}|p{.33\textwidth}|}
\hline
\cellcolor{blue!20}\textbf{Use} & \multicolumn{3}{l|}{\cellcolor{blue!20}Aggiungi}\\\hline
Goal & \multicolumn{3}{l|}{L'utente}\\\hline
Pre & \multicolumn{3}{l|}{L'utente}\\\hline
Success & \multicolumn{3}{l|}{L'utente}\\\hline
Failed & \multicolumn{3}{l|}{L'utente}\\\hline
Primary & \multicolumn{3}{l|}{Iscritto}\\\hline
Trigger & \multicolumn{3}{l|}{L'utente}\\\hline
\multirow{5}{*}{Description} & \cellcolor{blue!20}Step & \cellcolor{blue!20}Iscritto & \cellcolor{blue!20}Sistema\\\cline{2-4}
& 1 & Preme & \\\cline{2-4}
& 2 & & Mostra\\\cline{2-4}
& 3 & Seleziona & \\\cline{2-4}
& 4 & & Mostra\\\hline
\multirow{2}{*}{\parbox{.19\textwidth}{Extension \#1\\ blah blah}} %
& \cellcolor{blue!20}Step & \cellcolor{blue!20}Iscritto & \cellcolor{blue!20}Sistema\\\cline{2-4}
& In un qual\-sia\-si pun\-to & 2 & 3\\\hline
\multirow{2}{*}{\parbox{.19\textwidth}{Extension \#1\\ blah blah}} %
& \cellcolor{blue!20}Step & \cellcolor{blue!20}Iscritto & \cellcolor{blue!20}Sistema\\\cline{2-4}
& 1 & 2 & 3\\\hline
\multirow{2}{*}{\parbox{.19\textwidth}{Extension \#1\\ blah blah}} %
& \cellcolor{blue!20}Step & \cellcolor{blue!20}Iscritto & \cellcolor{blue!20}Sistema\\\cline{2-4}
& 1 & 2 & 3\\\hline
\end{tabular}
\end{table}
\end{document}
Check the two package in the header, needed to run.
You can also implement sans serif font, if you want.
This is the output of the above code:
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}