# Is there a way to hide and show manually inserted page breaks?

If I create a Notebook that includes multiple pages I know that I can show/hide page breaks by using menu item File ► Printing Settings ► Show Page Breaks. I can manually create my own (non-default) page break by going to menu Insert ► Page Break. But these manual page breaks are not being toggled on and off by the same show/hide page break button. I would like this control.

Is there a way to control ALL page breaks, including the ones I manually create? I am including a gif to illustrate that my manually created page break does not disappear.

The name of the menu item Insert ► Page Break is a bit misleading. According to the Documentation page for ShowPageBreaks, manual page breaking is controlled via the PageBreakAbove and PageBreakBelow options of Cell. This conclusions is further supported from the fact that when you use Insert ► Page Break menu item you actually insert the following Cell at the insertion point:

Cell["", "PageBreak",
PageBreakBelow->True]


But why this Cell is displayed even when you set ShowPageBreaks -> False? It is because in the "Core.nb" basic stylesheet the following definition is given for the "PageBreak" style:

Cell[StyleData["PageBreak"],
Editable->False,
CellFrame->1,
CellMargins->{{0, 0}, {1, 1}},
CellElementSpacings->{"CellMinHeight"->1,
"ClosedCellHeight"->1},
CellOpen->False,
PageBreakBelow->True,
CellFrameMargins->0,
CellSize->{Inherited, 2},
Background->GrayLevel[0.5]]


Note that under this you can find more specific definition which is used only in the "Printout" style environment and which makes Cells with this style completely invisible when you switch to the "Print Preview..." mode (which by default uses the "Printout" style environment):

Cell[StyleData["PageBreak", "Printout"],
CellFrame->0,
ShowCellBracket->False,
Background->None]


So the conclusion is that what is displayed is NOT a page break but the inserted Cell which contains information about it and this display differs substantially from what you see as page breaks when you set ShowPageBreaks -> True or use the File ► Printing Settings ► Show Page Breaks menu item. So what can be made? First of all, you can set private style definition for the "PageBreak" style which will affect your Notebook only. If you did not added any private styles into your Notebook, you can evaluate the following code which will make all Cells with this style completely transparent (if you did, existing private style definitions will be overwritten):

SetOptions[EvaluationNotebook[],
StyleDefinitions ->
Notebook[{Cell[StyleData[StyleDefinitions -> "Default.nb"]],
Cell[StyleData["PageBreak"], FrontEndCellFrameStyle -> Opacity[0]]},
StyleDefinitions -> "PrivateStylesheetFormatting.nb"]]


SetOptions[EvaluationNotebook[], StyleDefinitions -> "Default.nb"]

With this solution the File ► Printing Settings ► Show Page Breaks menu item and the ShowPageBreaks option will still show/hide the page breaks defined in the Cells added via Insert ► Page Break menu item but these Cell`s themselves will be invisible.