# LaTeX File Format

The LaTeX file format is a text file format with markup in the LaTeX 2ε derivative of the TeX family of languages.

Gnumeric generates LaTeX files to allow the export of tables of numeric values for use in the LaTeX document processing system. LaTeX is a derived format of the TeX system. The files generated by Gnumeric are designed to be used by a LaTeX processor, such as latex or pdflatex, to generate files in viewable formats such as Device Independent (DVI), Postscript (PS) or Portable Document Format (PDF).

The generated files can either be processed directly or can be included in other LaTeX files.

 Name: LaTeX Extensions: .tex Compatible Programs: latex, pdflatex Import / Export: Export only
Limitations

Gnumeric generates a LaTeX longtable structure which contains only the contents of the cells in the worksheet displayed in the view at the time the file was created.

Font coloring is supported. Thin cell borders are translated into single lines and thick cell borders are translated into double lines. Cell background colors are ignored.

Plugin

Supported by the 'HTML & TeX' plugin.

Format Details

The generated file includes extensive documentation in TeX comment fields, to explain how to use and alter the file. Lines in the file which are comments begin and end with double percent symbols (%%). Lines which are designed as user options begin with a single percent symbol (%) which can be deleted to make the LaTeX command on that line take effect.

Further Processing

The LaTeX files generated by Gnumeric can either be processed directly by a LaTeX processor or can be included as tables in other files. The files can be included by reference as explained below or can be pasted into other files at the appropriate location. The file can also be altered to change certain parameters. These alterations are explained as comments within the file itself and are presented below.

The file created by Gnumeric can be run directly through a LaTeX processor without any modifications. For example, if the file were saved as Book1.tex, the following command

pdflatex Book1.tex

generates a PDF file named Book1.pdf. The file can be generated in landscape format and the headers, footers and column widths of the file can be altered in the manner explained below.

The file can also be included within another LaTeX file to provide a single table. This requires, first, ensuring that all the packages which will be needed are included, and second, defining a LaTeX variable which is used as a dummy tag to exclude the preamble used to process the file on its own. The LaTeX file generated by Gnumeric requires using the following lines in the preamble

\usepackage{ucs}
\usepackage{utf8}{inputenc}
\usepackage{color}
\usepackage{array}
\usepackage{longtable}
\usepackage{calc}
\usepackage{multirow}
\usepackage{hhline}
\usepackage{ifthen}

to include each of these packages. Optionally, to include the table in landscape mode, the preamble also needs the line
\usepackage{lscape}

to include the lscape package. Second, the following line
\def\inputGnumericTable{}

must be included to make the LaTeX processor ignore the preamble section of the file generated by Gnumeric. The generated file can be included either by adding, at the appropriate location in the other file, the line
\input{mygnumericfile.tex}

with the text mygnumericfile replaced with the appropriate file name or by pasting the entire file generated by Gnumeric into the other file.

An option is provided in the file allows the table to be presented in landscape mode which allows wider tables to be included. For files which are to be processed independently, the option can be changed in the document class definition

\documentclass[12pt%
%,landscape%
]{report}

by removing the percent symbol (%) in front of ,landscape. For files to be included as tables in other LaTeX files, the preamble must include the lscape package, as was explained above, and the two commands
\def\gnumericTableEnd{\end{landscape}}
\begin{landscape}

must have the leading percent sign removed.

An option is provided to change the widths of the columns of the file generated by Gnumeric. By default, the file attempts to maintain the proportions between the columns in the Gnumeric worksheet, yet scale the resulting table for the width of the paper defined in LaTeX. To change the column widths, look for the section in the LaTeX file with lines that look like

\def\gnumericColA{107pt*\gnumericScale}
\def\gnumericColB{89pt*\gnumericScale}
\def\gnumericColC{98pt*\gnumericScale}
\def\gnumericColD{89pt*\gnumericScale}
\def\gnumericColE{89pt*\gnumericScale}

and that may have as many entries as there were columns in the worksheet. The TeX 'lengths' defined for each column can be changed. For example, change the second column (Column B) to a width of 0.75 inches, we would simply have to modify this code to:
\def\gnumericColA{107pt*\gnumericScale}
\def\gnumericColB{0.75in}
\def\gnumericColC{98pt*\gnumericScale}
\def\gnumericColD{89pt*\gnumericScale}
\def\gnumericColE{89pt*\gnumericScale}

and the resulting file would have a second column 0.75 inches wide.

An option to change the headers and footers of the table is provided as well. The file itself contains comments on how to alter these but the choices will require seeing the documentation of the longtable LaTeX package. See that documentation and the contents of the file generated by Gnumeric for details.