OpenSecEd / templates

Templates for various files
Other
0 stars 0 forks source link

Add requirements, properties blocks #19

Open dbosk opened 7 years ago

dbosk commented 7 years ago

There are two good environments in dbosk's Protesting chapter which should be added as blocks for slides as well. For notes, the following code can be used:

\usepackage[inline]{enumitem}
\newlist{properties@}{enumerate}{5}
\setlist[properties@]{label*=P\arabic*.,ref=P\arabic*}
\newlist{requirements@}{enumerate}{5}
\setlist[requirements@]{label*=R\arabic*.,ref=R\arabic*}

\usepackage{xparse}
\DeclareDocumentEnvironment{properties}{o}{%
  \IfValueTF{#1}{%
    \begin{properties@}[label*=#1\arabic*.,ref=#1\arabic*]%
  }{%
    \begin{properties@}%
  }
}{%
  \end{properties@}%
}
\DeclareDocumentEnvironment{requirements}{o}{%
  \IfValueTF{#1}{%
    \begin{requirements@}[label*=#1\arabic*.,ref=#1\arabic*]%
  }{%
    \begin{requirements@}%
  }
}{%
  \end{requirements@}%
}

\usepackage[capitalize]{cleveref}
\crefname{properties@i}{property}{properties}
\Crefname{properties@i}{Property}{Properties}
\crefname{requirements@i}{requirement}{requirements}
\Crefname{requirements@i}{Requirement}{Requirements}
dbosk commented 7 years ago

There is a beamer version in ProtestVerif:

\DeclareDocumentEnvironment{properties}{o}{%
  \begin{block}{Properties}
    \IfValueTF{#1}{\begin{enumerate}[{#1}1:]}{\begin{enumerate}}
}{%
    \end{enumerate}
  \end{block}
}
\DeclareDocumentEnvironment{requirements}{o}{%
  \begin{block}{Requirements}
    \IfValueTF{#1}{\begin{enumerate}[{#1}1:]}{\begin{enumerate}}
}{%
    \end{enumerate}
  \end{block}
}
dbosk commented 4 years ago

This should go into the beamer-didactic package.