3
$\begingroup$
  1. Is there a way to split the screen so that the code is visible on top, and the output generated from its execution appears at the bottom?
  2. Is there any way to clear the screen from previous runs, so that the result of execution is presented in a clean screen, something like the cls command in BASIC?
$\endgroup$
  • 1
    $\begingroup$ I don't think the functionality exists in the standard notebook interface, although it could probably be created in a custom notebook with the help of dynamic interactivity. I could imagine this might be useful for some things, but notebooks are not organized like that by default. $\endgroup$ – Jens Apr 7 '15 at 2:41
  • 1
    $\begingroup$ In the book "An Introduction to Programming with Mathematica" by Wellin, Gaylord & Kamin all of chapter 10 is on programming the "front end" of Mathematica. Using functions like NotebookCreate and NotebookWrite you might be able to do some or much of what you want. $\endgroup$ – Bill Apr 7 '15 at 3:15
5
$\begingroup$

Here's a quick&dirty&buggy solution for your two wishes, although I strongly suggest you to do you works the way as the notebook interface designed to.

Cls := (SelectionMove[InputNotebook[], All, Notebook];
  FrontEndExecute[FrontEndToken["Clear"]]);
$Post = (If[Head@$outputNB == Symbol, $outputNB = CreateNotebook[]];
      If[# === Null, 1;, Paste[$outputNB, #]]) &;

Cls is the screen-cleaning command, it deletes all the cells in current notebook. Then the $Post variable is modified to redirect all the outputs.

$\endgroup$
  • $\begingroup$ Nice solution. I would use cls[] for the clear command as that is safer and more conventional. $\endgroup$ – Mr.Wizard May 6 '15 at 6:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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