From 34970438942b4448ada18729aebc620ceed2523d Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 23 Jul 2020 21:24:45 +0000 Subject: exesheet (23jul20) git-svn-id: svn://tug.org/texlive/trunk@55916 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/exesheet/exesheet.cls | 36 ++ Master/texmf-dist/tex/latex/exesheet/exesheet.sty | 448 ++++++++++++++++++++++ 2 files changed, 484 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/exesheet/exesheet.cls create mode 100644 Master/texmf-dist/tex/latex/exesheet/exesheet.sty (limited to 'Master/texmf-dist/tex/latex/exesheet') diff --git a/Master/texmf-dist/tex/latex/exesheet/exesheet.cls b/Master/texmf-dist/tex/latex/exesheet/exesheet.cls new file mode 100644 index 00000000000..401c5139769 --- /dev/null +++ b/Master/texmf-dist/tex/latex/exesheet/exesheet.cls @@ -0,0 +1,36 @@ +%% +%% This is file `exesheet.cls', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% exesheet.dtx (with options: `class') +%% +%% This is a generated file. +%% +%% Copyright (C) 2020 by Antoine Missier +%% +%% This file may be distributed and/or modified under the conditions of +%% the LaTeX Project Public License, either version 1.3 of this license +%% or (at your option) any later version. The latest version of this +%% license is in: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3 or later is part of all distributions of LaTeX version +%% 2005/12/01 or later. +%% +\NeedsTeXFormat{LaTeX2e}[2005/12/01] +\ProvidesClass{exesheet} + [2020/07/22 v1.0 .dtx exesheet file] + +\DeclareOption{notoc}{\PassOptionsToPackage{notoc}{exesheet}} +\DeclareOption{nosetlist}{\PassOptionsToPackage{nosetlist}{exesheet}} +\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} +\ProcessOptions \relax +\LoadClass{article} +\RequirePackage{exesheet} +\RequirePackage{schooldocs} +\endinput +%% +%% End of file `exesheet.cls'. diff --git a/Master/texmf-dist/tex/latex/exesheet/exesheet.sty b/Master/texmf-dist/tex/latex/exesheet/exesheet.sty new file mode 100644 index 00000000000..feddf525fdd --- /dev/null +++ b/Master/texmf-dist/tex/latex/exesheet/exesheet.sty @@ -0,0 +1,448 @@ +%% +%% This is file `exesheet.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% exesheet.dtx (with options: `package') +%% +%% This is a generated file. +%% +%% Copyright (C) 2020 by Antoine Missier +%% +%% This file may be distributed and/or modified under the conditions of +%% the LaTeX Project Public License, either version 1.3 of this license +%% or (at your option) any later version. The latest version of this +%% license is in: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3 or later is part of all distributions of LaTeX version +%% 2005/12/01 or later. +%% +\NeedsTeXFormat{LaTeX2e}[2005/12/01] +\ProvidesPackage{exesheet} + [2020/07/22 v1.0 .dtx exesheet file] + +\RequirePackage{ifthen} +\newboolean{notoc} +\newboolean{nosetlist} +\DeclareOption{notoc}{\setboolean{notoc}{true}} +\DeclareOption{nosetlist}{\setboolean{nosetlist}{true}} +\ProcessOptions \relax +\RequirePackage{xcolor} +\RequirePackage[shortlabels]{enumitem} +\RequirePackage{tasks} +\RequirePackage{versions} +\RequirePackage{geometry} +\RequirePackage{fancybox} + +\def\exercisename{Exercise} +\def\subpartname{Part} +\def\annexname{Annex} +\def\exname{Ex} +\def\pointsname{points} +\def\pointname{point} +\def\correctionname{Correction} +\def\ptsname{pts} +\def\ptname{pt} + +\newcommand\exetranslate{% + \@ifpackageloaded{babel}{% + \addto\captionsfrench{% + \def\exercisename{Exercice} + \def\subpartname{Partie} + \def\annexname{Annexe} + \def\exname{Ex} + \def\pointsname{points} + \def\pointname{point} + \def\correctionname{Correction} + \def\ptsname{pts} + \def\ptname{pt} + } + \addto\captionsgerman{% + \def\exercisename{\"Ubung} + \def\subpartname{Teil} + \def\annexname{Anhang} + \def\exname{\"Ub} + \def\pointsname{Punkte} + \def\pointname{Punkt} + \def\correctionname{Verbesserung} + \def\ptsname{Pkte} + \def\ptname{Pkt} + } + \addto\captionsspanish{% + \def\exercisename{Ejercicio} + \def\subpartname{Parte} + \def\annexname{Anexo} + \def\exname{Ej} + \def\pointsname{puntos} + \def\pointname{punto} + \def\correctionname{Correcci\'on} + \def\ptsname{ptos} + \def\ptname{pot} + } + \addto\captionsitalian{% + \def\exercisename{Esercizio} + \def\subpartname{Parte} + \def\annexname{Ansesso} + \def\exname{Es} + \def\pointsname{punti} + \def\pointname{punto} + \def\correctionname{Correzione} + \def\ptsname{pti} + \def\ptname{pt} + } + \addto\captionsportuges{% + \def\exercisename{Exerc\'icio} + \def\subpartname{Parte} + \def\annexname{Anexo} + \def\exname{Ex} + \def\pointsname{pontos} + \def\pointname{ponto} + \def\correctionname{Corre\c c\~ao} + \def\ptsname{pts} + \def\ptname{pt} + } + }{} + } + +\AtBeginDocument{\exetranslate} % if loaded before babel +\exetranslate % necessary when loaded after babel + +\definecolor{pointscolor}{named}{red} +\definecolor{ptscolor}{named}{red} +\definecolor{markingcolor}{named}{red} +\definecolor{notecolor}{rgb}{0.0, 0.4, 0.0} % kind of dark green +\definecolor{correctioncolor}{rgb}{0,0.2,0.6} % kind of dark blue + +\newcounter{exercise} + +\newcommand{\labelexercise}{\exercisename~\theexercise} +\newcommand{\labelexercisestyle}{} +\newcommand*{\@exercise}[1][]{% + \refstepcounter{exercise} + \subsection*{\labelexercisestyle\labelexercise\ #1} + \ifthenelse{\boolean{notoc}}{}{ + \addcontentsline{toc}{subsection}{\labelexercise} + } + } +\newcommand*{\@@exercise}[2][]{% + \subsection*{\labelexercisestyle #2 #1} + \setcounter{subpart}{0} % resets the parts counter + \ifthenelse{\boolean{notoc}}{}{ + \addcontentsline{toc}{subsection}{#2} + } + } +\newcommand{\exercise}{\@ifstar{\@@exercise}{\@exercise}} + +\newcounter{subpart}[exercise] % +\renewcommand{\thesubpart}{\Alph{subpart}} + +\newcommand{\labelsubpart}{\subpartname~\thesubpart} +\newcommand{\labelsubpartstyle}{} +\newcommand*{\@subpart}[1][]{% + \refstepcounter{subpart}% + \subsubsection*{\labelsubpartstyle\labelsubpart\ #1} + \ifthenelse{\boolean{notoc}}{}{ + \addcontentsline{toc}{subsubsection}{\labelsubpart} + } + } +\newcommand*{\@@subpart}[2][]{% + \subsubsection*{\labelsubpartstyle #2 #1} + \ifthenelse{\boolean{notoc}}{}{ + \addcontentsline{toc}{subsubsection}{#2} + } + } +\newcommand{\subpart}{\@ifstar{\@@subpart}{\@subpart}} + +\newcommand{\annexstyle}{\MakeUppercase} +\newcommand*{\annex}[1][]{% + \subsection*{\mbox{}\hfill\annexstyle{\annexname} #1\hfill\mbox{}} + \ifthenelse{\boolean{notoc}}{}{ + \addcontentsline{toc}{subsection}{\annexname} + } + } + +\newcommand{\exlabel}{\exname.~\theexercise} +\newcommand{\exsepmark}{---} +\newcommand{\@exe}{\textbf{\exlabel~\exsepmark}~} +\newcommand{\@@exe}{\textbf{\exlabel}~} +\newcommand{\exe}{\bigskip\par\noindent\refstepcounter{exercise} + \@ifstar{\@@exe}{\@exe} + } + +\newcommand{\pointsstyle}{% + \small\mdseries\sffamily\color{pointscolor}\fbox} +\newcommand*{\points}[1]{\hfill + \pointsstyle{#1~% + \ifthenelse{\lengthtest{#1 cm < 2cm}}{\pointname}{\pointsname}% + } + } + +\newcommand\standardfrenchlists{% + \@ifpackagewith{babel}{frenchb}{ + \frenchbsetup{StandardLists=true}}{} + \@ifpackagewith{babel}{french}{ + \@ifundefined{frenchsetup}{ + \frenchbsetup{StandardLists=true}}{ + \frenchsetup{StandardLists=True}} + }{} + } +\ifthenelse{\boolean{nosetlist}}{}{ + \AtBeginDocument{% if loaded before babel package + \standardfrenchlists} + \standardfrenchlists % necessary when loaded after babel + \setlist[enumerate]{font=\bfseries} + \setlist[enumerate,1]{topsep=1.5ex plus 1ex minus 1ex,leftmargin=1.5em} + } + +\newenvironment{exenumerate}[1][]{% + \setlist[enumerate]{font=\bfseries} + \setlist[enumerate,1]{leftmargin=1.5em, + itemsep=3ex plus 1ex minus 1ex,topsep=3ex plus 1ex minus 1ex} + \setlist[enumerate,3]{noitemsep,nolistsep} + \setlist[itemize]{noitemsep,nolistsep} + \begin{enumerate}[#1] + }{\end{enumerate}} + +\ifthenelse{\boolean{nosetlist}}{ + \NewTasks[counter-format=tsk[1]., + column-sep=1em, + after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenum}[\item](2) + \NewTasks[counter-format=(tsk[a]), + column-sep=1em,label-align=right, + item-indent=2.15em,label-width=1.6em,label-offset=0.5em, + after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenuma}[\item](2) + }{% by default + \NewTasks[counter-format=tsk[1].,label-format=\bfseries, + column-sep=1em,label-align=right, + item-indent=1.5em,label-width=1em,label-offset=0.5em, + after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenum}[\item](2) + \NewTasks[counter-format=(tsk[a]),label-format=\bfseries, + column-sep=1em,label-align=right, + item-indent=2.15em,label-width=1.6em,label-offset=0.5em, + after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenuma}[\item](2) + } + +\NewTasks[label=\labelitemi, + label-align=right, + item-indent=2.3333em,label-offset=0.5em, + after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablitem}[\item](2) + +\newenvironment{colsenum}[2][]{% + \setlength{\multicolsep}{2ex} + \raggedcolumns % default is \flushcolumns + \begin{multicols}{#2} % #2 = number of columns + \begin{enumerate}[#1] % #1 = options of enumerate + }{ + \end{enumerate} + \end{multicols} +} + +\newenvironment{colsenum*}[2][]{% + \setlength{\multicolsep}{2ex} + \begin{multicols}{#2} % #2 = number of columns + \begin{enumerate}[#1] % #1 = options of enumerate + }{ + \end{enumerate} + \end{multicols} +} + +\newenvironment{colsitem}[2][]{% + \setlength{\multicolsep}{2ex} + \raggedcolumns + \begin{multicols}{#2} + \begin{itemize}[#1] + }{ + \end{itemize} + \end{multicols} +} + +\newenvironment{colsitem*}[2][]{% + \setlength{\multicolsep}{2ex} + \begin{multicols}{#2} + \begin{itemize}[#1] + }{ + \end{itemize} + \end{multicols} +} + +\newboolean{questions} +\newboolean{answers} +\setboolean{questions}{true} +\setboolean{answers}{true} +\newcommand{\questionsonly}{ + \setboolean{questions}{true}\setboolean{answers}{false}} +\newcommand{\answersonly}{ + \setboolean{questions}{false}\setboolean{answers}{true}} + +\newcounter{exe@ini} +\newcounter{subpart@ini} + +\newenvironment{questions}{ + \ifthenelse{\boolean{questions}}{ + \setcounter{exe@ini}{\value{exercise}} + \setcounter{subpart@ini}{\value{subpart}} + }{\comment}}% + {\ifthenelse{\boolean{questions}}{}{\endcomment}} + +\newcounter{@toclevel} +\newcommand{\set@toclevel}[1][]{ + \ifthenelse{\equal{#1}{}}{ + \ifthenelse{\value{exercise} > \value{exe@ini}}{ + \setcounter{@toclevel}{1} + }{\ifthenelse{\equal{\the\@enumdepth}{0}}{ + % we're not in an enumerate environment + \ifthenelse{\(\value{subpart} > \value{subpart@ini}\) + \or \(\value{subpart} = 0\)}{ + \setcounter{@toclevel}{2} + }{\setcounter{@toclevel}{3}} + }{\setcounter{@toclevel}{4}}} + }{\setcounter{@toclevel}{#1}}} + +\newcommand{\correctionstyle}{\color{correctioncolor}} + +\newenvironment{answers}[1][]{% #1 is the optional level + \ifthenelse{\boolean{answers}}{% + \ifthenelse{\boolean{questions}}{% + \set@toclevel[#1] + \ifthenelse{\value{@toclevel} = 1}{ + \section*{\correctionstyle\correctionname} + \ifthenelse{\boolean{notoc}}{}{ + \addcontentsline{toc}{section}{\correctionname}} + \setcounter{exercise}{0} + }{\ifthenelse{\value{@toclevel} = 2}{% + \subsection*{\correctionstyle\correctionname} + \ifthenelse{\boolean{notoc}}{}{ + \addcontentsline{toc}{subsection}{\correctionname}} + \setcounter{subpart}{0} + }{\ifthenelse{\value{@toclevel} = 3}{% + \subsubsection*{\correctionstyle\correctionname} + \ifthenelse{\boolean{notoc}}{}{ + \addcontentsline{toc}{subsubsection}{ + \correctionname}} + }{\par\textbf{\correctionstyle\correctionname}\par + }% + }% + }% + \correctionstyle% + }{}% + }{\comment} +}{\ifthenelse{\boolean{answers}}{}{\endcomment}} + +\newenvironment{answers*}{\ifthenelse{\boolean{answers}}{}{\comment}}% + {\ifthenelse{\boolean{answers}}{}{\endcomment}} + +\newcommand{\question}[2]{% + \ifthenelse{\boolean{questions}}{#1}{} + \bgroup + \ifthenelse{\boolean{answers}}{ + \ifthenelse{\boolean{questions}}{ + \ifx#2\empty\else + \par\correctionstyle\textbf{\correctionname}\par + \fi + }{} + #2}{} + \egroup + } + +\let\@oldpoints\points +\renewcommand*{\points}[1]{% + \ifthenelse{\boolean{questions}}{\@oldpoints{#1}}{}} + +\newboolean{marginpts} +\newcommand*{\pointmark}[1]{% + \ifthenelse{\lengthtest{#1 cm < 2cm}}{#1 \ptname}{#1 \ptsname}} +\newcommand{\ptsstyle}[1]{% + \footnotesize\centering\sffamily\color{ptscolor} (#1)} +\newcommand*{\pts}[1]{% + \ifthenelse{\boolean{marginpts}}{% + \mbox{}% + \marginpar{\hspace{0pt}% + \ptsstyle{\pointmark{#1}}}% + }{}% + \ignorespaces + } +\newcommand{\displaypts}{% + \reversemarginpar + \geometry{hmarginratio=3:2} + \setboolean{marginpts}{true} + } + +\newlength{\ptsboxlength} +\setlength{\ptsboxlength}{3.1em} +\cornersize{1} +\newcommand*{\totalexe}[1]{% + \ifthenelse{\boolean{marginpoints}}{% + \mbox{}% + \marginpar{\markingstyle{\ovalbox{% + \makebox[\ptsboxlength]{\pointmark{#1}}}% + }}% + }{}% + \ignorespaces + } + +\newboolean{marginpoints} +\newboolean{marginfullnotes} + +\newcommand{\markingstyle}[1]{\hspace{0pt}\footnotesize\sffamily% + \centering\color{markingcolor}\textbf{#1}} +\newcommand{\noteragged}{\raggedleft} +\newcommand{\notestyle}[1]{\hspace{0pt}\footnotesize\sffamily% + \noteragged\noindent\color{notecolor} #1} +\newcommand{\@note}[2][]{% + \ifthenelse{\boolean{marginpoints}}{% + \mbox{}% + \marginpar{% + \ifthenelse{\equal{#1}{}}{}{\markingstyle{#1}\\}% + \ifthenelse{\boolean{marginfullnotes}}{\notestyle #2}{}% + }% + }{}% + \ignorespaces + } +\newcommand{\@@note}[1]{% + \ifthenelse{\boolean{marginpoints}}{% + \mbox{}% + \marginpar{\markingstyle{#1}}% + }{}% + \ignorespaces + } +\newcommand{\note}{\@ifstar{\@@note}{\@note}} + +\newcommand{\displaypoints}{% + \reversemarginpar + \geometry{hmarginratio=3:2} + \setboolean{marginpoints}{true} + } + +\newcommand*{\displaynotes}[1][\raggedleft]{% + \reversemarginpar + \renewcommand{\noteragged}{#1} + \geometry{hmarginratio=5:1} + \setlength{\marginparwidth}{\oddsidemargin} + \addtolength{\marginparwidth}{1in} + \addtolength{\marginparwidth}{-\marginparsep} + \setlength{\marginparwidth}{0.8\marginparwidth} + \setboolean{marginpoints}{true} + \setboolean{marginfullnotes}{true} + } + +\newcommand*{\displaynotesright}[1][\raggedright]{% + \normalmarginpar + \renewcommand{\noteragged}{#1} + \geometry{hmarginratio=1:5} + \setlength{\marginparwidth}{\paperwidth} + \addtolength{\marginparwidth}{-\textwidth} + \addtolength{\marginparwidth}{-\oddsidemargin} + \addtolength{\marginparwidth}{-\marginparsep} + \addtolength{\marginparwidth}{-1in} + \setlength{\marginparwidth}{0.8\marginparwidth} + \setboolean{marginpoints}{true} + \setboolean{marginfullnotes}{true} + } +\newcommand{\totalpoints}{% + \ifthenelse{\boolean{marginpoints}}{\totalexe}{\points}} +\endinput +%% +%% End of file `exesheet.sty'. -- cgit v1.2.3