How to get tab space in 'markdown' cell of Jupyter Notebook

I am writing descriptive ipynb file and need to give output in markdown with space, but unable to add tab space for printing structured data.

5 Answers

  1. Type "nbsp" to add a single space.
  2. Type "ensp" to add 2 spaces.
  3. Type "emsp" to add 4 spaces.
  4. Use the non-breaking space (nbsp) 4 times to insert a tab.

eg. This is an example.

I just had this problem and resorted to the following:

This is text with $\;\;\;\;\;\;$ some space inserted.

1

Markdown is used primarily to generate HTML, and HTML collapses white spaces by default. Use " " instead of space characters.

Type "&nbsp" to add a single space. Type "&ensp" to add 2 spaces. Type "&emsp" to add 4 spaces.

1

If I understand your question then I don't think this has anything to do with Jupyter cells. For example, are you able to type a tab key into a Stackoverflow question box? Most browsers do not allow tab keys in most dialogs on most websites -- instead, tab switches to the next area.

Some options:

  1. cut a tab from a text application, paste into a Jupyter cell. (works)
  2. try using a browser-specific extension, like TabMeansTab for Chrome or Tabinta for Firefox.

See also further discussions of typing tab keys in browsers in general on SuperUser:

I'm trying to write some descriptive fancy script in my Jupyter Notebook Markdown cell but there is no answer that could help me to make it copy-pastable in my Jupyter Notebook Code cell when I run it. For example:

`def my_fancy_code():`
&emsp;<s>`n = 'some name that has a special effect'`</s>
&ensp;&ensp;<s>`n = 'some name that has a special effect'`</s>
&nbsp;&nbsp;&nbsp;&nbsp;<s>`n = 'some name that has a special effect'`</s>
$\;\;\;\;\;\;$<s>`n = 'some name that has a special effect'`</s> 

gives me some fancy output, but after I paste it in mu Jupyter Notebook Code cell I get something like this:

def my_fancy_code():
 n = 'some name that has a special effect'
  n = 'some name that has a special effect' n = 'some name that has a special effect'
n = 'some name that has a special effect'

Actualy, &nbsp;, &ensp;, &mnsp; are substitutes for SPACE character that can't used in Python code in order to replace TABs. Also $\;\;\;\;\;\;$ won't make any copyable spaces at all. The best solution I found is to use this way:

<code>&nbsp;&nbsp;&nbsp;&nbsp;</code>

Or you can simply use just <code> </code> with 4 spaces inside. It makes a perfect gap of 4 spaces length which can be copied in Python scripts instead of TAB characters.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like