LaTeXCalc

Get your work done faster!

Home
Documentation
Download
latexcalc is a "LaTeX Calculator" that calculates values inside your LaTeX files before typesetting them. More accurately, it preprocesses files written in a superset of the LaTeX typesetting language and evaluates specified expressions in the text.

Install

Download the latest tarball here: latexcalc-1.0.tar.gz. To install, simply run './configure', 'make', 'make test', 'make install'. Mandatory dependencies are a LaTeX distribution, gcc, flex, bison and make.

Super-Quick Tutorial:

This tutorial assumes you have pdflatex and latexcalc installed, and that you already have knowledge of LaTeX. Put the following into a file, say "test.tex":

\documentclass[12pt]{article}

\begin{document}
Here are \calc{1+1} examples of LaTeXCalc!\\
\begin{enumerate}
\item If $x = \varcalc{x}{2+1}$ then $\solver{x^2} = \answer$. In this example, 3 is stored as the variable $x,ドル and then 'answer' is replaced by the value of the expression $x^2,ドル which in this case is 9.
\item Many functions and constants are provided. Consider $\solver{\log_{10}{(\sin{e^4}+2)}} = \answer$
\end{enumerate}
\end{document}

Then run $latexcalc --pdflatex test.tex. LaTeXCalc then parses your file, evaluates expressions as you would expect and runs pdflatex to generate test.pdf. That easy!

Current Features

  • Standard operators: +, -, *, /, fractions (\frac and variants), multiplication by concatenation, proper order of operations, exponentiation (^), factorial (!)
  • Many mathematical functions: combinatorics (\binom), trigonometric functions (\sin, \cos, \tan), inverse and hyperbolic trigonometric functions, logarithms (\log,\ln,\log_{b}), minima/maxima of sets (\min,\max)
  • Built-in constants: e, \pi, \phi
  • Variables to save numerical values. Valid names are the supported greek letters in LaTeX (such as \alpha), alphabetic characters (a-z). Variables may further be distinguished with some subscripts, commands such as \hat, and more!

Limitations

This project would be aptly-named LINCAS: LaTeXCalc is not a Computer Algebra System! Here are some things LaTeXCalc cannot do:
  • Support for big numbers
  • Do symbolic manipulation
  • Handle \begin{verbatim} and \verb correctly; it's not possible to typeset '\answer' without latexcalc trying to evaluate it.
  • Solve equations
  • Absolute values
  • Sums, integrals and differentiation

Future Expansion

For future releases we are planning on:
  • Support for big numbers
  • Interfacing with open source computer algebra systems, such as SAGE and gap
  • Support for some numerical integration, differentiation and sums
  • Absolute values
  • Improved verbatim support
  • And much, much more!
Copyright 2010 Berkeley Churchill and Steven Boyd
Please report bugs to latexcalc-bugs@lists.sourceforge.net

AltStyle によって変換されたページ (->オリジナル) /