Download Latest Version calc2booktab-v1-4.zip (20.0 kB)
Email in envelope

Get an email when there's a new version of calc2booktab.latex

Home
Name Modified Size InfoDownloads / Week
dev 2012-06-18
README.md 2014-04-25 5.6 kB
calc2booktab-v1-4.zip 2014-04-25 20.0 kB
calc2booktab-v1-3-1.zip 2012-09-14 19.8 kB
calc2booktab-v1-3.zip 2012-08-22 19.4 kB
calc2booktab-v1-2.zip 2012-06-21 18.4 kB
calc2booktab-v1-1.zip 2012-06-20 17.6 kB
Totals: 7 Items   100.8 kB 0

calc2booktab

A script for OpenOffice / Libreoffice Calc to convert tables to LateX-Code.

It can:

  • Convert the selected cellrange to LaTeX-code
  • Convert bold and italic cells to \textbf{} and \textit{}
  • Format first row as \multicolumn{1}{c} (e.g. for dcolumn)
  • Keep user-set cell-alignment (center, left, right)
  • First column will always be left if text, centered if numeric
  • If dcolumn-package is used: Include correct column-definition
  • Format all numeric cells with $..$
  • Create tables with width fixed to x.x\textwidth

HOW TO USE

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:

  • calc2booktab_basic
  • calc2booktab_dcolumn
  • calc2booktab_fixed
  • calc2booktab_fixed_dcolumn

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.

Why so many functions?

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.

INSTALL

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/

Prerequisites for LaTeX-Header

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}

RELEASE NOTES

Beta 1.4

  • Fixed problems with indention that caused the script not to work with LibreOffice 4.x
  • Removed some old functionality

Beta 1.3.1

  • Added one feature: '%' will be escaped to '\%' according to LaTeX-rules now
  • Some additions to the code, most for 'internal' use.. (EDA-tables)

Beta 1.3

  • Re-organized functions for better "work flow" (I don't want to edit the source-file everytime I want to switch between basic and dcolumn-mode...
  • Deleted selected export of functions (seems to be a problem with some versions of oOO and LibreOffice)
  • Added dump-variable to allow shortkey as well as toolbar-button

Beta 1.2

  • Fixed some bugs
  • Added dcolumn-support
  • Added fixed width tabular* enviroment
  • Enhanced query for numeric cells to allow scientific formats like 5.423(5) and German decimal separator ","

Beta 1.1

  • Problems with UTF-8 encoding on Windows detected..
  • Added automatic selection of the output

Beta Release I

  • Script working stable for Ubuntu (64 bit) and Windows (64 bit), more systems will be tested soon
  • Feedback is very welcome

Pre-Beta

  • First xx versions, added various features, bugs, removed bugs, tested Ubuntu and Windows

LICENCE -- GNU GPLv3

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/.

Source: README.md, updated 2014-04-25