Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm looking into the possibility of using latex for programmatically generating PDFs from templates with placeholders and some textual data. The current solution I have is based on reportlab, and it works, but I have to break cells that don't fit into one page.

If I could just insert the text into a template and have latex do it for me, I would not need to do the cell breaking myself. However, I couldn't find a way to do it without getting into complicated latex programming, and I don't want to go there. Maybe someone knows an existing package that can do it?

Alternatively, maybe someone knows another way to generate PDFs with big complex tables from Python code. I found this library: http://appyframework.org/pod.html, but OpenOffice scares me a bit.

-- added on 21/03 --

I'm basically interested in the general solution, but the first concrete example would be the following:

There's a table of the following structure:

+---+---+
| 1 | 4 |
+---+   |
| 2 |   |
+---+   |
| 3 |   |
+---+---+

Where each cell can has enough content to not fit on one page. Ideally I would like something like this to be produced on paper:

[PAGE1]
+---+---+
| 1 | 4 |
+---+---+

[PAGE2]
+---+---+
| 1 | 4 |
+---+   |
| 2 |   |
+---+---+

[PAGE3]
+---+---+
| 2 | 4 |
+---+   |
| 3 |   |
+---+---+

[PAGE4]
+---+---+
| 3 |   |
+---+---+
share

migration rejected from stackoverflow.com Aug 11 '13 at 9:27

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as unclear what you're asking by Joseph Wright Aug 11 '13 at 9:27

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Welcome to tex.sx. Page breaking within a row in general is tricky as there is no guarantee that there is a horizontal line through all the cells with a feasible break point, when you consider spanning entries and graphics and different font baselines etc. However particular cases are often a lot easier if the content has a well defined structure: could you give an example generated table? (You may have to register in this site to edit the migrated question) –  David Carlisle Mar 20 '13 at 21:08
    
Just to clarify; in your example, 4 represents a long text which you want to be broken in chunks along pages? If so, I have bad news. The contents of a table cell cannot be broken, since they are typeset in a box (or at least not using the standard table nor any longtable-like package I'm aware of). –  JLDiaz Mar 22 '13 at 9:50
    
A starting point might be using flowfram for this, setting up each column as a separate area. –  Andrew Swann May 21 '13 at 11:41
    
As David says, we'll need a more concrete example to have a chance of coming up with a good solution here. –  Joseph Wright Aug 11 '13 at 9:28
comments disabled on deleted / locked posts

2 Answers 2

Have a look at the TeX that docutils has generated.

It will have a \begin{table} to set the table float and \begin{tabular} to start the table content.

Tabular here is just one LaTeX package if you change this to a LaTeX package that support breaking across pages that should work.

Have a look at http://en.wikibooks.org/wiki/LaTeX/Tables to get an excellent overview of what LaTeX table environments exist and their capabilities. As long as you can pursuade docutils to change what headers it puts out around the table you will be home and dry. (as a last resort you can apply an edit to the created output file)

share
add comment

Maybe the \usepackage{longtable} can help you.

See Documentation from CTAN about how to use the package. There is also an example.

EDIT: I believe it won't let you split one cell, so maybe I will not solve your issue.

share
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.