简体   繁体   English

使用 jupyterthemes 和目录修复 jupyter notebook 工具栏

[英]Fix jupyter notebook toolbar with jupyterthemes and table of contents

I'm running a jupyter notebook after having changed the theme this way以这种方式更改主题后,我正在运行 jupyter 笔记本

!jt -t oceans16 -T -N -kl

Now the toolbar appears but it overlaps with the code and table of contents.现在工具栏出现了,但它与代码和目录重叠。 If I scroll down the notebook it keeps hiding the first cells and the table of contents:如果我向下滚动笔记本,它会一直隐藏第一个单元格和目录:

在此处输入图片说明

This stops once I revert to default一旦我恢复到默认值,这就会停止

!jt -r

as you can see from here:你可以从这里看到:

在此处输入图片说明

Is it a problem from my settings of jupytherthemes or in the table of content from nbextension ?这是我的jupytherthemes设置或nbextension吗?

For me, the Table of contents and jupyter notebook is overlapping each other.对我来说,目录和 jupyter notebook 相互重叠。 For your case, try using the code below.对于您的情况,请尝试使用以下代码。 You can play with 70% value to get perfect match for your screen.您可以玩 70% 的价值,以获得与您的屏幕完美匹配的游戏。

from IPython.core.display import display, HTML
display(HTML("<style>.container { width:70% !important; }</style>"))

Code in ~/.jupyter/custom/custom.css overwrites the default settings with those by jupyter themes. ~/.jupyter/custom/custom.css代码用 jupyter 主题覆盖默认设置。
The default jupyter settings don't have the overlapping toolbar problem.默认的 jupyter 设置没有重叠工具栏的问题。

The code section below seems to be causing the problem.下面的代码部分似乎导致了问题。 Simply comment this section out as shown.如图所示简单地注释掉这部分。

/* 
div#maintoolbar {
 position: absolute;
 width: 90%;
 margin-left: -10%;
 padding-right: 8%;
 float: left;
 background: transparent !important;
}
#maintoolbar {
 margin-bottom: -3px;
 margin-top: 0px;
 border: 0px;
 min-height: 27px;
 padding-top: 2px;
 padding-bottom: 0px;
}
#maintoolbar .container {
 width: 75%;
 margin-right: auto;
 margin-left: auto;
}
*/

The answer to - how to revert to normal.答案 - 如何恢复正常。 When Jupyter note is started, don't run the above command and it will return to normal. Jupyter note 启动时,不要运行上述命令,它会恢复正常。 M

Moreover, you can run code like - display.max_columns to 'None' to run to default.此外,您可以运行诸如 - display.max_columns 到 'None' 之类的代码以运行默认值。

%matplotlib inline  
pd.set_option('display.max_columns', None)  
pd.set_option('display.max_rows', 100)

I'm running a jupyter notebook after having changed the theme this way通过这种方式更改主题后,我正在运行jupyter笔记本

!jt -t oceans16 -T -N -kl

Now the toolbar appears but it overlaps with the code and table of contents.现在出现工具栏,但它与代码和目录重叠。 If I scroll down the notebook it keeps hiding the first cells and the table of contents:如果我向下滚动笔记本,它将继续隐藏前几个单元格和目录:

在此处输入图片说明

This stops once I revert to default一旦我恢复为默认设置,此操作就会停止

!jt -r

as you can see from here:从这里您可以看到:

在此处输入图片说明

Is it a problem from my settings of jupytherthemes or in the table of content from nbextension ?它是从我的设置有问题jupytherthemes或从内容表nbextension

In your ~/.jupyter/custom folder, edit the custom.css file and remove the line: position:absolute;在您的~/.jupyter/custom文件夹中,编辑custom.css文件并删除以下行: position:absolute; under div#maintoolbar { .div#maintoolbar { This should set the toolbar to be the same as it is under the default Jupyter theme.这应该将工具栏设置为与默认 Jupyter 主题下的工具栏相同。

I also untick the options "Widen the display area to fit browser window" and "Move notebook's title and menu on the left instead of being centered" in the Nbextensions' Table of Contents options.我还在 Nbextensions 的目录选项中取消选中“扩大显示区域以适应浏览器窗口”和“将笔记本的标题和菜单移动到左侧而不是居中”选项。 Personally I find that gives me a better look when using Table of Contents with the toolbar.我个人发现,当使用带有工具栏的目录时,这让我看起来更好看。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM