MathGroup Archive 1999

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

Search the Archive

RE: Programmed PageBreaks

  • To: mathgroup at smc.vnet.net
  • Subject: [mg16574] RE: [mg16431] Programmed PageBreaks
  • From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
  • Date: Wed, 17 Mar 1999 23:54:54 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

Adelbert Hanszen  wrote:
-------------------------

How can I add page breaks to this. Print["\012"]; does not work.
Until now, I have manually added pagebreaks above those cells,
from which I know, that they should go on a new page. I am looking
for a better way to achieve this.

--------------------------

Rolf Mertig posted a nice palette to do what you want some time ago.  Since
then I enhanced the "Insert PageBreak" button, and added two unrelated
buttons.  The palette below has five buttons.


1-  CleanSlate[]
This button evaluates CleanSlate[] without feedback except "Running name.nb"
is displayed in the window frame of the palette while CleanSlate is
evaluating.  I made this button because I got tired of deleting cells from
CleanSlate[]; in my notebooks.  Note, CleanSlate isn't a built-in feature.
But it's a nice tool and you can find it in the distribution CD for version
3.0. 

2- Delete All Graphics
This button will delete all Graphic cells and any corresponding output
cells.

3- Insert PageBreak
This button inserts a cell that does little more than force a page break.
The cell has a red cell bracket as a visual indication.  If the selection
pointer is between cells the "Page Break Cell" is inserted at the selection
pointer.  I modified the button from Rolf Mertig so that if the selection
pointer is in the middle of a cell when the button is used you get a "Page
Break Cell" after the cell where the selection pointer was.

4-  Next PageBreak
Selects the first "Page Break Cell" after the selection pointer.  Once the
cell is selected the cell bracket turns cyan.

5- Previous PageBreak
Selects the nearest "Page Break Cell" that comes before the selection
pointer.    Once the cell is selected the Cell Bracket turns cyan.

-------------------------

Copy the code below into the Front End.
Select Yes to interpret the text.
Select the Window containing the palette, and save the notebook.

I saved the notebook in the folder:
  WolframResearch/Mathematica/30/SystemFiles/FrontEnd/Palettes
That way I can access the palette from the menu selection:
    --> File
      --> Palettes

------------------
Regards,
Ted Ersek


(******* Code Begins Here *********)
Notebook[{
Cell[BoxData[
    TagBox[GridBox[{
          {
            ButtonBox[\(CleanSlate[]\ \ \ \ \ \ \ \ \ \ \ \ \ \ \),
              ButtonFunction:>Block[ {Print}, 
                  CompoundExpression[ 
                    CleanSlate[ ], Null]],
              ButtonEvaluator->Automatic,
              Active->True]},
          {
            ButtonBox[\(Delete\ All\ Graphics\),
              ButtonFunction:>Module[ {
                  Set[ nb1, 
                    InputNotebook[ ]], nb2, posn}, 
                  CompoundExpression[ 
                    NotebookFind[ nb1, "Graphics", All, CellStyle], 
                    NotebookDelete[ nb1], 
                    Set[ nb2, 
                      NotebookGet[ nb1]], 
                    Set[ posn, 
                      Position[ nb2, 
                        Cell[ 
                          BoxData[ 
                            TagBox[ 
                              RowBox[ {"\[SkeletonIndicator]", 
                                Alternatives[ 
                                "Graphics", "Graphics3D", "ContourGraphics",

                                  "DensityGraphics", "SurfaceGraphics", 
                                  "GraphicsArray","Sound"],
"\[SkeletonIndicator]"}], 
                              False, Editable -> False]], "Output", 
                          BlankNullSequence[ ]], Infinity]], 
                    If[ 
                      UnsameQ[ posn, {}], 
                      NotebookPut[ 
                        Delete[ nb2, posn], nb1]], Null]],
              ButtonEvaluator->Automatic,
              Active->True]},
          {
            ButtonBox[\(Insert\ a\ PageBreak\ \ \ \ \),
              ButtonFunction:>Module[ {
                  Set[ nb, 
                    InputNotebook[ ]]}, 
                  CompoundExpression[ 
                    SelectionMove[ nb, All, Cell], 
                    If[ 
                      SameQ[ 
                        NotebookRead[ 
                          NotebookSelection[ nb]], {}], 
                      SelectionMove[ nb, Previous, Cell]], 
                    SelectionMove[ nb, After, Cell], 
                    NotebookWrite[ 
                      InputNotebook[ ], 
                      Cell[ 
                        TextData[ " "], "Text", CellMargins -> {{0, 
                        0}, {-10, -4}}, CellBracketOptions -> {"Thickness"
-> 
                        2, "Color" -> RGBColor[ 1, 0, 0]}, 
                        CellElementSpacings -> {"CellMinHeight" -> 1}, 
                        PageBreakBelow -> True, GeneratedCell -> True, 
                        Magnification -> .5, Editable -> False, CellTags -> 
                        "PageBreakCell"]]]],
              ButtonEvaluator->Automatic]},
          {
            ButtonBox[\(Next\ PageBreak\ \ \ \ \ \ \ \ \ \ \ \),
              ButtonFunction:>CompoundExpression[ 
                  NotebookFind[ 
                    InputNotebook[ ], "PageBreakCell", Next, CellTags]],
              ButtonEvaluator->Automatic]},
          {
            ButtonBox[\(Previous\ PageBreak\ \ \),
              ButtonFunction:>CompoundExpression[ 
                  NotebookFind[ 
                    InputNotebook[ ], "PageBreakCell", Previous, CellTags]],
              ButtonEvaluator->Automatic]}
          },
        RowSpacings->0.3],
      DisplayForm]], NotebookDefault,
  CellMargins->{{Inherited, Inherited}, {7, Inherited}},
  CellEditDuplicate->True,
  CellGroupingRules->"OutputGrouping",
  CellHorizontalScrolling->True,
  PageBreakAbove->True,
  PageBreakWithin->False,
  GroupPageBreakWithin->False,
  GeneratedCell->True,
  CellAutoOverwrite->True,
  CellLabelMargins->{{11, Inherited}, {Inherited, Inherited}},
  DefaultFormatType->DefaultOutputFormatType,
  LineSpacing->{1.25, 0},
  AutoItalicWords->{},
  FormatType->InputForm,
  ScriptMinSize->9,
  CounterIncrements->"Output",
  StyleMenuListing->None,
  FontFamily->"Courier"]
},
FrontEndVersion->"Microsoft Windows 3.0",
ScreenRectangle->{{0, 800}, {0, 544}},
Editable->False,
WindowToolbars->{},
PageWidth->467.5,
WindowSize->{Fit, Fit},
WindowMargins->{{Automatic,5}, {Automatic, 5}},
WindowFrame->"Palette",
WindowElements->{},
WindowFrameElements->"CloseBox",
WindowClickSelect->False,
ScrollingOptions->{"PagewiseScrolling"->True},
ShowCellBracket->False,
CellMargins->{{0, 0}, {Inherited, 0}},
Active->True,
CellOpen->True,
ShowCellLabel->False,
ShowCellTags->False,
ImageMargins->{{0, Inherited}, {Inherited, 0}}
]


  • Prev by Date: Methonds in nonlinear Fits.
  • Next by Date: Re: combinations of pure functions
  • Previous by thread: RE: Programmed PageBreaks
  • Next by thread: RE: Programmed PageBreaks