Ciao Angelo,

On 7/10/26 17:51, Angelo Graziosi wrote:
Ciao Pedro,

Pedro A. Aranda wrote:
Are you talink about something like

```org
#+CONSTANTS: k=8.99E9 e=1.60E-19 cm=1e-2 uC=1e-6
#+attr_latex: :align ccccS
|---+--------------+-------------+---------------+-----------|
| ! |            r |           F |             q |         n |
| # |         3.00 |        68.0 |          2.00 |  3.81e+12 |
|---+--------------+-------------+---------------+-----------|
#+TBLFM: $5=(($r*$cm)*sqrt($F/$k)-$q*$uC)/$e;%.2e

And I want @@latex: \num{3.81e+12}@@


# Local variables:
# org-latex-packages-alist: (("" "siunitx"))
# org-latex-table-scientific-notation: "\\num{%se%s}"
# End:

ok, I tried the test below removing siunitx variable because I include it with "#+latex_header: \usepackage[binary-units]{siunitx}". To get it to work I need to type C-c C-c when the cursor is on "#+CONSTANTS: k=8.99E9 e=1.60E-19 cm=1e-2 uC=1e-6" line but there are warnings in minibuffer (two times):


The local variables list in test_scientific.org
or .dir-locals.el contains values that may not be safe (*).

Do you want to apply it?  You can type
y  -- to apply the local variables list.
n  -- to ignore the local variables list.
!  -- to apply the local variables list, and permanently mark these
       values (*) as safe (in the future, they will be set automatically.)
i  -- to ignore the local variables list, and permanently mark these
       values (*) as ignored

   * org-latex-table-scientific-notation : "\\num{%se%s}"
OK, two things here

1) the message comes because there is no :safe declaration for this custom variable in ox-latex.el. You can say 'y' and continue with the test.

To check, you can alternatively add

(setq-local org-latex-table-scientific-notation: "\\num{%se%s}")

in your Emacs init code and remove the local variables completely.

2) Since you already have

#+latex_header: \usepackage[binary-units]{siunitx}

in your document header, you don't need to include it in the local variable or anywhere else.

Try to add the line above to your init.el and reset the :align parameter to ccccc -that was a silly test of mine ;-) -

That should be enough.

> I wonder if we can avoid "org-latex-table-scientific-notation: "\
> \num{%se%s}"" local variable adding some "#+latex_header: ..." or
> "#+attr_latex: :align ccccS ..." at the beginning of the table
> definition.

Hmmm.... We could have something like:

#+latex_table_sci_notation: \num{%se%s}

in the future... Would that help?

I have to confess that I prefer local variables, specially directory local variables, because they allow me to share documentation project with other people. I'm in the age of starting to think about passing things to the "next generation" ;-)



Now the test I tried:

===================================================================

# Local variables:
# org-latex-table-scientific-notation: "\\num{%se%s}"
# End:

#+title: Test Scientific Notation
#+author: *Angelo Graziosi*
#+email: [email protected]
#+date: {{{time(%d %B %Y (%a %H:%M))}}}
#+language: it
#+options: toc:nil H:3 num:t email:t

# LaTeX settings -----------------------------------------------
#+latex_class_options: [a4paper,11pt]
#+latex_header: \usepackage[english,italian]{babel}
#+latex_header: \usepackage{amsfonts}
#+latex_header: \usepackage{latexsym,mathtools}
#+latex_header: \usepackage{anysize}
#+latex_header: \usepackage[binary-units]{siunitx}
#+latex_header: \usepackage{braket}
#+latex_header: \usepackage{chngpage}
#+latex_header: \usepackage{calc}
#+latex_header: \usepackage{subfig}
#+latex_header: \usepackage[hyphens]{xurl}
#+latex_header: \usepackage{rotfloat}

#+latex_header: \usepackage[style=arsclassica]{classicthesis}

#+latex_header: \usepackage{pgfplots}
#+latex_header: \pgfplotsset{compat=1.18} %% As suggested in .log and manual

# Definitions for 'anysize' package: {left}{right}{top}{bottom}
#+latex_header: \marginsize{1.5cm}{1.5cm}{1.5cm}{1.5cm}

#+latex_header: \newcommand{\charge}[3]{\shade[ball color=#2] (#1) circle (.25); \draw (#1) node{$#3$};}
# --------------------------------------------------------------

* Test
#+CONSTANTS: k=8.99E9 e=1.60E-19 cm=1e-2 uC=1e-6
#+attr_latex: :align ccccS
|---+-----------------+----------------+------------------------------ +----------| |   | $r(\unit{\cm})$ | $F(\unit{\N})$ | $q_{\textup{A}}(\unit{\uC})$ | $n$      | |---+-----------------+----------------+------------------------------ +----------| | ! | r               | F              | q                            | n        | | # | 3.00            | 68.0           | 2.00                         | 3.81e+12 | |---+-----------------+----------------+------------------------------ +----------|
#+TBLFM: $5=(($r*$cm)*sqrt($F/$k)-$q*$uC)/$e;%.2e

===================================================================



Best, /PA
--
Pedro A. Aranda
ox-latex & ox-beamer maintainer

Sagen's Paradeiser! (ORF: Als Radiohören gefährlich war) => write BE!
IA: onomatopeya del rebuzno
2nd year of the New Koprocracy


Reply via email to