PYJUPYTER

Author: BARA O. Bright

Date: 2026



DESCRIPTION

------------

pyjupyter is a lightweight LaTeX package providing a clean Python code environment inspired by Jupyter notebooks. It combines listings for syntax highlighting, tcolorbox for customizable boxes, and optional monospaced fonts like sourcecodepro for improved readability. Typical use cases include scientific reports, programming assignments, lecture notes, and reproducible research documents. This package does not replicate the full Jupyter interface but focuses on elegant Python code blocks in LaTeX.



INSTALLATION

------------

Place pyjupyter.sty in the same directory as your .tex file or in a local TEXMF tree, then load it in your document preamble:



\\usepackage{pyjupyter}



BASIC USAGE

-----------

Always include empty brackets \[] after \\begin{jupyter} to avoid parsing errors with initial comments.



Example:



\\begin{jupyter}\[]

&nbsp;   # Python code example

&nbsp;   def square(x):

&nbsp;       return x\*\*2

&nbsp;   print(square(4))

\\end{jupyter}



CUSTOMIZATION

-------------

1\. Font selection (font)

Supported fonts: sourcecodepro, beramono, inconsolata, lmtt, courier, txtt

Example:

\\begin{jupyter}\[font=beramono]

&nbsp;   print("Bera Mono font")

\\end{jupyter}



2\. Code size (codesize)

Adjust code font size using standard LaTeX sizes: tiny, scriptsize, footnotesize, small, normalsize, large

Example:

\\begin{jupyter}\[codesize=footnotesize]

&nbsp;   print("Smaller code font")

\\end{jupyter}



3\. tcolorbox options

All tcolorbox options are accepted, e.g., background color, frame color, arc, boxsep

Example:

\\begin{jupyter}\[colback=blue!5,colframe=blue!50!black]

&nbsp;   print("Custom colors")

\\end{jupyter}



4\. Line numbering

Enable line numbers using the built-in numbered option

Example:

\\begin{jupyter}\[numbered]

&nbsp;   for i in range(5):

&nbsp;       print(i)

\\end{jupyter}



5\. Custom listings options

You can pass any listings options manually via listing options

Example:

\\begin{jupyter}\[listing options={basicstyle=\\ttfamily\\scriptsize}]

&nbsp;   print("Custom basic style")

\\end{jupyter}



REQUIREMENTS

------------

Mandatory: tcolorbox, listingsutf8, xcolor

Optional: sourcecodepro (for improved monospaced font rendering)

All mandatory packages are included in standard LaTeX distributions (TeX Live, MiKTeX, etc.)



LICENSE

-------

Distributed under the LaTeX Project Public License (LPPL) v1.3c.

Copyright 2026 BARA O. Bright

Email: barabright62(at)gmail(dot)com



CHANGES

-------

v1.0.0 - First public release

v1.1.0 - Added support for font and codesize customization

