【问题标题】:Coloring "horizontal line" in Mathematica在 Mathematica 中为“水平线”着色
【发布时间】:2011-09-08 18:09:09
【问题描述】:

无论如何在 Mathematica 中这些线是否自动变黑?

【问题讨论】:

    标签: wolfram-mathematica frontend


    【解决方案1】:

    这些行的默认样式在文件ContextMenus.tr 中定义,该文件位于$InstallationDirectory 的子目录SystemFiles/FrontEnd/TextResources 中。如果您在该文件中搜索“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 中的相应子目录并进行编辑。

    【讨论】:

    • 谢谢 Heike,我现在将使用 Sjoerd 解决方案,当我有时间真正了解我们与您一起修改的是什么时,我会实施它!
    【解决方案2】:

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

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

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

    【讨论】:

    • Sjoerd,我会去的,我现在不想弄乱那些文件。
    【解决方案3】:

    虽然它不满足“自动”的标准,但您可以插入默认的蓝线,然后更改其颜色。由于该行不可选择,您需要在该行下单击按上移。然后按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就很容易改变了。

    【讨论】:

      猜你喜欢
      • 2011-02-23
      • 1970-01-01
      • 2019-09-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多