Is there a way to get rid of the unused space on the left of the package editor?

enter image description here

What is it's purpose if I configured Mathematica to not show In and Out names? (Using Mathematica 10.1).


1 Answer 1

  • Quick fix for a specific file:

    Ok, let's open new package File -> New -> Package.

    It was second on my list of Notebooks[]. So:

    package = Notebooks[][[2]]

    This is a notebook as any other, it just has different stylesheet ("Package.nb") and we can modify it as any other:

    SetOptions[ package, {
      StyleDefinitions ->  Notebook[{
         Cell[StyleData[StyleDefinitions -> "Package.nb"]], 
         Cell[StyleData["Code"], CellMargins -> {{0, 0}, {0, 0}}]
      ShowCellLabel -> False,
      ShowGroupOpener -> False}

    (notice that we are styling "Code" cell as this is the default one)

    enter image description here

  • General approach to modifying built in stylesheets

    This was set just for that .m file. If you want to set it globally edit the Package.nb stylesheet.

    It is not so easy, you need privileges to work in $InstallationDirectory, system packages are not Editable and you risk breaking base files.

    Here is a way to go to avoid those problems: copy stylesheet to the $UserBaseDirectory, enable editing and do whatever you need:

    CopyFile @@ ( FileNameJoin[
      {#, "SystemFiles", "FrontEnd", "StyleSheets", "Package.nb"}
    ] & /@ {
     $InstallationDirectory, $UserBaseDirectory
    SetOptions[NotebookOpen @ %, {Editable -> True, Saveable -> True}]

Learned from Verbeia

  • $\begingroup$ Very well, worked, thanks! Any problems on doing that? Any info that could be hidden besides the In e Out messages? $\endgroup$ Commented Apr 27, 2015 at 20:54
  • $\begingroup$ @Giovanni In and Out are still available, you just can't see which cells they are referring to. $\endgroup$
    – Kuba
    Commented Apr 27, 2015 at 20:58
  • $\begingroup$ @Giovanni you could also lose the information whether the cell was evaluated in debug mode and possibly CellTags/cell labels could become invisible. All of these do not seem really standard for package development though. $\endgroup$ Commented Apr 27, 2015 at 21:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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