FxEditor
User guideQuickstartExamplesAPIDesignFxTeX
OverviewAPIExamplesRight-click menuSupported commandsAccessibilityFxTeX Packages
Using packagesmhchemchemfigphysicsFxTeX Server
OverviewAPIAccess and keysSelf-hostingSpeedPlugins
OverviewLicensing
How licensing worksphysics
The physics package is shorthand for the notation physicists write all day: \dv{f}{x}
for a derivative, \ket{\psi} for a state, \vb{F} for a vector, and
\qty(...) for brackets that grow to fit what is inside them. The editor below has a
physics panel in front of nearly the full set of maths panels. Click any example on this page
to open it there.
Adding physics to your page
In fxTeX Pro, name physics when you render the page:
fxTeXPro.ready.then(() => {
fxTeXPro.unlock('fx_pk_your-key-here');
fxTeXPro.autoRender({ packages: ['physics'] });
});
In the equation editor, name it to EqEditor.init(). There is no
physics panel among the toolbar's own yet, so this one is written out in full: put it in a
design where a panel's name would go, and change its buttons as you like. Each button has what
it inserts and the face it shows. This is the editor above:
<script src="https://fxeditor.codecogs.com/fxeditor.api.min.js"></script>
<div id="toolbar"></div>
<div id="mathview"></div>
<div id="latex"></div>
<script>
const ready = EqEditor.init({
licence: 'fx_pk_your-key-here',
packages: ['physics']
});
const physics = {
label: 'Physics',
button: { width: 40, height: 50 },
rows: 1,
columns: 6,
buttons: [
{ insert: '\\dv{}{}', face: '\\dv{f}{x}' },
{ insert: '\\dv[2]{}{}', face: '\\dv[2]{f}{x}' },
{ insert: '\\dv{}', face: '\\dv{x}' },
{ insert: '\\fdv{}{}', face: '\\fdv{F}{g}' },
null,
null,
{ insert: '\\pdv{}{}', face: '\\pdv{f}{x}' },
{ insert: '\\pdv[2]{}{}', face: '\\pdv[2]{f}{x}' },
{ insert: '\\pdv{}{}{}', face: '\\pdv{f}{x}{y}' },
{ insert: '\\pdv{}', face: '\\pdv{t}' },
null,
null,
{ insert: '\\vb{}', face: '\\vb{F}' },
{ insert: '\\va{}', face: '\\va{v}' },
{ insert: '\\vu{}', face: '\\vu{n}' },
{ insert: '\\vdot', face: '\\vb{a}\\vdot\\vb{b}' },
{ insert: '\\cross', face: '\\vb{a}\\cross\\vb{b}' },
null,
{ insert: '\\grad{}', face: '\\grad{\\phi}', width: 48 },
{ insert: '\\divergence{}', face: '\\divergence{\\vb{F}}', width: 48 },
{ insert: '\\curl{}', face: '\\curl{\\vb{F}}', width: 48 },
{ insert: '\\laplacian{}', face: '\\laplacian{\\phi}', width: 48 },
null,
null,
{ insert: '\\ket{}', face: '\\ket{\\psi}', width: 56 },
{ insert: '\\bra{}', face: '\\bra{\\psi}', width: 56 },
{ insert: '\\ip{}{}', face: '\\ip{\\phi}{\\psi}', width: 56 },
{ insert: '\\op{}{}', face: '\\op{a}{b}', width: 56 },
{ insert: '\\expval{}', face: '\\expval{A}', width: 56 },
{ insert: '\\mel{}{}{}', face: '\\mel{m}{A}{n}', width: 56 },
{ insert: '\\qty()', caret: 5, face: '\\qty(x)', width: 56 },
{ insert: '\\abs{}', face: '\\abs{x}', width: 56 },
{ insert: '\\norm{}', face: '\\norm{v}', width: 56 },
{ insert: '\\comm{}{}', face: '\\comm{A}{B}', width: 56 },
{ insert: '\\eval{}_{}^{}', face: '\\eval{f}_0^1', width: 56 },
{ insert: '\\order{}', face: '\\order{x}', width: 56 }
]
};
const toolbar = EqEditor.Toolbar.link('toolbar', [
[physics, 'operators', 'brackets', 'matrix', 'accents', 'arrows'],
['greeklower', 'greekupper', 'relations', 'binary', 'symbols', 'subsupset', 'spaces']
]);
ready.then(() => {
const latex = EqEditor.LaTeXView.link('latex');
const mathview = EqEditor.MathView.link('mathview').addLaTeXView(latex);
toolbar.addLaTeXView(latex).addMathView(mathview);
mathview.setLatex('i\\hbar\\pdv{t}\\ket{\\Psi} = \\hat{H}\\ket{\\Psi}');
});
</script>
A panel fills a column at a time, so each column here is one family of commands — a
null is a gap that keeps the next family at the top of its own column. The first
rows are always on show and the rest drop down beneath them. An empty
{} in insert is a box to fill in; caret puts the cursor
that many characters in, as \qty() does to land between its brackets; and
width gives a button a wider cell than the panel's. See Using
packages for more on both steps.
Automatic brackets
\qty sizes its brackets to what is inside, whichever kind they are — no
\left and \right. The others name the bracket and take braces.
\qty(\frac{a}{b})Round.
\qty[\frac{a}{b}]Square.
\qty{\frac{a}{b}}Curly.
\qty|\frac{a}{b}|Vertical bars.
\pqty{a+b} \bqty{a+b} \Bqty{a+b}\pqty, \bqty and \Bqty: the same, with braces.
\abs{\frac{a}{b}}Absolute value.
\norm{\vb{v}}Norm.
\eval{x^2}_0^1Evaluated between limits.
\order{x^2}Order of.
\comm{A}{B}Commutator.
\acomm{A}{B}Anticommutator.
\pb{A}{B}Poisson bracket.
Vectors
Bold, arrowed and unit vectors, products, and the vector calculus operators.
\vb{F}Bold vector.
\va{v}Arrow vector.
\vu{n}Unit vector.
\vb{a} \vdot \vb{b}Dot product.
\vb{a} \cross \vb{b}Cross product.
\grad{\Psi}Gradient.
\divergence{\vb{E}}Divergence.
\curl{\vb{B}}Curl.
\laplacian{\phi}Laplacian.
\curl{\vb{E}} = -\pdv{\vb{B}}{t}Faraday's law.
Derivatives
\dv is an ordinary derivative and \pdv a partial one: the function,
then the variable, with the order in square brackets. Leave out the function for the operator
on its own. \dd is the upright d of a differential.
\dv{f}{x}Derivative.
\dv[2]{f}{x}Second derivative.
\dv[n]{f}{x}nth derivative.
\dv{x}The operator alone.
\dv{t}(m\dv{x}{t})Applied to a bracket, which grows to fit.
\pdv{f}{x}Partial derivative.
\pdv[2]{f}{x}Second partial derivative.
\pdv{f}{x}{y}Mixed partial derivative.
\fdv{F}{g}Functional derivative.
\int f(x) \dd{x}A differential.
\vb{F} = m\dv[2]{\vb{r}}{t}Newton's second law.
Dirac notation
Bras, kets, and everything made of them.
\bra{\phi}Bra.
\ket{\psi}Ket.
\ip{\phi}{\psi}Inner product. In fxTeX, \braket takes one argument, as in the braket package; use \ip for two.
\op{a}{b}Outer product; also \dyad and \ketbra.
\expval{A}Expectation value.
\expval{A}{\Psi}In a given state.
\mel{n}{H}{m}Matrix element.
i\hbar\pdv{t}\ket{\Psi} = \hat{H}\ket{\Psi}The Schrödinger equation.
\expval{\comm{\hat{x}}{\hat{p}}} = i\hbarBrackets inside brackets.
Operators and functions
Functions whose brackets size themselves, and the operators maths does not have.
\sin(\frac{\pi}{2})A function's brackets grow to fit.
\exp(i \omega t)Exponential.
\tr{\rho}Trace; \Tr for a capital.
\rank{M}Rank.
\Re{z} + \Im{z}Real and imaginary parts.
\Res[f(z)]Residue.
\erf(x)Error function.
Text in equations
\qq sets words with a quad of space either side; \qand and
\qcomma are the commonest.
x \qq{for all} x>0Any words.
a=1 \qand b=2“and”.
a=1 \qcomma b=2A comma.
Matrices
\mqty is a matrix, its brackets chosen as for \qty; the
\pmqty family name them, and the s forms are small. Inside one,
\imat, \pmat, \dmat and the rest fill it in.
\mqty(a & b \\ c & d)Round brackets.
\mqty[a & b \\ c & d]Square brackets.
\mdet{a & b \\ c & d}Determinant.
\smqty(a & b \\ c & d)Small.
\mqty(\imat{3})Identity.
\mqty(\pmat{2})A Pauli matrix.
\mqty(\zmat{2}{2})Zeros.
\mqty(\xmat*{a}{2}{3})Indexed elements.
\mqty(\dmat{a,b,c})Diagonal.
\mqty(\admat{a,b,c})Antidiagonal.
The physics manual
The physics package is by Sergio C. de la Barrera. Its manual lists every command, and the long names each short one stands for:
physics manual (PDF) — the LaTeX package's documentation, on CTAN.
physics on CTAN — the package, its licence and versions.
More
Using packages — turning packages on, and their panels.
Extending Toolbar — more on writing a panel of your own.
Supported commands — every physics command fxTeX reads.
CodeCogs®