I would like to convert a table from Mircosoft Excel to latex (on Winedt) based on Microsoft Windows operation system. The number in excel is, for instance,
1 2
1.00E-02 1.05E-03
I would like to have 1.00 $\times 10^{-2}$ and 1.05$\times 10^{-3}$ in latex table directly.
I have tried excel2latex.xla, it could convert table, but does not change formatting as $\times 10^{-2}$. Is there any simple way to do that? though I am somehow doubt about it…
Best Answer
The package
siunitx
could be a solution for you, but it requires some adjustment of theexcel2latex
output, which I'll explain below.siunitx
defines a special column type,S
used in place of the usuall
,c
,r
specifications.Each cell entry is then taken as the argument to
siunitx
's\num{}
command, which accepts scientific notation input as 1.00E-02.One behavior of this solution is that
siunitx
centers the columns around the decimal separator.siunitx
tries to be smart about what is text/headings and what is numerical data. But anything that could be mistaken for numerical data (in your example, the first row, which I'm assuming contains headings) should be protected with curly braces.So, to apply this solution to
excel2latex
output, you'll have to:siunitx
package in the document preamble,c
(orl
orr
) tos
in the beginning of thetabular
environment for any columns with numerical data, and{}
.An example:
Before:
After:
Complete Code and Output:
Many adjustments can be made for alignment and spacing of the
S
columns. If you decide this solution is workable for you, you can consult the package manual (Section 4.6) for details.