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

Assuming the following is a notebook with a linebreak:

enter image description here

How might I export a landscape pdf (preferred although other formats could work) such that each cell content each group of cells above and below the page break are stretched to take up half of the landscape page.

enter image description here

The colors are simply there to act as placeholders. I certainly could copy and paste such data into a word document, but ideally something like this could be automated.

share|improve this question
    
I struggle to understand the main part of your question. Do you want to stretch a single blue and a single gray cell to each take up half the page? p.s. please see (1135) –  Mr.Wizard Sep 16 '13 at 17:52
    
@Mr.Wizard That is correct. I probably should have put some cell content in the different colored boxes to make the question more clear. I am looking to stretch the cell content so each box takes up half of the page. Thank you for the link that is exactly what I was looking for. –  Liam William Sep 16 '13 at 17:55
    
@Mr.Wizard To further clarify(in addition I added this information to the question) the colored region are not intended to signify a signal cell, but instead multiple different cells but multiple cells separated by a page break. –  Liam William Sep 16 '13 at 18:04
    
I was working on a solution for single blue/gray cells. Do you still want that or should I just scrap it? –  Mr.Wizard Sep 16 '13 at 18:05
    
@Mr.Wizard If you have a working set of code that is relevant, a posting would be appreciated. I don't mind adapting the question or workflow to possibly reach a solution. –  Liam William Sep 16 '13 at 18:11
show 8 more comments

2 Answers

You have to remove(set to 0) the margins for Printout in the current Stlysheet. I have the Stylesheet installed on my computer and will hopeful post a more portable(not requiring you to install a new stylsheet solution). The following is a png showing the final output.

SetOptions[
 EvaluationNotebook[],
 StyleDefinitions -> Notebook[{
    Cell[StyleData[StyleDefinitions -> "Default.nb"]],
    Cell[StyleData[All, "Printout"], ShowCellLabel -> False],
    Cell[StyleData["Text", "Printout", StyleDefinitions -> None], 
     CellMargins -> {{0, 0}, {0, 0}}, Background -> GrayLevel[1]]
    Cell[StyleData["Input", "Printout", StyleDefinitions -> None], 
     CellMargins -> {{0, 0}, {0, 0}},
     LinebreakAdjustments -> {0.85, 2, 10, 1, 1}],
    Cell[StyleData["Code", "Printout", StyleDefinitions -> None], 
     CellMargins -> {{0, 0}, {0, 0}}, Background -> GrayLevel[1]],
    Cell[StyleData["Input", "Printout", StyleDefinitions -> None], 
     CellMargins -> {{0, 0}, {0, 0}}, 
     LinebreakAdjustments -> {0.85, 2, 10, 1, 1}],
    Cell[StyleData["Output", "Printout", StyleDefinitions -> None], 
     CellMargins -> {{0, 0}, {0, 0}}]

    }, StyleDefinitions -> "PrivateStylesheetFormatting.nb"]
 ]
SetOptions[EvaluationNotebook[], 
 PrintingOptions -> {"FirstPageHeader" -> True}]
SetOptions[
 EvaluationNotebook[],
 PrintingOptions -> {
   "PrintingMargins" -> {{5, 10}, {10, 10}},
   "PaperOrientation" -> "Landscape"
   },
 PrintingStartingPageNumber -> 1,
 PageHeaders -> {
   {Cell[TextData[{CounterBox["Page"]}], "PageNumber"], None, 
    None}, {Cell[TextData[{CounterBox["Page"]}], "PageNumber"], None, 
    None}
   },
 PageFooters -> {
   {None, None, None}, {None, None, None}
   }
 ]
sideBySide[x_, y_, size_] := Replace[
  ToBoxes@Grid[{{
      Pane[
       Grid[{{1}}, Spacings -> 0, Alignment -> {Left, Top}], 
       ImageSize -> size
       ], Pane[
       Grid[{{2}}, Spacings -> 0, Alignment -> {Left, Top}], 
       ImageSize -> size]
      }}, Spacings -> 0, Alignment -> {Left, Top}
     ], {{{"1"}} -> Map[({#}) &, x], {{"2"}} -> 
    Map[({#}) &, y]}, Infinity];
PrintingStyleEnvironment /. 
 Options[EvaluationNotebook[], PrintingStyleEnvironment];

And the printing the function like so.

RawBoxes@sideBySide[
  {Cell["text 3", "Text"], Cell["text 3", "Text"]},
  {Cell["text 3", "Text"], Cell["text 3", "Text"]},540
  ]
share|improve this answer
add comment

This is an entirely different technique, but I felt that is worth posting. Really this question is asking how to print a booklet of Mathematica cells.

Although you can split a page into 2 groups of landscapes cells, IMO the above solution isn't very practical. The above solution doesn't take into account that you might have multiple pages of cells.

The best solution I have found requires that you first run the following code.

changeOptions[nb_] := SetOptions[nb,
   StyleDefinitions -> Notebook[{
      Cell[StyleData[StyleDefinitions -> "Default.nb"]],
      Cell[StyleData[All, "Printout"], 
       CellMargins -> {{0, 0}, {0, 0}}, ShowCellLabel -> False],
      Cell[StyleData["Input", "Printout", StyleDefinitions -> None], 
       CellMargins -> {{0, 0}, {0, 0}},
       LinebreakAdjustments -> {0.85, 2, 10, 1, 1}],
      Cell[
       StyleData["Input", "PrintoutGray", StyleDefinitions -> None], 
       CellMargins -> {{0, 0}, {0, 0}},
       LinebreakAdjustments -> {0.85, 2, 10, 1, 1}],
      Cell[StyleData["Code", "Printout", StyleDefinitions -> None], 
       CellMargins -> {{0, 0}, {0, 0}}, Background -> GrayLevel[1]],
      Cell[StyleData["Text", "Printout", StyleDefinitions -> None], 
       CellMargins -> {{0, 0}, {0, 0}}, Background -> GrayLevel[1]],
      Cell[StyleData["Code", "Printout", StyleDefinitions -> None], 
       CellMargins -> {{0, 0}, {0, 0}}, Background -> GrayLevel[1]],
      Cell[StyleData["Input", "Printout", StyleDefinitions -> None], 
       CellMargins -> {{0, 0}, {0, 0}}, 
       LinebreakAdjustments -> {0.85, 2, 10, 1, 1}],
      Cell[StyleData["Output", "Printout", StyleDefinitions -> None], 
       CellMargins -> {{0, 0}, {0, 0}}]
      }, StyleDefinitions -> "PrivateStylesheetFormatting.nb"],
   PrintingOptions -> {
     "FirstPageHeader" -> True,
     "PrintingMargins" -> {{60, 5}, {10, 10}}
     },
   PrintingStartingPageNumber -> 1,
   PageHeaders -> {
     {Cell[TextData[{CounterBox["Page"]}], "PageNumber"], None, None},
     {None, None, Cell[TextData[{CounterBox["Page"]}], "PageNumber"]}
     },
   PageFooters -> {
     {None, None, None}, {None, None, None}
     }
   ];

Next export the Notebook as a pdf and open it in Adobe Reader or Foxit Reader. You should then be able to print the cells as a booklet under options. This question discusses possible ways to automate printing out such a booklet.

Alternatively you can use PDF Booklet Creator(fineprint costs $) to create an actual pdf.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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