summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
ba02271)
We shouldn't be trying to load "amsopn" ten times, for example. But
testing whether or not a package is loaded is tricky. First, I tried
the \@ifpackageloaded macro: that causes problems with some of my
existing documents, and the "spacefactor" error that results is
apparently a FAQ. But I don't know what to do about it.
The other way to test if a package is loaded is by checking for some
(unique?) macro that it defines. That's what I've guessed at here. It
works in most cases, like when we want \operatorname from "amsopn."
But, some packages also didn't have something obvious to check for, so
coverage isn't 100%.
14 files changed:
-% Needed for \operatorname.
-\usepackage{amsopn}
+\ifx\operatorname\undefined
+ \usepackage{amsopn}
+\fi
% The fraction field of its argument, an integral domain. The name
% "Frac" was chosen here instead of "Quot" because the latter
% The fraction field of its argument, an integral domain. The name
% "Frac" was chosen here instead of "Quot" because the latter
% This just gives us the floating ``algorithm'' environment.
\usepackage{algorithm}
% This just gives us the floating ``algorithm'' environment.
\usepackage{algorithm}
+% Use "//" for comments instead of the default.
\algrenewcommand{\algorithmiccomment}[1]{/\!/ {#1}}
\algrenewcommand{\algorithmiccomment}[1]{/\!/ {#1}}
+\input{mjo-common} % for \of, at least.
+
+\ifx\operatorname\undefined
+ \usepackage{amsopn}
+\fi
% The identity operator/arrow on its argument.
\newcommand*{\identity}[1]{ \operatorname{id}_{{#1}} }
% The identity operator/arrow on its argument.
\newcommand*{\identity}[1]{ \operatorname{id}_{{#1}} }
+%
+% Standard calculus operations.
+%
\ifx\havemjocalculus\undefined
\def\havemjocalculus{1}
\ifx\havemjocalculus\undefined
\def\havemjocalculus{1}
-% Needed for \mathbb.
-\usepackage{amsfonts}
+\ifx\mathbb\undefined
+ \usepackage{amsfonts}
+\fi
-% Needed for \bigtimes.
-\usepackage{mathtools}
+\ifx\bigtimes\undefined
+ \usepackage{mathtools}
+\fi
% Place the argument in matching left/right parentheses.
\newcommand*{\of}[1]{ \left({#1}\right) }
% Place the argument in matching left/right parentheses.
\newcommand*{\of}[1]{ \left({#1}\right) }
-\usepackage{amssymb} % \succcurlyeq and friends
+\ifx\succcurlyeq\undefined
+ \usepackage{amssymb} % \succcurlyeq, \preccurlyeq
+\fi
-% Needed for \operatorname.
-\usepackage{amsopn}
+\ifx\operatorname\undefined
+ \usepackage{amsopn}
+\fi
\usepackage[utf8]{inputenc}
% Grab the AMS fonts, too, for things like \mathbb.
\usepackage[utf8]{inputenc}
% Grab the AMS fonts, too, for things like \mathbb.
+\ifx\mathbb\undefined
+ \usepackage{amsfonts}
+\fi
\def\havemjolinearalgebra{1}
\def\havemjolinearalgebra{1}
-% Needed for \lvert, \rVert, etc. and \operatorname.
-\usepackage{amsmath}
+\ifx\lvert\undefined
+ \usepackage{amsmath} % \lvert, \rVert, etc. and \operatorname.
+\fi
-% Wasysym contains the \ocircle that we use in \directsumperp.
-\usepackage{wasysym}
+\ifx\ocircle\undefined
+ \usepackage{wasysym}
+\fi
-% Part of the adjustbox package; needed to clip the \perp sign.
-\usepackage{trimclip}
+\ifx\clipbox\undefined
+ % Part of the adjustbox package; needed to clip the \perp sign.
+ \usepackage{trimclip}
+\fi
-\usepackage{listings}
-\usepackage{tcolorbox}
+\ifx\lstset\undefined
+ \usepackage{listings}
+\fi
+
+\ifx\tcbuselibrary\undefined
+ \usepackage{tcolorbox}
+\fi
% Tell tcolorbox to use ``listings'' within the boxes.
\tcbuselibrary{listings}
% Tell tcolorbox to use ``listings'' within the boxes.
\tcbuselibrary{listings}
+\ifx\operatorname\undefined
+ \usepackage{amsopn}
+\fi
% The cardinality of a set. The |X| notation conflicts with the
% absolute value, and the meaning of card(X) is clear at once, so we
% The cardinality of a set. The |X| notation conflicts with the
% absolute value, and the meaning of card(X) is clear at once, so we
\def\havemjotheoremstar{1}
\def\havemjotheoremstar{1}
+\ifx\theoremstyle\undefined
+ \usepackage{amsthm}
+\fi
\theoremstyle{plain}
\newtheorem*{corollary*}{Corollary}
\theoremstyle{plain}
\newtheorem*{corollary*}{Corollary}
\ifx\havemjotheorem\undefined
\def\havemjotheorem{1}
\ifx\havemjotheorem\undefined
\def\havemjotheorem{1}
+\ifx\theoremstyle\undefined
+ \usepackage{amsthm}
+\fi
\theoremstyle{plain}
\newtheorem{corollary}{Corollary}
\theoremstyle{plain}
\newtheorem{corollary}{Corollary}
-% Needed for \operatorname.
-\usepackage{amsopn}
+\ifx\operatorname\undefined
+ \usepackage{amsopn}
+\fi