2 % Code listing support, in particular, for the SageMath interactive
3 % prompt. You can create a box thingy for displaying code like,
5 % \begin{tcblisting}{listing only,
8 % listing options={language=sage,style=sage}}
13 \ifx\havemjolisting\undefined
14 \def\havemjolisting{1}
21 \ifx\tcbuselibrary\undefined
22 \usepackage{tcolorbox
}
25 % Tell tcolorbox to use ``listings'' within the boxes.
26 \tcbuselibrary{listings
}
28 % Define the colors that we'll use in our listings.
29 \definecolor{codefg
}{rgb
}{0.9,
0.9,
0.9}
30 \definecolor{codebg
}{rgb
}{0.16,
0.16,
0.16}
31 \definecolor{brilliantlavender
}{rgb
}{0.96,
0.73,
1.0}
32 \definecolor{brilliantgreen
}{rgb
}{0.7,
0.9,
0.7}
33 \definecolor{brown
}{rgb
}{0.75,
0.4,
0.4}
35 % General listing settings.
37 basicstyle=
\ttfamily\small,
40 showstringspaces=false
43 % Define a style for interactive sage prompt listings.
44 \lstdefinelanguage{sage
}{ keywords=
{sage
} }
45 \lstdefinestyle{sage
}{
46 commentstyle=
\color{brown
},
47 keywordstyle=
\color{brilliantlavender
},
48 stringstyle=
\color{brilliantgreen
}
52 % Input a SageMath example code listing from a file. You generally
53 % want these to be in separate files so that the build system can test
56 % The sole argument is the "name" of the listing, which ultimately
57 % just identifies a file named "sage_listings/<name>.listing".
58 \newtcbinputlisting{\sagelisting}[2][]{%
61 enlarge bottom finally by=
\baselineskip,
%
62 enlarge top initially by=
\baselineskip,
%
65 listing options=
{language=sage,style=sage
},
%
66 listing file=sage_listings/
#2.listing,
%