FxEditor
User guideQuickstartExamplesAPIDesignFxTeX
OverviewAPIExamplesRight-click menuSupported commandsAccessibilityFxTeX Packages
Using packagesmhchemchemfigphysics
FxTeX Server
OverviewAPIAccess and keysSelf-hostingSpeedPlugins
OverviewLicensing
How licensing worksfxTex Pro Packages
fxTeX Pro has three optional packages, each a LaTeX package of the same name. None of them is on unless a page asks for it, so a page that does not use them neither downloads them nor converts their commands. Each has a page of its own, with an editor set up for it, its commands and examples of each, as fxTeX Pro draws them:
| Package | What it is for | Toolbar panels | Adds, gzipped |
|---|---|---|---|
| mhchem | Chemical formulae, equations and units: \ce and \pu | mhchem, mhchem_arrows | 6.1 kB |
| chemfig | Structural formulae and reaction schemes, drawn as SVG: \chemfig, \schemestart | chemfig, chemfig_ext | 112 kB |
| physics | Derivatives, vectors, bra-ket notation, operators and matrices: \dv, \vb, \ket, \qty, … | A panel of your own — ready to copy | 2.9 kB |
The packages are part of fxTeX Pro, in the Professional and Enterprise licences. The free fxTeX has mhchem built in, but not chemfig or physics.
In fxTeX Pro
To render the equations already on a page, name the packages to autoRender():
<script src="https://fxtex.codecogs.com/fx_pk_your-key-here/fxtexpro.min.js"></script>
<script>
fxTeXPro.ready.then(() => {
fxTeXPro.unlock('fx_pk_your-key-here');
fxTeXPro.autoRender({ packages: ['mhchem', 'chemfig', 'physics'] });
});
</script>
Or, when you render or convert equations yourself, to usePackages(), and wait for
it before you do:
await fxTeXPro.ready;
fxTeXPro.unlock('fx_pk_your-key-here');
await fxTeXPro.usePackages(['mhchem', 'chemfig']);
const mathml = fxTeXPro.convertToMathML('\\ce{2H2 + O2 -> 2H2O}');
Each package is fetched from beside fxtexpro.min.js. Name only the ones a page
uses: chemfig in particular is far larger than the other two.
In the equation editor
The editor takes the same list, once per page, in EqEditor.init(). The packages
are ready, and their commands are in the editor's suggestions, once it resolves:
<script src="https://fxeditor.codecogs.com/fxeditor.api.min.js"></script>
<script>
const ready = EqEditor.init({
licence: 'fx_pk_your-key-here',
packages: ['mhchem', 'chemfig']
});
</script>
Adding the panels to the toolbar
A toolbar shows the panels it is given, row by row: each inner array is one row. Put a package's panels in among the others you want:
<div id="toolbar"></div>
<div id="mathview"></div>
<script>
// The toolbar draws its own buttons, so it need not wait for init().
const toolbar = EqEditor.Toolbar.link('toolbar', [
['mhchem', 'mhchem_arrows', 'chemfig', 'chemfig_ext', 'arrows'],
['operators_core', 'subsupset', 'brackets', 'greeklower', 'greekupper', 'symbols', 'spaces']
]);
ready.then(() => {
EqEditor.MathView.link('mathview').addToolbar(toolbar, true);
});
</script>
Or add a panel to a toolbar that is already built, at the end of a row:
EqEditor.Toolbar.link('toolbar') // the default toolbar
.appendPanel(0, 'mhchem') // to the end of the first row
.appendPanel(0, 'mhchem_arrows');
| Panel | Package | What is on it |
|---|---|---|
mhchem | mhchem | Charges, isotopes, oxidation states, precipitates and gases, and bonds — inside \ce{} |
mhchem_arrows | mhchem | Reaction arrows, with and without conditions above and below — inside \ce{} |
chemfig | chemfig | Rings, bonds of every kind, bond angles and branches — inside \chemfig{} |
chemfig_ext | chemfig | Charges and lone pairs, labels, brackets and reaction schemes |
A button on the mhchem or chemfig panels writes its piece inside \ce{} or
\chemfig{}, adding that command only when the caret is not already in one: press a
second button and it extends the formula you are writing rather than starting another.
There is no physics panel among the toolbar's own yet. The physics page has one to copy, passed in a design where a panel's name would go; the same works for a panel of any commands you like — see Extending Toolbar.
Without the package
On a page that has not asked for a package, its commands are not converted: \ce
and \pu say that they need mhchem, and chemfig's and physics' commands are unknown,
as any other unknown command is. Panels are not tied to packages, so nothing stops a toolbar
showing a panel whose package is off — name the package in init() on every
page whose toolbar has its panels.
More
mhchem — chemical formulae, equations and units.
chemfig — structural formulae and reaction schemes.
physics — derivatives, vectors, bra-kets and matrices.
Design — choosing and arranging toolbar panels.
Supported commands — every command fxTeX reads, the packages' included.
CodeCogs®