[PYTHON] How to make the font width of jupyter notebook put in pyenv equal width

I think that font width is getting more and more frustrating when using jupyter.

I tried my best to make it the same width, so make a note of it. The OS is Mac.

Edit ~ / .jupyter / custom / custom.css

I was told to edit here first when I went around. But it didn't work.

I thought about it. "I put it in pyenv, so it's not here, right?" What?

So I got hooked from there.

I tried various things. .. ..

as a result.

The final mess was ~ / .jupyter / custom / custom.css! !!

But by the time I get here,

pip install jupyterthemes
pip install --upgrade jupyterthemes
jt -t onedork -f inconsolata -T -N -cellw 90% -tfs 11

I was hitting it. (It was written that if you googled, this would be a good feeling)

I thought this was all I could do.

Actually, the theme has changed and it looks really cool, "Uh! This is definitely a font ... isn't it cured ?!"

Yes.

So here again ~/.jupyter/custom/custom.css I tried to look at.

Then, although it was empty a while ago, something amazing is written! !! I think that the theme was applied by hitting the jt command earlier.

Yes, I noticed that the css here is loaded even if I put it in pyenv here.

So, after researching various things, ・ It seems that div.CodeMirror is the part where the code is written. ・ It seems that if you put a monospace, it will be the same width. Because it was written ~/.jupyter/custom/custom.css Inside, div.CodeMirror When I tried searching with, ...

custom.css


div.CodeMirror pre {
 font-family: "Inconsolata-g", monospace, monospace;
 font-size: 11pt;
 line-height: 170%;
 color: #b5c2d9;
}

there were! !! !!

I mean, it's about monospace! And two!

I wondered why, and when I tried to verify the element with firefox (I'm sorry it's not chrome), this attribute is certainly strikethrough ...

As a result of various investigations in.

custom.css


div.CodeMirror pre {
 font-family: "Inconsolata-g", monospace, monospace !important;
 font-size: 11pt !important;
 line-height: 170% !important;
 color: #b5c2d9 !important;
}

I was able to add ! Important! !! !!

I'm happy.

I haven't tried it, but be aware that custom.css will probably be overwritten each time you apply the theme.

Also, if you don't want to write a theme, I don't know because I haven't tried this either, but in the above css (if not, make it)

custom.css


div.CodeMirror pre {
 font-family: "Inconsolata-g", monospace, monospace !important;
 font-size: 11pt !important;
 line-height: 170% !important;
 color: #b5c2d9 !important;
}

I think I should write. Maybe the "Inconsolata-g" part can be any font you like ...

that's all

Recommended Posts

How to make the font width of jupyter notebook put in pyenv equal width
How to see the contents of the Jupyter notebook ipynb file
How to execute commands in jupyter notebook
Jupyter Notebook Basics of how to use
Fill the browser with the width of Jupyter Notebook
To output a value even in the middle of a cell with Jupyter Notebook
How to get the number of digits in Python
How to instantly launch Jupyter Notebook from the terminal
How to use Jupyter Notebook
How to find the optimal number of clusters in k-means
How to import NoteBook as a module in Jupyter (IPython)
About the garbled Japanese part of pandas-profiling in Jupyter notebook
Put the lists together in pandas to make a DataFrame
How to import NoteBook as a module in Jupyter (IPython)
How to handle multiple versions of CUDA in the same environment
How to determine the existence of a selenium element in Python
How to implement Java code in the background of RedHat (LinuxONE)
How to resolve ModuleNotFoundError: No module named XXX in Jupyter Notebook
How to know the internal structure of an object in Python
How to change the color of just the button pressed in Tkinter
How to check the memory size of a variable in Python
Make the theme of Pythonista 3 like Monokai (how to make your own theme)
How to use python put in pyenv on macOS with PyCall
How to check the memory size of a dictionary in Python
[TensorFlow 2] How to check the contents of Tensor in graph mode
How to get the vertex coordinates of a feature in ArcPy
How to use Jupyter on the front end of supercomputer ITO
How to check the version of Django
Try to make a kernel of Jupyter
[Itertools.permutations] How to put permutations in Python
[Python] How to put any number of standard inputs in a list
How to compare if the contents of the objects in scipy.sparse.csr_matrix are the same
In Jupyter, add IPerl to the kernel.
How to put a line number at the beginning of a CSV file
How to use jupyter notebook with ABCI
How to hide warnings that do not affect execution in Jupyter Notebook
How to use Jupyter notebook [Super Basic]
How to revive cells in iPython notebook
How to pass the execution result of a shell command in a list in Python
How to mention a user group in slack notification, how to check the id of the user group
How to uniquely identify the source of access in the Django Generic Class View
I want to use Python in the environment of pyenv + pipenv on Windows 10
How to get the notebook name you are currently using in Google Colab
How to count the number of elements in Django and output to a template
How to deal with "No module named'〇〇'" error in Jupyter Notebook | Install with! Pip!
How to find the coefficient of the trendline that passes through the vertices in Python
What to do when the graph does not appear in jupyter (ipython) notebook
The first step to log analysis (how to format and put log data in Pandas)
How to make a Raspberry Pi that speaks the tweets of the specified user
How to get a list of files in the same directory with python
How to install the deep learning framework Tensorflow 1.0 in the Anaconda environment of Windows
How to calculate the volatility of a brand
How to find the area of the Voronoi diagram
How to debug with Jupyter or iPython Notebook
How to keep track of work in Powershell
Summary of how to import files in Python 3
Change the font size of the legend in df.plot
How to make multiple kernels selectable on Jupyter
Browser specification of Jupyter Notebook in Windows environment
Summary of how to use MNIST in Python
How to create data to put in CNN (Chainer)