how to make a new line in a jupyter markdown cell

后端 未结 3 1059
伪装坚强ぢ
伪装坚强ぢ 2021-02-01 12:27

md $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 fi

相关标签:
3条回答
  • 2021-02-01 12:59

    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.

    0 讨论(0)
  • 2021-02-01 13:06

    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.
    
    0 讨论(0)
  • 2021-02-01 13:18

    "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.)

    0 讨论(0)
提交回复
热议问题