Go to page:

Search:   Help



LyX documentation


Shared groups



Categories: calculyx, preview
<< | Page list | >>

Back-of-envelope calculations using instant preview.


The calculyx package enables the numerical evaluation of mathematical expressions in LyX dynamically by means of instant preview. Such expressions can be created in the LyX math editor with considerable ease. With instant preview turned on, it also displays them elegantly. The LaTeX package calculyx.sty uses the ‘mini LaTeX runs’ of the instant preview facility to numerically evaluate such expressions, generally without having to make any change to their LaTeX form. Results can be presented in the form expression = result.

Components and requirements.

A zipped archive of the calculyx package can be found at calculyx. The package contains the LaTeX file calculyx.sty, the LyX module calculyx.module (defining the Calculate custom inset), and three explanatory documents in LyX format, Calculyx: basic use, Calculyx: advanced use, and Calculyx: hacker's use.

The package requires LyX 2.1.0 or later, and the three LaTeX3 bundles l3kernel, l3packages, and l3experimental, since it draws on modules from each of these. The calculational engine is the LaTeX3 floating point module l3fp in l3kernel. (From a user's point of view, LaTeX3 packages are used like any other LaTeX packages.) Note that your version of l3kernel should be later than 18 July 2014 since a main routine in calculyx.sty uses a command that was introduced to LaTeX3 on that date. Any expression involving a variable or variables will produce an error with earlier versions of l3kernel.


Calculyx accepts LaTeX expressions including: decimals; constants (pi, e, deg); arithmetic operations +, -, *, /, ^ (or **) and LaTeX variants like \times and \div; \frac and variants; \sqrt and \surd; trigonometric and hyperbolic functions and inverses; natural logarithm and exponential functions, max, min and gcd; binomial coefficients and factorials; sums and products (including to infinity!); limits; derivatives (orders one and two, ordinary and partial, explicit d-notation or primes or dots); and definite integrals in one variable. Variables can be essentially any single token (Latin, Greek, ...), including primed tokens.

As well as the basic \clyx command which evaluates expressions, the package includes the command \clyxtabulate to construct tables of functions (including multi-column tables of varying column length), and the command \clyxiterate to iterate functions (as in chaos theory).

The package tries to accept LaTeX expressions 'as is', without demanding 'calculator formatting' or extra parentheses. A screenshot of a one-page document containing the LaTeX on the left and the pdf on the right of a number of different calculations can be found at screenshot.


Category: calculyx preview

Edit - History - Print - Recent Changes - All Recent Changes - Search
Page last modified on 2014-11-25 02:39 CET