TeX Extension Options
colinc86 opened this issue · comments
electrocampbell commented
Implement TeX extension options.
Juan Cazalla Estrella commented
Hi @colinc86!
Great work in the library. Could you guide me on how I can help with this? I would like to add support for some AMSmath labels like \binom
electrocampbell commented
Hey thanks, @juancazalla, and sorry for not getting around to this sooner!
You can load different extensions through the TexInputProcessorOptions
' loadPackages
property. Only the base
extension is loaded by default, so this will error:
let output = try await mathjax.tex2svg("\\binom{n}{k}")
But this will render:
let texOptions = TeXInputProcessorOptions(loadPackages: [TeXInputProcessorOptions.Packages.ams])
let output = try await mathjax.tex2svg("\\binom{n}{k}", inputOptions: texOptions)
If you want all of the extensions available to MathJax loaded you can use TeXInputProcessorOptions.Packages.all
as the input array.