如何改变字体在ipython笔记本 [英] How to change font in ipython notebook

查看:213
本文介绍了如何改变字体在ipython笔记本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对python相当新,没有html体验。问题已经提出,或者没有回答或没有回答足够的细节,我在iPython中设置默认字体(不更改为浏览器)。具体来说,什么必须放在css文件和哪个css文件应该使用?我在Windows系统上。



为了参考,这些是回答以下链接的SO问题:




  • 在#1中:未命名档案 /usr/lib/python2.6 /.../ css /

  • 在评论#1 :更改浏览器中的等宽字体 - 工作但字体为斜体

  • 在#2 custom.css c / c> $ b

    相关问题:


    1. 更改ipython notebook字体类型

    2. 更改字体& ipython notebook 中的背景颜色

    3. 在ipython notebook中更改(恢复默认)字体(未回答) -


    在我的浏览器中更改等宽字体工作,如#1的解答注释中所建议。但是字体是斜体的,这不是意图。

    解决方案

    您可以将鼠标悬停在 .ipython 文件夹 $ ipython locate 在您的终端/ bash中查看您的ipython所在的位置)



    c $ c> .ipython ,您将看到默认的 profile_default 目录。此目录将有 static / custom / custom.css 文件。



    现在可以将更改应用于此 custom.css 文件。在您可以使用或搜索的 custom.css 文件中有很多样式。例如,您可以查看此链接(这是我自己的 custom.css 文件)



    基本上, custom.css 文件将更改应用到您的浏览器。您可以在您的ipython记事本中使用inspect元素来查看要更改的元素。然后,您可以更改到 custom.css 文件。例如,您可以添加这些块以在 .CodeMirror pre 中更改字体以键入 Monaco



    .CodeMirror pre {font-family:Monaco; font-size:9pt;}


    I am fairly new to python and have no html experience. The question has been asked and either not answered at all or not answered in enough detail for me to set the default font within iPython (not change to browser). Specifically, what has to be put in the css file and which css file should be used? I am on a Windows system.

    For reference, these are in answer to the linked SO questions below:

    • in #1: an unnamed file in /usr/lib/python2.6/.../css/
    • in comment to #1: change monospace font in browser - worked but font is italic
    • in #2: custom.css in profile subdirectory /static/custom/custom.css

    Related questions:

    1. Change ipython notebook font type
    2. Change font & background color in ipython notebook
    3. Changing (back to default) font in ipython notebook (unanswered) -

    Edit: Changing the monospace font in my browser worked, as suggested in an answer comment of #1. However the font is italic, which is not what is intended.

    解决方案

    You can hover to .ipython folder (i.e. you can type $ ipython locate in your terminal/bash to see where is your ipython is located)

    Then, in .ipython, you will see profile_default directory which is the default one. This directory will have static/custom/custom.css file located.

    You can now apply change to this custom.css file. There are a lot of styles in the custom.css file that you can use or search for. For example, you can see this link (which is my own customize custom.css file)

    Basically, this custom.css file apply changes to your browser. You can use inspect elements in your ipython notebook to see which elements you want to change. Then, you can changes to the custom.css file. For example, you can add these chunk to change font in .CodeMirror pre to type Monaco

    .CodeMirror pre {font-family: Monaco; font-size: 9pt;}

    这篇关于如何改变字体在ipython笔记本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆