# How to avoid page break appearing between the table title and the table in Mathematica?

I'm wring a thesis which has quite amount of tables. When the thesis gets printed, Mathematica often breaks pages between the table title and table. I would like to keep the title and table in the same page. How can I do so by editing the Stylesheet?

Details regarding this problem: First I chosen the initial style sheet to be Artical -> Preprint. Then I selected "TableTitle" for the cell style of the title, and self-defined "TableText" for the cell style of the table. The self-defined "TableText" basically inherits the definition of the existing cell style "Text" as follows:

Cell[StyleData["TableText", StyleDefinitions -> StyleData["Text"]], TextAlignment->Center,
FontSize->12]


The problem is even if I group the cells of titles and tables, Mathematica still often breaks the page between the cell "TableTitle" and the cell "TableText" when the Screen Environment is in Printout and I choose Printing Settings -> Show Page Breaks. I wouldn't like to add the page break lines manually. I'm wondering how to tell Mathematica not to add the page break lines between the cells "TableTitle" and the cells "TableText". Is it possible to do so by adding something to the StyleData of "TableTitle" in the environment of "Printout":

Cell[StyleData["TableTitle", "Printout"],
PageWidth->PaperWidth,
Hyphenation->False,
FontSize->12]


I tried to add PageBreakBelow -> False but it did not work.

-
Really need more detail about how the titles and the tables appear in your notebook. There are many ways to solve this problem but they depend on the details. One solution would be to combine the titles and tables into one cell. Mathematica tries hard not to make a page break inside a cell. – m_goldberg Jul 6 '14 at 4:35
Thank you very much for your reply. It does not work by combining the titles and tables. I've added more details about my problem. – user16345 Jul 6 '14 at 7:33
Could you please add a screen grab or two, perhaps of the relevant cells in the stylesheet and what your notebook (with broken tables) look like? – seismatica Jul 6 '14 at 11:46

I have solved this problem. Glynn and Gray (2000) state the settings for PageBreakAbove, PageBreakBelow, PageBreakWithin, and GroupPageBreakWithin are available only in the Option Inspector. Therefore, these settings cannot be applied to Edit Stylesheet. The table titles, tables, and table notes are kept in the same pages using the following procedure:

Select all TableTitle cells by clicking on the bracket of any TableTitle cell while holding keyboard key Alt. Then press Shift + Ctrl + O to open the Option Inspector dialog. Type in PageBreakBelow in Lookup to find four options of PageBreakAbove, PageBreakBelow, PageBreakWithin, and GroupPageBreakWithin. Then choose False for both PageBreakBelow and PageBreakWithin before close the dialop.

Next, in the same way choose False for PageBreakAbove, PageBreakBelow, and PageBreakWith for self-defined TableText cells and select False for PageBreakAbove and PageBreakWith for TableNote cells.

Finally, you will find Mathematica avoids breaking pages among table titles, tables, and table notes.

Reference:

Glynn, J. and Gray, T.W., 2000. The beginner's guide to Mathematica. 4th ed. Cambridge: Cambridge University Press.

-