Closed HMegh closed 1 year ago
Hi @Hmegh !
In fact you can do this by using the formatter ft_latex_sn
:
julia> a = rand(4, 4) * 1e5
4×4 Matrix{Float64}:
78664.9 762.498 89321.9 58704.7
51475.3 86237.6 11990.0 33106.3
41140.2 10658.2 55646.8 35019.9
2035.81 80699.8 33982.4 77060.7
julia> pretty_table(a; tf = tf_latex_default, formatters = ft_latex_sn(4))
\begin{tabular}{rrrr}
\hline
\textbf{Col. 1} & \textbf{Col. 2} & \textbf{Col. 3} & \textbf{Col. 4} \\\hline
$7.866 \cdot 10^{4}$ & 762.5 & $8.932 \cdot 10^{4}$ & $5.87 \cdot 10^{4}$ \\
$5.148 \cdot 10^{4}$ & $8.624 \cdot 10^{4}$ & $1.199 \cdot 10^{4}$ & $3.311 \cdot 10^{4}$ \\
$4.114 \cdot 10^{4}$ & $1.066 \cdot 10^{4}$ & $5.565 \cdot 10^{4}$ & $3.502 \cdot 10^{4}$ \\
2036 & $8.07 \cdot 10^{4}$ & $3.398 \cdot 10^{4}$ & $7.706 \cdot 10^{4}$ \\\hline
\end{tabular}
The first argument is the number of decimal cases in the mantissa. The second argument can be a vector of integers telling to which columns the formatter must be applied.
Awesome! That's what I was looking for, thank you.
Hi,
Would it be possible to add an option so that the numbers in the latex output will be displayed using the scientific notation "\times 10^n"? For example,
.000025
will be2.5\times 10^{-5}
instead of2.5e-5
.Right now, I can do this with a regex find-replace, but it would be awesome if the package supports it.