Skip to content

Instantly share code, notes, and snippets.

@igrishaev
Created July 5, 2023 11:46
Show Gist options
  • Save igrishaev/e31248c6e72585d9c3332d68bd6d0cf8 to your computer and use it in GitHub Desktop.
Save igrishaev/e31248c6e72585d9c3332d68bd6d0cf8 to your computer and use it in GitHub Desktop.
\documentclass[11pt]{book}
\usepackage[OT1, T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english, russian]{babel}
\usepackage[newfloat=true]{minted}
\usemintedstyle{bw}
\SetupFloatingEnvironment{listing}{placement=H}
\newminted[python]{python}{}
\usepackage{bold-extra}
\newenvironment{english}{\begin{otherlanguage}{english}}{\end{otherlanguage}}
\begin{document}
\begin{english}
\begin{python}
from typing import Iterator
# This is an example
class Math:
@staticmethod
def fib(n: int) -> Iterator[int]:
"""Fibonacci series up to n."""
a, b = 0, 1
while a < n:
yield a
a, b = b, a + b
result = sum(Math.fib(42))
print("The answer is {}".format(result))
\end{python}
\end{english}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment