]> gitweb.michael.orlitzky.com - mjotex.git/blobdiff - mjo-listing.tex
mjo-algebra.tex: fix glossary sorting of \variety
[mjotex.git] / mjo-listing.tex
index f733be6b4c5d8179e317859b6d3e5735d9699ae2..ccd0d9cf0fb23aaf14f40177959df3a41ed95473 100644 (file)
 %   x
 %   \end{tcblisting}
 %
-\usepackage{listings}
-\usepackage{tcolorbox}
+\ifx\havemjolisting\undefined
+\def\havemjolisting{1}
+
+
+\ifx\lstset\undefined
+  \usepackage{listings}
+\fi
+
+\ifx\tcbuselibrary\undefined
+  \usepackage{tcolorbox}
+\fi
 
 % Tell tcolorbox to use ``listings'' within the boxes.
 \tcbuselibrary{listings}
 %
 % The sole argument is the "name" of the listing, which ultimately
 % just identifies a file named "sage_listings/<name>.listing".
-\newcommand*{\sagelisting}[1]{\tcbinputlisting{listing only,%
-               colback=codebg,%
-               coltext=codefg,%
-               left=2em,%
-               listing options={language=sage,style=sage},%
-               listing file=sage_listings/#1.listing}}
+\newtcbinputlisting{\sagelisting}[2][]{%
+  colback=codebg,%
+  coltext=codefg,%
+  enlarge bottom finally by=\baselineskip,%
+  enlarge top initially by=\baselineskip,%
+  left=2em,%
+  listing only,%
+  listing options={language=sage,style=sage},%
+  listing file=sage_listings/#2.listing,%
+  #1}
+
+\fi