MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Inserting/Removing Forced Page Breaks?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg14481] Re: Inserting/Removing Forced Page Breaks?
  • From: "P.J. Hinton" <paulh>
  • Date: Fri, 23 Oct 1998 20:58:59 -0400
  • Organization: "Wolfram Research, Inc."
  • References: <70k66s$eqp@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On 21 Oct 1998, AES wrote:

> I'd like a fast, simple way to insert or remove forced page breaks in
> Mathematica notebooks (such as used to be available as a menu command
> in v 2.0), without opening the Option Investigator or digging into cell
> options.
> 
> I'm thinking I could do this by redefining one of the cell styles to be
> a "Page Break" style with no content, vanishing height and
> PageBreakBelow->True, so I could just insert or delete a "page break
> cell" in this style anywhere I wanted to force a break..
> 
> Other better ways to do this?
> 
> Thanks -- siegman at ee.stanford.edu

You could create a palette of buttons that turn the option on and off:

(* Here is a button that adds a page break *)

(addpb =ButtonBox[StyleBox["Add page break below",FontFamily ->
"Helvetica"], 
        ButtonFunction :> 
          Module[{expr =NotebookRead[SelectedNotebook[]]},
            If[Head[expr]===Cell, 
              SetOptions[NotebookSelection[SelectedNotebook[]], 
                PageBreakBelow -> True]]] , ButtonEvaluator ->
Automatic, 
        Active -> True]) // DisplayForm

(* Here is a button that removes a page break *)

(removepb =
      ButtonBox[
        StyleBox["Remove page break below",FontFamily -> "Helvetica"], 
        ButtonFunction :> 
          Module[{expr =NotebookRead[SelectedNotebook[]]},
            If[Head[expr]===Cell, 
              SetOptions[NotebookSelection[SelectedNotebook[]], 
                PageBreakBelow -> False]]] , ButtonEvaluator ->
Automatic, 
        Active -> True]) // DisplayForm

(* This arranges the buttons in a column *)

(palgrid = GridBox[{{addpb},{removepb}},RowSpacings -> 0])//DisplayForm

Drag select the resulting column of buttons and then click on the front
end menu command sequence 

	File -> Generate Palette from Selection

To use the buttons, select a cell where you want a page break below and
then click on the button.  To remove, select the cell and click on the
other button.

You could take a more sophisticated approach and combine two buttons
into a toggle by adding code to check the current value of the cell
option and then replacing it with its opposite.

Hope that helps.

--
P.J. Hinton
Mathematica Programming Group           paulh at wolfram.com Wolfram
Research, Inc.                  http://www.wolfram.com/~paulh/
Disclaimer: Opinions expressed herein are those of the author alone.



  • Prev by Date: Re: FourierTransform on UnitStep
  • Next by Date: Re: FourierTransform on UnitStep
  • Previous by thread: RE: Inserting/Removing Forced Page Breaks?
  • Next by thread: Re: Inserting/Removing Forced Page Breaks?