Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support \SI and \si from siunitx #817

Open
samridhgupta opened this issue Aug 22, 2017 · 10 comments
Open

support \SI and \si from siunitx #817

samridhgupta opened this issue Aug 22, 2017 · 10 comments

Comments

@samridhgupta
Copy link

No description provided.

@kevinbarabash
Copy link
Member

@samridhgupta is \per any different from /?

@kevinbarabash
Copy link
Member

Apparently it does. From the docs for the siunitx package:

\si[per-mode=symbol]
{\kilogram\metre\per\ampere\per\second}

results in

kg m/(A s)

@ylemkimon ylemkimon changed the title per \per Aug 2, 2018
@ylemkimon ylemkimon changed the title \per support \SI and \si from siunitx Oct 11, 2019
@krtko1
Copy link

krtko1 commented Oct 14, 2019

is there any progress?

@kevinbarabash
Copy link
Member

None yet. This is tricky because the non-optional argument to \si requires custom parsing in order for \per\ampere\per\second to be combined into /(A s).

I'm curious about the benefits of this package. It seems like it'd be easier to type:

\text{kg\,m/(A\,s)}

than

\si[per-mode=symbol]{\kilogram\metre\per\ampere\per\second}

@TonalidadeHidrica
Copy link

The benefit of this package is that you can obtain unified style of units across the pages, the spacing is always determined automatically, and the document becomes more semantic.
Also it allows to write something like \SI{2.04e6}{\metre\per\second} , which renders like $ 2.04 \times 10^6 \text{m \, s}^{^1} $

I do want this function available for KaTeX too.

@karlkappe
Copy link

Any progress on this feature? It would be really nice if KaTeX could support siunitx, even if it is only rudimentarily .

@krtko1
Copy link

krtko1 commented Feb 19, 2022

100% agree, but no progress was made, I think.

@emareg
Copy link

emareg commented May 4, 2022

I would also like proper parsing... Currently, I use the following workaround:

var macros = {
  "\\SI": "{#1\\;\\mathrm{#2}}",
  "\\squared": "{^{2}}",
  "\\cubed": "{^{3}}",
  "\\per": "/",
  "\\tera": "T",
  "\\giga": "G",
  "\\mega": "M",
  "\\kilo": "k",
  "\\milli": "m",
  "\\micro": "μ",
  "\\nano": "n",
  "\\kilogram": "\\text{kg}\\,",
  "\\meter": "\\text{m}\\,",
  "\\second": "\\text{s}\\,",
  "\\ampere": "\\text{A}\\,",
  "\\kelvin": "\\text{K}\\,",
  "\\mol": "\\text{mol}\\,",
  "\\candela": "\\text{cd}\\,",
  "\\newton": "\\text{N}\\,",
  "\\hertz": "\\text{Hz}\\,",
  "\\pascal": "\\text{Pa}\\,",
  "\\volt": "\\text{V}\\,",
  "\\watt": "\\text{W}\\,",
  "\\joule": "\\text{J}\\,",
  "\\henry": "\\text{H}\\,",
  "\\farad": "\\text{F}\\,",
  "\\coulomb": "\\text{C}\\,",
  "\\ohm": "\\Omega\\,",
  "\\weber": "\\text{Wb}\\,",
  "\\tesla": "\\text{T}\\,",
  "\\degree": "\\text{deg}\\,"
};

...

katex.render(el.innerHTML, el, { displayMode: true, macros: macros })

@karlkappe
Copy link

Are there any new?

@myzinsky
Copy link

That feature would be important for us

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants