Wolfram mathematica 自动生成具有折叠部分的笔记本
下面的代码块Wolfram mathematica 自动生成具有折叠部分的笔记本,wolfram-mathematica,creation,Wolfram Mathematica,Creation,下面的代码块 CreateDocument[{ TextCell["Title", "Title"], TextCell["Subtitle", "Subtitle"], TextCell["Section 1", "Section"], TextCell["Section 1.1", "Subsection"], TextCell["Section 1.2", "Subsection"], TextCell["Section 1.3", "Subsection"],
CreateDocument[{
TextCell["Title", "Title"],
TextCell["Subtitle", "Subtitle"],
TextCell["Section 1", "Section"],
TextCell["Section 1.1", "Subsection"],
TextCell["Section 1.2", "Subsection"],
TextCell["Section 1.3", "Subsection"],
TextCell["Section 2", "Section"],
TextCell["Section 2.1", "Subsection"],
TextCell["Section 2.2", "Subsection"],
TextCell["Section 2.3", "Subsection"],
TextCell["Section 3", "Section"],
TextCell["Section 2.1", "Subsection"],
TextCell["Section 2.2", "Subsection"],
TextCell["Section 2.3", "Subsection"]}
]
将创建一个骨架笔记本
是否可以创建该笔记本,以便折叠各个部分?这样,笔记本将显示为(例如)覆盖第1部分的单元格闭合器已被单击。第2节和第3节同上。使用CellGroup打开或关闭特定单元格-请参阅 或者,您可以将整个TextCells集合包装在一个高级CellGroup中,并使用CellGroup的可选第二个参数。例如,这将仅打开前三个单元格组:
CreateDocument[{
CellGroup[{
TextCell["Title", "Title"],
TextCell["Subtitle", "Subtitle"],
TextCell["Section 1", "Section"],
TextCell["Section 1.1", "Subsection"],
TextCell["Section 1.2", "Subsection"],
TextCell["Section 1.3", "Subsection"],
TextCell["Section 2", "Section"],
TextCell["Section 2.1", "Subsection"],
TextCell["Section 2.2", "Subsection"],
TextCell["Section 2.3", "Subsection"],
TextCell["Section 3", "Section"],
TextCell["Section 2.1", "Subsection"],
TextCell["Section 2.2", "Subsection"],
TextCell["Section 2.3", "Subsection"]
}, {1, 2, 3}]
}]
谢谢@Bill White!第一个例子就是我想要的。谢谢你接受我的回答。顺便说一句,使用Closed作为CellGroup的第二个参数似乎没有记录在案,除非我忽略了什么。在以编程方式生成笔记本时,我一直使用CellGroupData[{…},Closed],Closed在这里似乎也可以正常工作。
CreateDocument[{
CellGroup[{
TextCell["Title", "Title"],
TextCell["Subtitle", "Subtitle"],
TextCell["Section 1", "Section"],
TextCell["Section 1.1", "Subsection"],
TextCell["Section 1.2", "Subsection"],
TextCell["Section 1.3", "Subsection"],
TextCell["Section 2", "Section"],
TextCell["Section 2.1", "Subsection"],
TextCell["Section 2.2", "Subsection"],
TextCell["Section 2.3", "Subsection"],
TextCell["Section 3", "Section"],
TextCell["Section 2.1", "Subsection"],
TextCell["Section 2.2", "Subsection"],
TextCell["Section 2.3", "Subsection"]
}, {1, 2, 3}]
}]