每个组在指定级别上唯一的上下文 [英] Context unique to each group at a specified level

查看:58
本文介绍了每个组在指定级别上唯一的上下文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最新版本的Mathematica通过以下方式为每个单元组提供唯一的$Context选项:

Recent versions of Mathematica provide the option of having a unique $Context for each cell group, via:

  • 评估>笔记本的默认上下文>每个单元格组唯一的

这是一个吸引人的概念,但是我发现它无法使用,因为我的代码跨越了多个单元格组.

This is an appealing concept, but I find it unusable, as my code spans multiple cell groups.

我想要一种为特定级别的单元格组 指定唯一上下文的方法,例如每个Section,但不是为每个Subsection指定单独的上下文>或Subsubsection.

I would like a way to specify a unique context for cell groups of a certain level such as every Section, but not a separate context for every Subsection or Subsubsection.

解决方案将需要在创建新的单元组时对其产生影响.

A solution will need to affect new cell groups as they are created.

推荐答案

您可以通过手动对单元进行分组而不是依靠自动分组机制来实现.在有问题的笔记本中,使用菜单项单元格/分组/手动分组启用手动分组.现在,当您输入节,小节等时,它们将不会自动分组.选择要放在单个组中的单元格,然后使用菜单项 Cell /分组/分组单元格/分组在一起.现在,将它们分组,您可以将 CellContext 设置为 CellGroup ,它们会一起很好地发挥作用.

You can achieve this by grouping cells manually instead of relying upon the automatic grouping mechanism. In the notebook in question, use the menu item Cell / Grouping / Manual Grouping to enable manual grouping. Now, as you enter sections, subsections, etc. they will not be grouped automatically. Select the cells that you wish to be in a single group and use the menu item Cell / Grouping / Group Cells/Group Together. Now that they are grouped, you can set the CellContext to be CellGroup and they will all play well together.

这篇关于每个组在指定级别上唯一的上下文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆