Hmmm...
What Org version are you using? This may be the cause for our
misunderstandings...
Can you try one thing for me..
Use the current main from the git repository, apply the attached patch
and repeat the test. It now includes the #+LATEX_TABLE_SCI_NOTATION:
keyword I told you in my previous email, as well as the missing safe
definition for the variable...
Hope it helps & Thanks, /PA
On 7/10/26 19:00, Angelo Graziosi wrote:
Il 07/10/2026 18:31, Pedro A. Aranda ha scritto:
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.
I did so but it does not seems to work. In the PDF the number is in mEn
format..
In Emacs C-h v on org-latex-table-scientific-notation prints
org-latex-table-scientific-notation is a variable defined in ‘ox-latex.el’.
Its value is nil
Format string to display numbers in scientific notation.
The format should have "%s" twice, for mantissa and exponent
(i.e., "%s\\times10^{%s}").
When nil, no transformation is made.
This variable was introduced, or its default value was changed, in
version 24.4 of Emacs.
You can customize this variable.
Ciao,
Angelo.
--
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
diff --git a/doc/org-manual.org b/doc/org-manual.org
index d4389a281..328361138 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -14838,10 +14838,13 @@ Set the caption with the LaTeX command
#+vindex: org-latex-packages-alist
If your table has numbers in scientific notation, you can control how
they are shown with the variable
-~org-latex-table-scientific-notation~. For example:
+~org-latex-table-scientific-notation~. This variable can be set in the
+document header with the keyword ~#+LATEX_TABLE_SCI_NOTATION:~
-#+begin_src emacs-lisp
-(setq org-latex-table-scientific-notation "\\num{%se%s}")
+For example:
+
+#+begin_src org
+,#+LATEX_TABLE_SCI_NOTATION: \num{%se%s}
#+end_src
#+texinfo: @noindent
@@ -14850,7 +14853,12 @@ engineering format =m.mmmEnn=. The first string placeholder(=%s=) in
~org-latex-table-scientific-notation~ will be replaced by the mantissa
and the second by the exponent. *Note* that to use the example above, you
will need to add the ~siunitx~ package to your
-~org-latex-packages-alist~.
+~org-latex-packages-alist~ or with:
+
+#+begin_src org
+,#+LATEX_HEADER: \usepackage{siunitx}
+#+end_src
+
*** Images in LaTeX export
:PROPERTIES:
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index f9b9981e6..76095d4ff 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -163,7 +163,7 @@ (org-export-define-backend 'latex
(:latex-prefer-user-labels nil nil org-latex-prefer-user-labels)
(:latex-subtitle-format nil nil org-latex-subtitle-format)
(:latex-subtitle-separate nil nil org-latex-subtitle-separate)
- (:latex-table-scientific-notation nil nil org-latex-table-scientific-notation)
+ (:latex-table-scientific-notation "LATEX_TABLE_SCI_NOTATION" nil org-latex-table-scientific-notation)
(:latex-tables-booktabs nil nil org-latex-tables-booktabs)
(:latex-tables-centered nil nil org-latex-tables-centered)
(:latex-text-markup-alist nil nil org-latex-text-markup-alist)
@@ -928,7 +928,8 @@ (defcustom org-latex-table-scientific-notation nil
:package-version '(Org . "8.0")
:type '(choice
(string :tag "Format string")
- (const :tag "No formatting" nil)))
+ (const :tag "No formatting" nil))
+ :safe #'string-or-null-p)
;;;; Lists
diff --git a/testing/lisp/test-ox-latex.el b/testing/lisp/test-ox-latex.el
index b2cf44cae..0bd1b7075 100644
--- a/testing/lisp/test-ox-latex.el
+++ b/testing/lisp/test-ox-latex.el
@@ -755,5 +755,24 @@ (ert-deftest test-ox-latex/alt-attribute ()
(should (search-forward "It has a second line!}" nil t))
(should (search-forward "]{./image.png}" nil t))))
+(ert-deftest test-ox-latex/sci-notation ()
+ "Test the #+LATEX_TABLE_SCI_NOTATION keyword."
+ (org-test-with-exported-text
+ 'latex
+ "#+LATEX_TABLE_SCI_NOTATION: \\num{%se%s}
+
+My table is:
+
+#+attr_latex: :align cccc
+| r | F | q | n |
+| 3.00 | 68.0 | 2.00 | 3.81e+12 |
+
+Looks nice, doesn't it?
+"
+ ;; (message "sci-notation: %s" (buffer-string))
+ (goto-char (point-min))
+ (should (search-forward "\\begin{tabular}"))
+ (should (search-forward "2.00 & \num{3.81e+12}"))))
+
(provide 'test-ox-latex)
;;; test-ox-latex.el ends here