Skip to content

Commit

Permalink
Add a tutorial and nbsphinx (#243)
Browse files Browse the repository at this point in the history
Trying to reproduce
#221.

This is good for us to have either way. Related to
#220.

![Screenshot 2023-04-04 at 11 44 55
AM](https://user-images.githubusercontent.com/14852634/229874662-d9479b1f-e866-4597-82f6-e037d87ec519.png)

--

![Screenshot 2023-04-04 at 11 45 07
AM](https://user-images.githubusercontent.com/14852634/229874718-b3ab9a2a-af7d-42d5-a287-2aec7372e0cb.png)
  • Loading branch information
Eric-Arellano authored Apr 7, 2023
1 parent eaa076a commit 791497d
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
'sphinx.ext.extlinks',
'jupyter_sphinx',
'sphinx_design',
"nbsphinx",
]

# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -158,6 +159,16 @@
}


# -----------------------------------------------------------------------------
# nbsphinx
# -----------------------------------------------------------------------------

nbsphinx_execute = "never"
nbsphinx_thumbnails = {
"sphinx_guide/notebook": "_static/no_image.png",
}


# set up custom extension for languages
def setup(app):
app.setup_extension('language_utils')
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ Qiskit sphinx theme |version| documentation
sphinx_guide/jupyter
sphinx_guide/paragraph
sphinx_guide/structural
sphinx_guide/notebook_gallery
GitHub <https://github.com/Qiskit/qiskit-terra>
45 changes: 45 additions & 0 deletions docs/sphinx_guide/notebook.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# My tutorial with a long title"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Introduction \n",
"\n",
"The molecular Hamiltonian is \n",
"\n",
"$$\n",
"\\mathcal{H} = - \\sum_I \\frac{\\nabla_{R_I}^2}{M_I} - \\sum_i \\frac{\\nabla_{r_i}^2}{m_e} - \\sum_I\\sum_i \\frac{Z_I e^2}{|R_I-r_i|} + \\sum_i \\sum_{j>i} \\frac{e^2}{|r_i-r_j|} + \\sum_I\\sum_{J>I} \\frac{Z_I Z_J e^2}{|R_I-R_J|}\n",
"$$\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.16"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
7 changes: 7 additions & 0 deletions docs/sphinx_guide/notebook_gallery.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#######################
Tutorials
#######################


.. nbgallery::
notebook.ipynb
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ numpy
matplotlib
sphinx-design
sphinx-autodoc-typehints
nbsphinx==0.9.*

0 comments on commit 791497d

Please sign in to comment.