1
$\begingroup$

I have some physics exercises done and I´d like to make an ebook in CDF with the explanations with simulations as well.

For these I look for some tips, and wolfram videos has a lot of it with Prof Eric Schulz.

http://www.wolfram.com/broadcast/video.php?c=109&v=185

The code suggested by professor Schulz is this

CreateLinks[nb_] := Module[{tagList = {}},
  SelectionMove[nb, Before, Notebook];
  SelectionMove[nb, Next, Cell];
  While[
   (* Keep moving cell by cell until the end of the notebook *) 
   MathLink`CallFrontEnd[
     FrontEnd`CellInformation[
      FrontEnd`NotebookSelection[nb]]] =!= $Failed,
   (* Extract the CellTags and store in tagList *)
   {If[(CellTags /. 
        Options[NotebookSelection[nb], "CellTags"]) =!= {}, 
     tagList = 
      Append[tagList, (CellTags /. 
         Options[NotebookSelection[nb], "CellTags"])]],
    SelectionMove[nb, Next, Cell]}];
  (* Build argument for ActionMenu *)
  MapThread[#1 :> {NotebookLocate[#1], 
      FrontEndExecute[{FrontEndToken[
         "SelectionOpenAllGroups"]}]} &, {tagList}]]
BuildDockedCell[chapter_, section_] := Module[{nb},
  nb = OpenSection[chapter, section];
  SetOptions[nb,DockedCells -> Cell[BoxData@ToBoxes@Grid[{{
          ActionMenu[
           Row[{"Section ", chapter, ".", section}],
           CreateContentLinks[nb],
           ImageMargins -> 0, FrameMargins -> 0, 
           BaseStyle -> {"MSG", 12}]}},
        Spacings -> {0.5, 0.5}, Alignment -> {Left, Top}],
     "DockedCell", Background -> GrayLevel[0.95]]]]
DeleteDockedCell[chapter_, section_] :=
 Module[{nb}, nb = OpenSection[chapter, section]; 
  SetOptions[nb, DockedCells -> Inherited]]

But after name the Cell (with tags) I tried these

BuildDockedCell[1, 1]

And Mathematica answear me that

SetOptions::sstm: "Argument OpenSection[1,1] is not a symbol or a stream."

Anyone can help me how to create this menu.

I also put a picture of how Eric Schulz book looks like.

enter image description here

$\endgroup$
2
  • $\begingroup$ Do you have function definitions for OpenSection and CreateContentLinks? $\endgroup$ Feb 17, 2016 at 22:13
  • $\begingroup$ No, the code explained is just that $\endgroup$
    – dcvilela
    Feb 17, 2016 at 23:44

0

Your Answer

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

Browse other questions tagged or ask your own question.