4
$\begingroup$

Assume the following notebook of Rubi rules

nb = Import["https://github.com/RuleBasedIntegration/Rubi/raw/master/IntegrationRuleNotebooks/1%20Algebraic%20functions/1.1%20Binomial%20products/1.1.1%20Linear/1.1.1.1%20(a%2Bb%20x)%5Em.nb", "NotebookObject"];

If you open all cell-groups, you find that at the deepest level, there are "Code" cells. What is a pragmatic way to open this notebook in read-only mode and navigate to the n-th (say 18th) code cell automatically, so that the user directly sees the Int definition?

Functions that are helpful are NotebookFind, SelectionMove, Cells, and friends, but I feel my hacks are not entirely beautiful and this may be a question of general interest. So I would be delighted if you give me your best shot.

$\endgroup$

1 Answer 1

5
$\begingroup$

Does it fit your needs:

target = Cells[nb, CellStyle -> "Code"][[5]](*5th cell*)
SelectionMove[target, All, CellGroup]
FrontEndExecute[FrontEndToken[nb, "SelectionOpenAllGroups"]]
SelectionMove[target, All, CellContents]

?

enter image description here

$\endgroup$
0

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.