\usepackage{hypdoc}
\usepackage[
	loadHyperref=false,
	createIndexEntries=false
]{doctools}

\PageIndex
\EnableCrossrefs

\usepackage{textcomp} % needed for listings
\usepackage{xparse}
\usepackage{xkeyval}
\usepackage{changepage}

\usepackage[color]{changelog}

\errorcontextlines 10

\newcommand{\email}[1]{\href{mailto:#1}{\texttt{#1}}}
\newcommand{\https}[1]{\href{https://#1}{\texttt{#1}}}
\newcommand{\cl}{\ctan{changelog}}
\newcommand{\todo}[1]{\begin{itemize}\item[\textbf{To-do:}] #1 \end{itemize}}
\newcommand{\note}[1]{\begin{itemize}\item[\textbf{Note:}] #1 \end{itemize}}
\newcommand{\ctan}[1]{\href{https://ctan.org/pkg/#1}{\package{#1}}}
\NewExpandableDocumentCommand{\Th}{O{l} m}
	{\multicolumn{1}{#1}{\textbf{#2}}}
\newcommand{\ext}[1]{\texttt{.#1}}
\newcommand{\filename}[1]{\texttt{#1}}
\newcommand{\noterepo}[1]{\note{Browse the sources, contribute, or complain at \\
	\https{github.com/#1}}}

% definition copied from doc package \DescribeMacro
\lstnewenvironment{latexfile}[1]
	{\lstset{style=lstDemoStyleLaTeXCode}%
	}
	{}

\NewDocumentEnvironment{ctandescription}{}
	{\NewDocumentCommand{\pkg}{m}{\item[\ctan{##1}]}
	\begin{description}}
	{\end{description}}

% a list of colors; use \color{colorname}
\newenvironment{colorlist}
	{\begin{itemize}
		\let\old@item\item
		\renewcommand{\item}[1]{%
			\old@item[\fcolorbox{black}{##1}{\vphantom{X}\hspace{1em}}]
			\texttt{##1}
		}
	}
	{\end{itemize}}
