Panayotis Manganaris writes:
I'm on org 9.7.11. I treat the 20250709 version of siunitx as a first
class citizen for all my documents.
I am a bit skeptical concerning siunitx commands as first class citizens
in Org at least till custom inline elements aka "inline special blocks"
will be implemented.
The macros \num, \qty, and \unit are
all protected during export but \ang is escaped.
Are you sure that \qty works as expected? I tried a random example taken
from the siunitx manual.
#+name: example-qty
Quantity \qty{1.23}{J.mol^{-1}.K^{-1}}.
#+name: org-export-string-as
#+begin_src elisp :var text=example-qty
(org-export-string-as text 'latex t)
#+end_src
#+RESULTS: org-export-string-as
: Quantity \qty{1.23}\{J.mol\textsuperscript{-1}.K\textsuperscript{-1}\}.
Notice that braces around second argument are escaped. Another issue is
superscripts that should be passed literally. #+options: ^:nil has
effect similar to e:nil. Perhaps parser may be modified to handle
multiple arguments inside braces and to suppress parsing of Org markup
inside.
To my surprise I faced an issue even with \unit:
#+name: example-unit-text
Unit \unit{kg.m.s^{-1}}.
#+name: example-unit-latex
#+call: org-export-string-as(text=example-unit-text)
#+RESULTS: example-unit-latex
: Unit \unit\{kg.m.s\textsuperscript{-1}\}.
On 06/11/2025 16:50, Christian Moe wrote:
Note that the "ang" entry is redundant; the =\angle= entity exports to
exactly the same result, an angle symbol. So if siunitx is popular and
this conflict is going to crop up often, perhaps we should consider
removing the "ang" entry in org-entities. It would be a breaking change
for a few users, though.
My guess is that initially HTML names of entities were used, so \angle
is a bit later addition:
da556cee8 2010-03-28 09:48:03 +0200 Carsten Dominik: Implement new and
better support for entities
As to disabled entities, my expectation is that they should have chance
to be treated as LaTeX fragments. On the other hand I have never
disabled entities. (Vice versa I use them e.g. as workarounds for for
some org-ruby issues.)
P.S. I did not expect that pandoc may interpret siunitx commands. I
would say it should transparently pass arguments in the case of LaTeX output
pandoc -f org -t latex <<<'Angle \ang{1;2;3}.'
Angle 1°2′3″.
pandoc -f org -t latex <<<'Unit \unit[]{\gram\per\cubic\centi\metre}.'
Unit g~cm\textsuperscript{−3}.
pandoc -f org -t latex <<<'Quantity \qty{1.23}{\centi\metre g^{-1}}.'
Quantity 1.23~cm\emph{g}\textsuperscript{−1}.
Both arguments are recognized, but "g" is wrapped into \emph.
My feeling is that I have opened a can of worms.