how to make a new line in a jupyter markdown cell

MarkdownJupyter NotebookJupyter

Markdown Problem Overview


$S$: a set of shops
$I$: a set of items M wants to get

I'd like to make a new line between this two sentences. We usually put " (space)" after the first sentence before a new line, but it doesn't work in Jupyter.

How can I do this? Should I put "enter" twice after the first sentence?

Markdown Solutions


Solution 1 - Markdown

Just add <br> where you would like to make the new line.

$S$: a set of shops
<br>
$I$: a set of items M wants to get

Because jupyter notebook markdown cell is a superset of HTML.
http://jupyter-notebook.readthedocs.io/en/latest/examples/Notebook/Working%20With%20Markdown%20Cells.html

Note that newlines using <br> does not persist when exporting or saving the notebook to a pdf (using "Download as > PDF via LaTeX"). It is probably treating each <br> as a space.

Solution 2 - Markdown

"We usually put ' (space)' after the first sentence before a new line, but it doesn't work in Jupyter."

That inspired me to try using two spaces instead of just one - and it worked!!

(Of course, that functionality could possibly have been introduced between when the question was asked in January 2017, and when my answer was posted in March 2018.)

Solution 3 - Markdown

Just use backslash \ at the end of the line atop.

The problem with double space is that it adds a white-space, so you have two different paragraphs.

I like sometimes having a new line in the same paragraph, for readability, but without a white-space between lines.

Backslash allows it, even if I'd prefer to have it the default option for "enter" in jupyter. If anyone has an idea of how to do this (by editing the right file in site-packages/notebook/static/notebook/js/ maybe?) I'm interested.

Solution 4 - Markdown

The double space generally works well. However, sometimes the lacking newline in the PDF still occurs to me when using four pound sign sub titles #### in Jupyter Notebook, as the next paragraph is put into the subtitle as a single paragraph. No amount of double spaces and returns fixed this, until I created a notebook copy 'v. PDF' and started using a single backslash '' which also indents the next paragraph nicely:

#### 1.1 My Subtitle  \

1.1 My Subtitle
    Next paragraph text.

An alternative to this, is to upgrade the level of your four # titles to three # titles, etc. up the title chain, which will remove the next paragraph indent and format the indent of the title itself (#### My Subtitle ---> ### My Subtitle).

### My Subtitle


1.1 My Subtitle

Next paragraph text.

Solution 5 - Markdown

There is a simple way to place text which will not be modified in Jupyter Notebook (markdown). You only use triple quotes with the reverse accent sign and end with the same quotes three times.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionhrsma2iView Question on Stackoverflow
Solution 1 - MarkdownWoooody AmadeusView Answer on Stackoverflow
Solution 2 - MarkdownvioletView Answer on Stackoverflow
Solution 3 - MarkdownNoGaView Answer on Stackoverflow
Solution 4 - MarkdownDataCodeFuView Answer on Stackoverflow
Solution 5 - MarkdownMarceloView Answer on Stackoverflow