I want a different evaluation context for different sections of my Notebook.Mike Honeychurch suggested to me than changing the CellContext
to CellGroup
would create a different context for each section of a document. According to the documentation, this seems to the right thing to do.
However, I'm unable to use that properly in the Wolfram Cloud Notebook. Here is a screenshot of my current session. Cells were evaluated by "Evaluate All" in the menu:
As you can see despite my use of SetOptions[EvaluationNotebook[], CellContext -> CellGroup]
at different places, the $Context
is always set to Global`
.
What is the proper way of setting The Notebook evaluation option CellContext -> CellGroup
in the Wolfram Cloud Notebook?
Eventually related to Stylesheets & Wolfram Cloud, since, to quote Mickael E2 in a comment below "In the documentation pages, this seems to be done through the stylesheet"
CellContext -> CellGroup
on both the"Input"
and"Output"
styles. ExamineFileNameJoin[{$InstallationDirectory, "SystemFiles", "FrontEnd", "StyleSheets", "Wolfram", "Reference.nb"}]
. $\endgroup$StyleDefinitions
to a cloud notebook. I took them from a desktop notebook, in whichCellContext -> CellGroup
works properly. However, on the cloud, theStyleDefinitions
have no effect. This might be a limitation of the WolframCloud. Maybe someone else will come along who has better knowledge than me. $\endgroup$StyleDefinitions
from my desktop notebook:StyleDefinitions -> Notebook[{Cell[StyleData[StyleDefinitions -> "Default.nb"]], Cell[StyleData["Input"], CellContext -> CellGroup, MenuSortingValue -> 10000], Cell[StyleData["Output"], CellContext -> CellGroup, MenuSortingValue -> 10000]}, WindowSize -> {808, 905}, WindowMargins -> {{20, Automatic}, {Automatic, 44}}, FrontEndVersion -> "12.0 for Mac OS X x86 (64-bit) (April 8, 2019)", StyleDefinitions -> "PrivateStylesheetFormatting.nb"]
-- but it didn't work on the cloud, as I said. $\endgroup$CopyFile[FileNameJoin[{$InstallationDirectory, "SystemFiles", "FrontEnd", "StyleSheets", "Wolfram", "Reference.nb"}], CloudObject["Reference.nb"]]
. Then you can download it using the in-browser cloud file explorer, or by executing e.g.CopyFile[CloudObject["Reference.nb"], "Reference.nb"]
in desktop Mathematica. $\endgroup$