TexVar - LaTeX math calculations


TexVar (short tVar) is a basic LaTeX math calculations tool written in Lua. For integration into LaTeX, it has to be used together with LuaLaTeX. Compared to software like Mathcad TexVar is a lot more flexible. You can fill custom designed tables with results, do calculations within text documents and print beautiful LaTeX equations. The current version also supports 2D-plotting with gnuplot.

Currently the following operations are supported:

Upcoming features/task:

For a better understanding on what TexVar does, you should have a look at this presentation on SlideShare.


Download TexVar 1.5.18

Download TexVar 1.5.17

You can download the LaTeX package and the current manual separtely, but they are also contained in the download above:

Download Package

The project is also hosted on GitLab (TexVar on GitLab)

Getting started


The best way to start with TexVar is by reading the manual.

Download TexVar Manual 1.5.18

Download TexVar Manual 1.5.17


There is no installation needed. The folders tVar and lib only need to be in the same folder your executable file is. For plotting you need to change the path to your gnuplot install with the command:

% Linux and Mac
tPlot.gnuplot_library ="gnuplot"
% Windows
tPlot.gnuplot_library = [==["WINDOWSPATH"]==]


Need more Help?

In case you need further information or help on using TexVar, just send me an email.

You can also find additional information on all functions in the documentation (Open documentation in new window)


TexVar is a free software distributed under the terms of the MIT license.


6-Apr-2016 New Unit Based Calculations

Version 1.5.18 brings a huge change to TexVar. It's now possible to do calculations based on units. The new functionality is described in section 6 in the TexVar manual.

The new version is not completely compatible to version 1.5.17. Though the global parameters have new names, the old ones are still working (except for tPlot, tMat and tVec specific commands). The setUnit command now only takes well formatted unit strings, for details see section 6 of the manual.

Currently there is only a small amount of units implemented, but it's pretty easy to add custom unit definitions. The easiest way to add units permanently is by adding them to the file lib/unit_definitions.lua. Pascal for example is defined as:


Every units has to be added to the global stack with a unique name by :addUnit(name).

If you want your unit definitions to be implemented into the next version you can send them to pech@projectzoo.at.

8-Feb-2016 How to disable TexVar calculations
When working together with others on one LaTeX document, using TexVar can cause problems, when only one person has a working version. To temporarily disable TexVar execution you can easily redefine the tVar environment. The following code requires the listings package.

% Instead of
% \usepackage{texvar}
% write
The advantage of converting the tVar environment into a listings environment is, that the code is still visible but not executed.



Sebastian Pech
Schottenfeldgasse 36-38
+43 69917854544

Google Analytics

Diese Website benutzt Google Analytics, einen Webanalysedienst der Google Inc. (”Google”). Google Analytics verwendet sog. ”Cookies”, Textdateien, die auf Ihrem Computer gespeichert werden und die eine Analyse der Benutzung der Website durch Sie ermöglicht. Die durch den Cookie erzeugten Informationen über Ihre Benutzung diese Website (einschließlich Ihrer IP-Adresse) wird an einen Server von Google in den USA übertragen und dort gespeichert. Google wird diese Informationen benutzen, um Ihre Nutzung der Website auszuwerten, um Reports über die Websiteaktivitäten für die Websitebetreiber zusammenzustellen und um weitere mit der Websitenutzung und der Internetnutzung verbundene Dienstleistungen zu erbringen. Auch wird Google diese Informationen gegebenenfalls an Dritte übertragen, sofern dies gesetzlich vorgeschrieben oder soweit Dritte diese Daten im Auftrag von Google verarbeiten. Google wird in keinem Fall Ihre IP-Adresse mit anderen Daten der Google in Verbindung bringen. Sie können die Installation der Cookies durch eine entsprechende Einstellung Ihrer Browser Software verhindern; wir weisen Sie jedoch darauf hin, dass Sie in diesem Fall gegebenenfalls nicht sämtliche Funktionen dieser Website voll umfänglich nutzen können. Durch die Nutzung dieser Website erklären Sie sich mit der Bearbeitung der über Sie erhobenen Daten durch Google in der zuvor beschriebenen Art und Weise und zu dem zuvor benannten Zweck einverstanden.

This website uses Google Analytics, a web analytics service provided by Google, Inc. (“Google”). Google Analytics uses “cookies”, which are text files placed on your computer, to help the website analyze how users use the site. The information generated by the cookie about your use of the website (including your IP address) will be transmitted to and stored by Google on servers in the United States . Google will use this information for the purpose of evaluating your use of the website, compiling reports on website activity for website operators and providing other services relating to website activity and internet usage. Google may also transfer this information to third parties where required to do so by law, or where such third parties process the information on Google’s behalf. Google will not associate your IP address with any other data held by Google. You may refuse the use of cookies by selecting the appropriate settings on your browser, however please note that if you do this you may not be able to use the full functionality of this website. By using this website, you consent to the processing of data about you by Google in the manner and for the purposes set out above.