File | Date | Author | Commit |
---|---|---|---|
LICENCE | 2012-06-11 |
![]() |
[4b4090] Added Code |
README.md | 2014-04-25 |
![]() |
[3f8957] changed some things in readme |
calc2booktab.py | 2014-04-25 |
![]() |
[446056] Did alot of code cleanup, tried to follow PEP8 |
A script for OpenOffice / Libreoffice Calc to convert tables to LateX-Code.
It can:
After installing (=copy to folder) the script you can run the macro in calc. You find the macro-menue at "Data" - "Macro" - "Run". Depending on the installation folder (share or user-folder) you find an entry with "calc2booktab" there. The script has 4 different functions that can be executed:
Names should explain the functionality.
For most users calc2booktab_basic is fine. It will convert the cells and format them for LaTeX.
calc2booktab_dcolumn adds functionality for numeric columns. Read the dcolumn-package manual for more information on what it does and how it is used (http://www.ctan.org/pkg/dcolumn). Please be aware that the script can only handle tables with one or zero columns of text. More text-columns will still be converted, but you have to adjust the dcolumn-definition in the code manually.
calc2booktab_fixed will format the table header with the tabular*-enviroment. The result will be a table with a fixed width. Default is 0.9\textwidth. If you want to use another standard-value, you can change this at the beginning of the calc2booktab.py-file. Have a look at the LaTeX-manual if you don't know this enviroment yet and want to learn more about it (for example: http://en.wikibooks.org/wiki/LaTeX/Tables).
calc2booktab_fixed_dcolumn combines both functionalities.
Most of the times I just want to hit a key and get my result. I didn't like the dialog of calc2latex, which I felt was unneccessary. So with this script, you can set 2 shortkeys, for example F3 and F4 (usually not assigned yet) for basic and dcolumn-function. Hit it, get your code.
As an alternative, you can add a button to your toolbar to start the macro.
So far the script is only available as source-file, you have to copy the calc2booktab.py into your LibreOffice/OpenOffice Scripts folder. Unfortunately, the user-script-folder does NOT work for Python-Scripts! You have to copy it to the main folder.
The folder relative to OpenOffice/libreoffice main is:
./share/Scripts/python
On Ubuntu and LibreOffice it can be found at
/usr/lib/libreoffice/share/Scripts/python
To install the script on Ubuntu, do:
$> sudo cp calc2booktab.py /usr/lib/libreoffice/share/Scripts/python
On Windows the folder should be at
C:\Program Files\libreoffice\share\Scripts\python
For further information and other systems:
http://www.openoffice.org/udk/python/scriptingframework/
In order for the tables to compile in LaTeX you need the following packages included:
\usepackage{booktabs}
If you want to align your numbers on your decimal point, use the dcolumn-Option and package
\usepackage{dcolumn}
Beta 1.4
Beta 1.3.1
Beta 1.3
Beta 1.2
Beta 1.1
Beta Release I
Pre-Beta
COPYRIGHT (c) 2012 Christoph Schober
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.