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}
18 \usepackage{tcolorbox
}
20 % Tell tcolorbox to use ``listings'' within the boxes.
21 \tcbuselibrary{listings
}
23 % Define the colors that we'll use in our listings.
24 \definecolor{codefg
}{rgb
}{0.9,
0.9,
0.9}
25 \definecolor{codebg
}{rgb
}{0.16,
0.16,
0.16}
26 \definecolor{brilliantlavender
}{rgb
}{0.96,
0.73,
1.0}
27 \definecolor{brilliantgreen
}{rgb
}{0.7,
0.9,
0.7}
28 \definecolor{brown
}{rgb
}{0.75,
0.4,
0.4}
30 % General listing settings.
32 basicstyle=
\ttfamily\small,
35 showstringspaces=false
38 % Define a style for interactive sage prompt listings.
39 \lstdefinelanguage{sage
}{ keywords=
{sage
} }
40 \lstdefinestyle{sage
}{
41 commentstyle=
\color{brown
},
42 keywordstyle=
\color{brilliantlavender
},
43 stringstyle=
\color{brilliantgreen
}
47 % Input a SageMath example code listing from a file. You generally
48 % want these to be in separate files so that the build system can test
51 % The sole argument is the "name" of the listing, which ultimately
52 % just identifies a file named "sage_listings/<name>.listing".
53 \newcommand*
{\sagelisting}[1]{\tcbinputlisting{listing only,
%
57 listing options=
{language=sage,style=sage
},
%
58 listing file=sage_listings/
#1.listing
}}