# LaTeXCalc Documentation

## Install & Quick Start

Please see the download page for installation instructions and the main page for a super-quick start guide

## Basic Usage

LaTeXCalc adds seven new commands to the LaTeX language. Any of them may be used in either text mode or math mode; LaTeXCalc will put math in math mode for you. The commands are as follows:

 Command Arguments Description \calc { expression } Evaluates the expression and puts the answer in-line with the LaTeX surrounding it. \solver { expression } Evaluates the expression and stores the answer for future reference. The expression itself is printed as inputted and displayed in math mode. \hidden { expression } Same as \solver except that the expression is not printed. This is useful for doing computations that you don't want to be typeset. \varcalc { variable } { expression } Evaluates the expression and puts the answer in-line with the LaTeX surrounding it. The answer is also stored in the variable. \varsolver { variable } { expression } Evaluates the expression and stores the answer in the variable. The expression itself is printed as inputted and displayed in math mode. \varhidden { variable } { expression } Same as \varsolver except that the expression is not printed.

### Expressions

Expressions are combinations of mathematical operators and functions that produce a well-defined output. LaTeX is an expansive language that was designed for typesetting, not mathematical evaluation. As a result, LaTeXCalc cannot accept all possible LaTeX code in expressions. Instead a limmited subset of commonly-used expressions is available. Here are a list of functions and operators that LaTeXCalc recognizes:
• +,-,*,/,(,) - These standard arithmetic operators act exactly as you would expect them to. Order of operations is followed properly.
• \times, \div - Correspond to the operator equivalents
• \frac{ expression }{ expression } - fractions (\tfrac and \dfrac also work)
• ^ (carret) - for exponentiation
• \sqrt{ expression } - square root
• \sqrt[n]{ expression } - nth root
• ! - factorial
• Concatenated expressions are treated as multiplication. E.g. (3)(5) = 15
• \sin,\cos,\tan,\csc,\sec,\cot - Exactly what you would expect. By default, radians are used. Degrees can be specified by suffixing the angle by ^\circ
• \sinh,\cosh,\tanh,\csch,\sech,\coth - Hyperbolic trigonometric functions.
• \log - computes log base 10
• \ln - computes log base e
• \log_b - computes log base b
• \lfloor expression \rfloor - computes the floor of the expression.
• \lceil expression \rceil - ceiling
• \binom{ expression }{ expression } - computes the binomial coefficient
• \binom{ expression }{ expression expression ... } - computes the multinomial coefficient
• \mod,\pmod{ expression } - if \pmod shows up at the end of a top-level expression it returns that expression modulo the argument to \pmod. E.g. \calc{35 \pmod{6}} produces 5.

#### Using Functions

Ambiguity can occur when calling functions. For example, if you want to compute \sin \pi/2 it's not clear if you mean \sin{\pi}/2 or \sin{\pi/2}. An experienced LaTeX user might expect the former behavior since LaTeX usually will only accept one token as an argument to a function without braces, while anyone looking at the output may expect the latter. Therefore, LaTeXCalc requires that functions such as \sin or \cos be used with either parenthesis or curly braces around the argument.

#### Whitespace Rules

LaTeXCalc does its best to ignore whitespace. This usually works well, but since there are so many ways of creating whitespace in LaTeX it is sometimes a challange.

#### Caveats

Currently we cannot specify how accurate our answers are. Please use this software with caution; if you must have a high degree of accuracy you're better off using something else.

While much care has been taken to make sure that LaTeXCalc has been written properly, it's impossible for the designers of LaTeXCalc to anticipate everything. Try your best to write your inputs in plain mathematical terms without extra formatting. This will maximize the probability that LaTeXCalc understands what you want and provides correct answers. If you ever encounter a bug where you expect LaTeXCalc to do something differently, please report it to the bugs list: latexcalc-bugs@lists.sourceforge.net.

### Variables

Variables are used to store the output of computations and use them later. All variables are either one letter of the english alphabet or one greek letter. However, they may be modified with the following LaTeX commands in any combination you wish:
• \bar,\Bar
• \hat,\Hat
• \vec,\Vec
• \check,\Check
• \dot,\Dot
• \ddot,\Ddot

#### Notes

Uppercase and lowercase letters are distinct in both alphabets. Using the modifiers above in any order transform it into a different variable. For example, each of the following are unique variables: \alpha, \hat{\Alpha}, \dot{\alpha}, a, \Alpha, \dot{\hat{\alpha}}, \hat{\dot{\alpha}}.

Some variables, namely e, \pi and \phi are reserved for the corresponding constants. You are free to override them with commands but LaTeXCalc will produce a warning.

### Command Line Argument

The command line arguments to LaTeXCalc are described in the man page. This section may be expanded as the developers have time to document.