jupyter-notebook - 在 jupyter 笔记本上对齐行号
问题描述
问题:行号与单元格内的代码重叠。左边有足够的空间放置数字,但我不知道如何对齐它们。行号重叠。
上下文:我更新了我的主题,以使其在 jupyter 主题
!jt -t gruvboxl -f fira -fs 14 -nf ptsans -nfs 14 -N -kl -cursw 2 -cursc r -cellw 95% -T -ofs 14 -dfs 11
代码的帮助下更加舒适,以防万一。可能的原因:折叠代码(函数,循环)的笔记本扩展+行号+字体大小随着jupyter主题的增加都可能相互争斗。
TLDR:如何操作行号扩展以对齐左侧的数字?
解决方案
I got it. Not a CSS expert so maybe I broke something terribly and it will come back to bite me where I get my injections. Anyway, I added this to .jupyter\custom\custom.css:
div.CodeMirror-linenumber.CodeMirror-gutter-elt {
left: 10px !important;
}
pre.CodeMirror-line {
left: 2px !important;
}
推荐阅读
- r - R中删除的小数位
- google-apps-script - Google App Script 读取特定文件夹中的文件
- c - fscanf 上的分段错误
- java - 为什么 addNode() 方法返回编译错误“方法...类型...不适用于参数...”,我该如何解决?
- biztalk - 为什么 BizTalk Scope 没有捕获此 MissingPropertyException
- python - 如何在python中搜索和访问子元素和结构
- excel - 运行时错误 91 与 Excel VBA 中的 HTML 文档
- apache-calcite - Calcite:我们可以重写优化的 RelNode 吗?
- c# - 如何拆分字符串并删除每个第 n 个元素?
- transactions - 向客户端公开 DynamoDb 乐观锁定版本以防止更高级别的竞争条件是否可能并且是一种好习惯?