| |
CompPad is a LibreOffice extension for performing units-aware
engineering calculations within a Writer document, allowing calculations to be
documented using all of the resources of the Writer application. It has
functionality similar to Mathcad, but is not intended to be a Mathcad clone.
Rather, I hope it might prove more flexible and extensible, and that it might
encourage other free / open-source alternatives to a proprietary engineering
"Killer App."
| |
CompPad allows you to create technical calculations in the form of
conventional-looking mathematical expressions using the LibreOffice equation
editor. This editor has a simple text syntax that some consider to be faster and
more intuitive than other equation editors. Then, with the click of a toolbar
icon, CompPad will evaluate the expressions and display the results, embedded in
your document. All of the features of LibreOffice are available for
documenting and formatting your document so that it can be presented with pride
to co-workers, customers, professors, etc.
Example
Here is an example of how you might use CompPad. It is a simple
mechanical harmonic oscillator example based on the Wikipedia
topic . You
can download this example here:
example - harmonic oscillator.odt.
- Install the CompPad extension (easy, see below.)
- Open a new LibreOffice Writer document. Open the CompPad sidebar with
"View" -> "Sidebar", then click the CompPad icon
in
the sidebar's tab bar. It has three sections: Edit Expression, a
resizable multi-line box for typing formulas; Palette, which is
described below; and Resources, with a link to this site and a button
that opens the demo document.
- A toolbar is available as well, with a single-line edit field and the same
buttons:
. Either surface
will do - the steps below work the same way in both.
- First we define the mass of the oscillator. Type the following into the
sidebar's Edit Expression box, or into the toolbar edit field
:
(without quotation marks) "M:=10 kg"
- Press "enter" or click
.
In the sidebar the box holds as many lines as you like: "enter" applies the
formula, and "ctrl+enter" starts a new line.
The following formula will be created:
- Use the mouse to move the cursor to a point after the formula. Now you
can create another formula or edit text.
- Define the spring constant:
"K:= 4 lbf/inch"

If you are not sure how a unit is spelled - it is inch, not
in - open the Palette section of the sidebar and pick it
from a group: Length, area, volume & angle holds inch,
and Mass, force & pressure holds lbf. Clicking a
button inserts the correct spelling where the cursor is, and hovering over one
says what the unit is. The palette also carries the Greek letters, the
operators and brackets, the matrix notation, the functions and the display
settings.
- Calculate the natural frequency of the oscillator:
"f_n := 1 over {2 %pi} sqrt{ K over M}="
- To evaluate the expressions you've entered so far, click
. You will see that the last expression gets updated with the
result of the calculation:
Notice how the units of measure were handled automatically. Even though we
entered quantities in both SI and US Customary units, the correct solution was
computed.
- Define the amplitude of the oscillation:
"A:= 2 cm"
- Define position as a function of time:
"x(t) := A cos left( sqrt{K over M } t right)"
- Create a time vector with 21 elements, ranging from 0 to 1 s:
"t:={0 dotslow 20} over 20 s"
- Then calculate the position vector:
x_t:= x(t)
- To plot position vs. time:
"plotxy(t,x_t)"
- Finally, click
. You will see the following plot added to the document:
Now, you can add text, pictures, formatting, and other elements using all of
the features of LibreOffice Writer. If you need to change a parameter in
the calculation, you can make your changes using the equation editor, and then
to re-evaluate the document.
CompPadDemo.odt demonstrates all the features of CompPad in a writer
document. Also, check out the example files.
Screenshots
Click thumbnails for full-size image.
Installation
- All releases are available
HERE.
- New users should download the most recent .oxt from the "0.5" branch - this is the
current release and the default download.
- In LibreOffice, installing the extension for the
first time should be as simple as opening the .oxt file using "File" -> "Open",
or via "Tools" -> "Extension Manager".
- After installing, you will need to re-start LibreOffice.
- If you are upgrading from a previous version of CompPad, the above procedure
should work. If you have any trouble, post a message on the
Discussion Forum
The latest releases (0.5.x) are implemented in Python and do not require a Java
runtime - they use the Python support built into LibreOffice, and have
been tested with LibreOffice 26.2. They should run on Windows, Linux, macOS, and
other operating systems that support LibreOffice.
Using CompPad
- Try the example above
- For a document with an extensive list of examples, download
CompPadDemo.odt . This file demonstrates most of the features of CompPad and
should help you get started.
- Try changing the expressions in these examples, or create a new document with
your own expressions. If you get an error, double-check the offending formula.
- If you're stuck, search the Discussion Forum
to see if your question has already been answered.
- Post questions, bug-reports and feature requests to the Discussion Forum .
Example Files
CompPadDemo.odt
is a document which contains examples of most CompPad features.
example - fluid mechanics.odt
Current Status
CompPad is usable and has been reportedly used to evaluate documents with
hundreds of formulas. Every release is covered by an automated suite of over
1,300 tests, and the calculation engine is tested on its own, independently of
LibreOffice.
Here are a few of the features that are supported in the most recent version:
- A sidebar holding a resizable, multi-line expression editor, a palette, and
a button that opens the demo document. A toolbar with a single-line edit field
is available as well.
- A palette of the things that are hard to guess at: every unit CompPad
knows, grouped by what it measures; the Greek letters; the operators and
brackets; the matrix notation; the functions; and the display settings.
Clicking an entry inserts it where the cursor is, spelled correctly, and
wraps or follows whatever text is selected.
- Single-line function definition
- Real and Complex numbers, booleans, vectors and matrices
- Units of measure are handled in all quantities and calculations. Supported units are listed here: UNITS.md
- Units are displayed according to the specified system of units. Options are
"SI","US","CGS".
- Temperatures can be written the way they are spoken -
T := 70 degF
- and a temperature is distinguished from a temperature interval
(deltaDegC, deltaDegF).
- Linear algebra: determinant, inverse, and the solution of a linear system
(
det(A), inv(A) or A^-1,
lsolve(A,b)).
- Vector / matrix operators including transpose, dot product, norm, min, max,
sum and product. Scalar functions are applied element by element.
-
|X| follows the shape of what it encloses - the absolute value
of a number, the magnitude of a vector, the determinant of a square matrix.
- Conditionals, with any number of cases.
- Basic operators including arithmetical, exponential, comparison, rounding,
trigonometric, hyperbolic, logarithmic, and roots of any degree.
- Range variables, with an explicit step if you want one:
first, second dotslow last
- Support for alternate decimal separators - either "." or ","
- Basic X-Y plotting
- Complex variable names consisting of almost any combination of text or formula element.
- Changing expression color
- Blocking evaluation of an expression.
- Setting the number of displayed significant figures or decimal places, and
a threshold below which a result is shown as zero.
- import expressions from a text file.
- The user interface is translated into nine languages: English, German,
Spanish, French, Italian, Dutch, Greek, Ukrainian and Simplified Chinese.
If you require a certain feature for CompPad to be useful to you, please
let me know. I may be able to give it priority.
Development
CompPad is being actively developed.
Following are a few features I hope to implement eventually:
- Numerical calculus: definite integrals and derivatives, in the correct
derived units.
- Scope blocks and function blocks - turning a Writer frame into a scope of
its own, so that a calculation can show its working without its intermediate
names escaping into the rest of the document.
- A more complete set of built-in functions and operators.
- Control structures such as loops.
- Import expressions from other documents
- Read from and write to cells in LibreOffice Calc.
- Plug-in framework for adding new functions, operators, etc.
- Web interface
Contribute
Currently the best way to contribute is to try out CompPad, and post your
question and comments to the Discussion Forum. Your
comments help me know what is important to users. I would especially like to know how you would
like to use CompPad. If you require a certain feature in order for CompPad to be
useful to you, then let me know. I may be able to give it priority.
If you like CompPad, please let people know by posting a message in your blog,
in on-line forums, or other news outlets. If you don't like it, then post on the
Discussion Forum and tell me why!
Financial contributions are also welcome!
License
Source code is provided under the terms of the GPL Ver. 3. It is available
through GIT on the Sourceforge Project Page.

Copyright 2026. All Rights Reserved.
|
|