Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Centering Text in IPython notebook markdown/heading cells?

I want to customize my notebook, make it more readable and stylish. So for that, I want to start with centering my headers. Is it possible?

like image 206
idoda Avatar asked Sep 02 '13 13:09

idoda


People also ask

How do you edit a markdown cell in Jupyter notebook?

Just double click on the markdown cell. Edit what you want to and Run. It will reflect the changes. Save your notebook.

How do you make a heading in Jupyter notebook?

Header cell Start the text in markdown cell by # symbol. Use as many # symbols corresponding to level of header you want. It means single # will render biggest header line, and six # symbols renders header of smallest font size.

How do you align a formula in a Jupyter notebook?

You separate lines in the equations with a double backslash ( // ). Insert an ampersand ( & ) in each line at the alignment point. All equations will be aligned at the location of the ampersand symbols (and, of course, the ampersands will not appear in the rendered equations).


5 Answers

You can actually use the markdown mode for the cell and use the normal HTML code, as in

<h1><center>Centered text!</center></h1>
like image 126
mar tin Avatar answered Oct 01 '22 01:10

mar tin


Not directly with markdown i think, but you can just enter HTML in the markdown cells:

<h3 align="center">This is a centered header</h3> 
like image 34
Rutger Kassies Avatar answered Sep 30 '22 23:09

Rutger Kassies


Knowing that in jupyter (ipython) notebook markdown cells the title level is identified by the number of # (# for top level headings or h1, ## for h2, ....), I use the following combination of HTML and markdown:

# <center>Your centered level h1 title</center>

## <center>Your centered level h2 title</center>

etc..

It's straightforward and the easiest to remember but please do comment if there's any disadvantage in doing so.

Tested in jupyter version 4.4.0 (not sure about other version but no reason it doesn't work).

like image 44
calocedrus Avatar answered Oct 01 '22 01:10

calocedrus


the easy way for me is just :

# <center> some fancy title here

it works without closing the tag, so i usually copy "<center>" and past it away in a single step when i finish.

like image 25
Tiago Ferrao Avatar answered Sep 30 '22 23:09

Tiago Ferrao


You can use one of the following lines - text cell.

<center>Your centered level h1 title</center>

<center> some fance title here

from Markdown_Guideline

like image 43
Cigdem Ozen Avatar answered Sep 30 '22 23:09

Cigdem Ozen