diff --git a/Problems/main.tex b/Problems/main.tex deleted file mode 100755 index 658110a..0000000 --- a/Problems/main.tex +++ /dev/null @@ -1,194 +0,0 @@ -% use [nosolutions] flag to hide solutions. -% use [solutions] flag to show solutions. -\documentclass[ - solutions -]{../resources/ormc_handout} - - -\NewDocumentCommand{\p}{ m m }{ - \problem{} - \getproblem{#1}{#2} - - \ifsolution{#1}{#2}{ - \begin{solution} - \getsolution{#1}{#2} - \end{solution} - }[ - \ifanswer{#1}{#2}{ - {\color{red}\textbf{Solution:}} \getanswer{#1}{#2} - } - ] - - \vfill -} - -% Defines a new problem. -% See problem definition files for usage examples. -\long\def\problemdef#1#2#3{ - \ifcsname#1:problem:#2\endcsname - \PackageError{Problem Sets}{Problem #1:#2 is already defined}{} - \fi - - % Use a group to limit scope of special commands. - \begingroup - - % \gdef = \global\def - % This makes problem definitions global, and not restricted to this group. - % - % ##1: used to define parametrized macros in a parametrized macro. - % When \problemdef is expanded, ##1 becomes #1. - % - % \long\def: like \def, but allows multi-paragraph arguments - % \def\name#1{def: #1}: define a macro \name with one arg. TeX primitive. - % - % We don't use \newcommand or \renewcommand here because they will fail if - % a macro is defined/not defined. \def will always work, defining a new name - % in this group, temporarily redefining existing commands. - % - % \expandafter - % \expandafter command delays expanding a macro until its arguments have been expanded. - \long\def\difficulty##1{\expandafter\gdef\csname#1:difficulty:#2\endcsname{##1}} - \long\def\statement##1{\expandafter\gdef\csname#1:problem:#2\endcsname{##1}} - \long\def\solution##1{\expandafter\gdef\csname#1:solution:#2\endcsname{##1}} - \long\def\answer##1{\expandafter\gdef\csname#1:answer:#2\endcsname{##1}} - - #3 - - \endgroup - - \ifcsname#1:all\endcsname - \expandafter\edef\csname#1:all\endcsname{\csname#1:all\endcsname \p{#1}{#2}} - \else - \expandafter\gdef\csname#1:all\endcsname{ - \p{#1}{#2} - } - \fi -} - -\input{problems/numbertheory} -\input{problems/algebra} -\input{problems/combinatorics} -\input{problems/pidgeonhole} - -% Gets problem data. -% Arguments: -% #1: Category -% #2: Problem id -% #3: Field to get -\NewDocumentCommand{\get}{ m m m }{ - \ifcsname#1:#3:#2\endcsname - \csname#1:#3:#2\endcsname - \else - \PackageError{Problem Sets}{Problem #1:#2 is not defined}{} - \fi -} -\NewDocumentCommand{\getdifficulty}{ m m }{\get{#1}{#2}{difficulty}} -\NewDocumentCommand{\getproblem}{ m m }{\get{#1}{#2}{problem}} - - -% #1: Category -% #2: Problem id -% #3: Show if this problem has an answer -% #4: Show if this problem doesn't have an answer -\NewDocumentCommand{\ifanswer}{ m m m d[]}{ - \ifcsname#1:answer:#2\endcsname - #3 - \else - \IfNoValueF{#4}{#4} - \fi -} -\NewDocumentCommand{\ifsolution}{ m m m d[]}{ - \ifcsname#1:solution:#2\endcsname - #3 - \else - \IfNoValueF{#4}{#4} - \fi -} - -\NewDocumentCommand{\getanswer}{ m m }{ - \ifanswer{#1}{#2}{ - \get{#1}{#2}{answer} - }[ - \PackageError{Problem Sets}{Problem #1:#2 has no answer}{} - ] -} - -\NewDocumentCommand{\getsolution}{ m m }{ - \ifsolution{#1}{#2}{ - \get{#1}{#2}{solution} - }[ - \PackageError{Problem Sets}{Problem #1:#2 has no solution}{} - ] -} - -%\makeatletter -%\newcommand{\shoppinglist}[1]{Shopping list: #1\checknextarg} -%\newcommand{\checknextarg}{\@ifnextchar\bgroup{\gobblenextarg}{ and that's all!}} -%\newcommand{\gobblenextarg}[1]{ and also #1\@ifnextchar\bgroup%{\gobblenextarg}{ and that's all!}} -%\makeatother - -\newcommand{\q}[1]{ - \csname#1:all\endcsname -} - - -\begin{document} - - \q{Algebra} - - \maketitle - - - {Finite Automata} - {Prepared by Mark and Nikita on \today} - - - \section{Number Theory} - \p{NumberTheory}{1} - \p{NumberTheory}{2} - \p{NumberTheory}{3} - \p{NumberTheory}{4} - \p{NumberTheory}{5} - - \pagebreak - - \section{Algebra} - \p{Algebra}{1} - \p{Algebra}{2} - \p{Algebra}{3} - \p{Algebra}{4} - \p{Algebra}{5} - - \pagebreak - - \section{Combinatorics} - \p{Combinatorics}{1} - \p{Combinatorics}{2} - \p{Combinatorics}{3} - \p{Combinatorics}{4} - \p{Combinatorics}{5} - - \pagebreak - - \section{Pidgeonhole} - \p{Pidgeonhole}{1} - \p{Pidgeonhole}{2} - \p{Pidgeonhole}{3} - \p{Pidgeonhole}{4} - \p{Pidgeonhole}{5} - \p{Pidgeonhole}{6} - \p{Pidgeonhole}{7} - \p{Pidgeonhole}{8} - \p{Pidgeonhole}{9} - \p{Pidgeonhole}{10} - \p{Pidgeonhole}{11} - \p{Pidgeonhole}{12} - \p{Pidgeonhole}{13} - \p{Pidgeonhole}{14} - \p{Pidgeonhole}{15} - \p{Pidgeonhole}{16} - \p{Pidgeonhole}{17} - \p{Pidgeonhole}{18} - \p{Pidgeonhole}{19} - -\end{document} \ No newline at end of file