在Mathematica中着色“水平线”

时间:2011-09-08 18:09:10

标签: wolfram-mathematica frontend

有没有在Mathematica中将这些线自动变为黑色?

enter image description here

enter image description here

3 个答案:

答案 0 :(得分:7)

这些行的默认样式在位于ContextMenus.tr的子目录SystemFiles/FrontEnd/TextResources中的文件$InstallationDirectory中定义。如果您在该文件中搜索“CellInsertionPoint”,那么您应该找到类似

的内容
"CellInsertionPoint" -> {
  ....
  Menu["Insert Ho&rizontal Line",
    {
     MenuItem["Thi&n Line", FrontEndExecute[{
       FrontEnd`NotebookWrite[FrontEnd`InputNotebook[], 
        Cell[" ", "Text", 
         ....
         CellFrameColor->RGBColor[0,0,1]], 
       After]
      }]],
     MenuItem["&Medium Line", FrontEndExecute[{
         .....    
         CellFrameColor->RGBColor[0,0,1]], 
       After]
      }]],
     MenuItem["&Thick Line", FrontEndExecute[{   
         .....
         CellFrameColor->RGBColor[0,0,1]], 
       After]
      }]],
  ....
}

要永久更改水平线的默认颜色,您可以将这三个MenuItem的CellFrameColor设置为您想要的任何颜色(或者如果您想要更多选择,可以创建额外的MenuItem)。请注意,您需要重新启动Mathematica才能使更改生效。

如果您不想更改原始文件,还可以将文件副本保存到$BaseDirectory$UserBaseDirectory中的相应子目录中并进行编辑。

答案 1 :(得分:4)

Heike有答案,但在不太可能的情况下你不想弄乱那些.tr文件你也可以执行

NotebookPut[
  NotebookGet[
    SelectedNotebook[]] /. {
      Cell[" ", "Text", x___, CellFrameColor -> RGBColor[___], y___] :> 
      Cell[" ", "Text", x, CellFrameColor -> RGBColor[0, 0, 0], y]}, 
  SelectedNotebook[]];

并将每个单元格框架(线条只是单元格框架)变为黑色。

答案 2 :(得分:2)

虽然它不符合“自动”标准,但您可以插入默认蓝线然后更改其颜色。由于该行不可选,您需要在按下移位的行下单击。然后按Ctrl-Shift-E(显示表达式)查看(粗线)

Cell[" ", "Text",
 Editable->False,
 Selectable->False,
 CellFrame->{{0, 0}, {0, 3}},
 ShowCellBracket->False,
 CellMargins->{{0, 0}, {1, 1}},
 CellElementSpacings->{"CellMinHeight"->1},
 CellFrameMargins->0,
 CellFrameColor->RGBColor[0, 0, 1],
 CellSize->{Inherited, 5}]

然后RGBColor很容易改变。