\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{../../../lib/tex/macros}[2025/03/02 Handout macros]

\RequirePackage{hyperref}
\RequirePackage{pgf}
\RequirePackage{xcolor}


% Link to this repository
\newcommand{\smallurl}{\small\texttt{\href{https://betalupi.com/handouts}{https://betalupi.com/handouts}}}



\newcommand{\qe}{\stackrel{?}{=}}
\newcommand{\qgt}{\stackrel{?}{>}}
\newcommand{\qlt}{\stackrel{?}{<}}



% A row of stars, for showing difficulty
% first arg: filled stars
% second arg: total stars
\def\stars#1#2{%
	\def\oncolor{\color{ogrape}}%
	\def\offcolor{\color{black!30!white}}%
	%
	\count255=1%
	\count254=#2%
	\advance\count254 by -1%
	\ifnum #1 > 0
		% The $$ are required around \bigstar.
		% the special \odot chess piece breaks
		% star sizing if they are omitted.
		\loop
			{\oncolor $\bigstar$}%
		\ifnum\count255 < #1
		\advance\count255 by 1
		\repeat%
	\else%
		{\oncolor $\bigstar$}%
	\fi%
	%
	\ifnum \count255 < #2%
		\loop
			{\offcolor $\bigstar$}%
		\ifnum\count255 < \count254
		\advance\count255 by 1
		\repeat%
	\fi%
}




% Ruble symbol with tweaks
\DeclareRobustCommand*{\Rub}{%
	\begingroup
		\dimendef\H=0 %
		\settoheight\H{P}%
		\begin{pgfpicture}%
			\pgfsetlinewidth{.1\H}%
			\pgfsetrectcap
			\pgfsetmiterjoin
			\pgfmoveto{\pgfpoint{0pt}{0.07\H}}% Move to bottom of main line
			\pgflineto{\pgfpoint{0pt}{.90\H}}% P main line
			\pgflineto{\pgfpoint{.3\H}{.90\H}}% P top line
			\pgfpatharc{90}{-90}{.21\H}% P circle
			\pgflineto{\pgfpoint{-.08\H}{.48\H}}% P bottom line
			\pgfmoveto{\pgfpoint{-.08\H}{.31\H}}% Bonus line move
			\pgflineto{\pgfpoint{.34\H}{.31\H}}% Bonus line draw
			\pgfusepath{stroke}%
			\pgfmoveto{\pgfpoint{-.23\H}{0pt}}% Before space
			\pgfmoveto{\pgfpoint{0.55\H}{0pt}}% After space
		\end{pgfpicture}%
	\endgroup
}

% Ruble symbol, per official specification
%
%\DeclareRobustCommand*{\Rub}{%
%	\begingroup
%		\dimendef\H=0 %
%		\settoheight\H{P}%
%		\begin{pgfpicture}%
%			\pgfsetlinewidth{.1\H}%
%			\pgfsetrectcap
%			\pgfsetmiterjoin
%			\pgfmoveto{\pgfpoint{0pt}{0.05\H}}%
%			\pgflineto{\pgfpoint{0pt}{.95\H}}%
%			\pgflineto{\pgfpoint{.35\H}{.95\H}}%
%			\pgfpatharc{90}{-90}{.225\H}%
%			\pgflineto{\pgfpoint{-.05\H}{.5\H}}%
%			\pgfmoveto{\pgfpoint{-.05\H}{.34\H}}%
%			\pgflineto{\pgfpoint{.38\H}{.34\H}}%
%			\pgfusepath{stroke}%
%			\pgfmoveto{\pgfpoint{-.175\H}{0pt}}%
%			\pgfmoveto{\pgfpoint{.7\H}{0pt}}%
%		\end{pgfpicture}%
%	\endgroup
%}