I have the following table. I need to format it so that the figures displayed are rounded to two digits after decimal place. I searched and all the solutions I found involve the use of a Latex package. I can't use a package (I think?) because I'm working with ShareLatex.
\documentclass{article}
\usepackage{booktabs}
\usepackage{tabularx}
\begin{document}
\begin{table}[tbp] \centering%
\newcolumntype{C}{>{\centering\arraybackslash}X}
\caption{Differences}%
{\normalsize
\begin{tabularx}{\textwidth}{lCCCC}
\toprule
Economy&year&nef\_en&gdi\_wer&inf\\\tabularnewline
\midrule\addlinespace[1.5ex]
Belize&2006&4.240267&-7.113768&-11.35403 \tabularnewline
Central African Republic&2014&8.2&25.28281&17.08281 \tabularnewline
Iran, Islamic Rep.&2012&30.5&27.35739&-3.142611 \tabularnewline
Iran, Islamic Rep.&2013&34.78927&39.26636&4.477088 \tabularnewline
Iceland&2009&16.27129&12.00581&-4.265474 \tabularnewline
Kenya&2006&6&14.45373&8.453734 \tabularnewline
Kenya&2007&4.3&9.758881&5.45888 \tabularnewline
Kenya&2008&16.2&26.23982&10.03982 \tabularnewline
Kuwait&2008&6.3&10.58271&4.28271 \tabularnewline
Myanmar&2013&8.876498&5.524279&-3.352219 \tabularnewline
Mongolia&2007&17.70245&9.045246&-8.657202 \tabularnewline
Mongolia&2013&12.5&8.604828&-3.895172 \tabularnewline
Mongolia&2015&1.9&5.775949&3.87595 \tabularnewline
Chad&2011&2.040816&-3.704296&-5.745112 \tabularnewline
Chad&2012&7.512763&14.01821&6.505443 \tabularnewline
\bottomrule \addlinespace[1.5ex]
\end{tabularx}%
}
\end{table}%
\end{document}
Best Answer
ShareLaTeX should be installed with a complete distribution. The following works and uses
siunitx
to round columns 3-5 to two decimal places (the default value forround-precision
):