Skip to main content
Chemistry LibreTexts

4.2: Jupyter Notebooks (Executable Programming Code & Figures)

  • Page ID
    148808
  • Alert

    We are currently in the process of migrating from our prototypical alpha Jupyter system to our production-ready beta Jupyter backend. Please note that we cannot provide technical support for this feature until after our official feature launch shortly after August 25 as we are still in the process of making significant changes behind the scenes. Thank you for your patience as we upgrade this feature for general usage!

    Alert

    This feature is currently in alpha and for now is only available on the chemistry library.

    The Jupyter notebook system is a powerful aspect to the LibreTexts platform. The Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations and narrative text. Uses include: data cleaning and transformation, numerical simulation, statistical modeling, data visualization, machine learning, and much more.

    clipboard_e7894eef8fe792997185ce256cb13ae45.png

    Figure \(\PageIndex{1}\): Python code used for making an interactive figure in the LibreTexts platform (https://libretexts.org/advanced.html).

    Jupyter code can be embedded in four steps:

    Step 1: Set Meta-Tag

    Flip the "Embed Jupyter" meta tag on the page under page settings. You need to select which code you want active on this page. Only one language per page for now.

    Jupyter.png

    Figure \(\PageIndex{2}\):

    Step 2: Insert Jupyter Template

    You need to add the Jupyter template. You do this by selecting the Template section under "Elements" on the editing toolbar

    Slide2.PNG

    Figure \(\PageIndex{3}\):

    Then select "EmbedJupyter" template.

    Slide3.PNG

    Figure \(\PageIndex{4}\):

    The template box will be added.

    Slide4.PNG

    Figure \(\PageIndex{5}\):

    Step 3: Write Code

    Click on the "+" in upper left corner of the red DekiScriipt box to be able to insert python (or any other language) code.

    Slide5.PNG

    Figure \(\PageIndex{6}\):

    Step 4: Save and Execute

    You can execute the code. Via the green "run" button

    Slide6.PNG

    Figure \(\PageIndex{7}\):