%% %% This is file `exsol.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% exsol.dtx (with options: `package') %% %% This is a generated file. %% %% Copyright (C) 2018 by Walter Daems %% %% 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} \ProvidesPackage{exsol} [2018/10/23 v1.4 ExSol - Exercises and Solutions package (DMW)] \RequirePackage{ifmtarg} \RequirePackage{fancyvrb} \RequirePackage{ifthen} \RequirePackage{kvoptions} \RequirePackage{multicol} \RequirePackage{varwidth} \DeclareBoolOption[false]{local} \DeclareBoolOption[false]{nolabels} \DeclareStringOption[normalsize]{exercisesfontsize} \DeclareBoolOption[false]{exerciseaslist} \DeclareBoolOption[false]{copyexercisesinsolutions} \DeclareBoolOption[false]{minipage} \DeclareBoolOption[false]{usesolutionserieslabels} \ProcessKeyvalOptions* \newcommand{\exercisesfontsize}{\csname \exsol@exercisesfontsize\endcsname} \newlength{\exsolexercisesaboveskip} \setlength{\exsolexercisesaboveskip}{0ex plus 1pt minus 1pt} \addtolength{\exsolexercisesaboveskip}{-2\baselineskip} \newlength{\exsolexercisesbelowskip} \setlength{\exsolexercisesbelowskip}{0ex plus 1pt minus 1pt} \addtolength{\exsolexercisesbelowskip}{\baselineskip} \newlength{\exsolexercisetopbottomsep} \setlength{\exsolexercisetopbottomsep}{0pt plus 0pt minus 1pt} \newlength{\exsolexerciseleftmargin} \setlength{\exsolexerciseleftmargin}{1em} \newlength{\exsolexerciserightmargin} \setlength{\exsolexerciserightmargin}{1em} \newlength{\exsolexerciseparindent} \setlength{\exsolexerciseparindent}{0em} \newlength{\exsolexerciselabelsep} \setlength{\exsolexerciselabelsep}{0.5em} \newlength{\exsolexerciselabelwidth} \setlength{\exsolexerciselabelwidth}{0pt} \newlength{\exsolexerciseitemindent} \setlength{\exsolexerciseitemindent}{0pt} \newlength{\exsolexerciseparsep} \setlength{\exsolexerciseparsep}{\parskip} \AtBeginDocument{ \typeout{Writing solutions to solution file \jobname.sol.tex} \newwrite\solutionstream \immediate\openout\solutionstream=\jobname.sol.tex \typeout{Using intermediate exercise file \jobname.exc.tex} \newwrite\exercisestream \typeout{Writing formulae to formula collection file \jobname.fc.tex} \newwrite\formulacollectionstream \immediate\openout\formulacollectionstream=\jobname.fc.tex \typeout{Using intermediate formula file \jobname.for.tex} \newwrite\formulastream } \AtEndDocument{ \immediate\closeout\formulacollectionstream \immediate\closeout\solutionstream } \newcommand\loadSolutions{ \immediate\closeout\solutionstream \input{\jobname.sol.tex} } \newcounter{exerciseseries}[subsubsection] \setcounter{exerciseseries}{0} \renewcommand{\theexerciseseries}{\arabic{exerciseseries}} \newcounter{exercise}[exerciseseries] \setcounter{exercise}{0} \renewcommand{\theexercise}{% \ifexsol@local \arabic{exerciseseries}.\arabic{exercise}% \else \@ifundefined{c@chapter}{}{\if0\arabic{chapter}\else\arabic{chapter}.\fi}% \if0\arabic{section}\else\arabic{section}\fi% \if0\arabic{subsection}\else.\arabic{subsection}\fi% \if0\arabic{subsubsection}\else.\arabic{subsubsection}\fi% \if0\arabic{exercise}\else% \@ifundefined{c@chapter}% {\if0\arabic{section}\else-\fi}% {-}% \arabic{exercise}% \fi \fi } \newcommand{\GPES@write@detok}[1]{% \immediate\write\exercisestream{\detokenize{#1}}}% \newcommand{\GPSS@write@detok}[1]{% \immediate\write\solutionstream{\detokenize{#1}}}% \newcommand{\GPESS@write@detok}[1]{% \GPES@write@detok{#1}% \GPSS@write@detok{#1}}% \newcommand{\GPFORCOL@write@detok}[1]{% \immediate\write\formulacollectionstream{\detokenize{#1}}% \immediate\write\formulastream{\detokenize{#1}}}% \newcommand{\GPFORCOLONLY@write@detok}[1]{% \immediate\write\formulacollectionstream{\detokenize{#1}}}% \def\exercise{\FV@Environment{}{exercise}} \def\FVB@exercise{% \refstepcounter{exercise}% \immediate\openout\exercisestream=\jobname.exc.tex \ifexsol@local \else \fi \ifexsol@copyexercisesinsolutions % WDSC tofix % \typeout{Writing exercise to \jobname.sol.tex} \immediate\write\solutionstream{\string\begin{exsol@exercise}{\theexercise}} \fi \immediate\write\exercisestream{\string\begin{exsol@exercise}{\theexercise}} \@bsphack \begingroup \FV@UseKeyValues \FV@DefineWhiteSpace \def\FV@Space{\space}% \FV@DefineTabOut \ifexsol@copyexercisesinsolutions \let\FV@ProcessLine\GPESS@write@detok % \else \let\FV@ProcessLine\GPES@write@detok % \fi \relax \let\FV@FontScanPrep\relax \let\@noligs\relax \FV@Scan } \def\FVE@exercise{ \endgroup\@esphack \immediate\write\exercisestream{\string\end{exsol@exercise}} \ifexsol@copyexercisesinsolutions \immediate\write\solutionstream{\string\end{exsol@exercise}} \fi \immediate\closeout\exercisestream \input{\jobname.exc.tex} } \DefineVerbatimEnvironment{exercise}{exercise}{} \newenvironment{exsol@exercise}[1] {% \ifthenelse{\boolean{exsol@minipage}}{\begin{minipage}[t]{\textwidth}}{}% \ifthenelse{\boolean{exsol@exerciseaslist}} { \begin{list}% {} {% \setlength{\topsep}{\exsolexercisetopbottomsep}% \setlength{\leftmargin}{\exsolexerciseleftmargin}% \setlength{\rightmargin}{\exsolexerciserightmargin}% \setlength{\listparindent}{\exsolexerciseparindent}% \setlength{\itemindent}{\exsolexerciseitemindent}% \setlength{\parsep}{\exsolexerciseparsep} \setlength{\labelsep}{\exsolexerciselabelsep} \setlength{\labelwidth}{\exsolexerciselabelwidth}} \item[\ifexsol@nolabels~#1:\else\exercisename{}~#1:\fi]% } {\ifexsol@nolabels #1:\else% \subparagraph{\exercisename{}~#1:}\fi} } {% \ifthenelse{\boolean{exsol@exerciseaslist}}% {\end{list}}{}% \ifthenelse{\boolean{exsol@minipage}}{\end{minipage}}{\par}% } \def\solution{\FV@Environment{}{solution}} \def\FVB@solution{% %\typeout{Writing solution to \jobname.sol.tex} \ifexsol@copyexercisesinsolutions \immediate\write\solutionstream{\string\begin{exsol@solution}{}} \else \immediate\write\solutionstream{\string\begin{exsol@solution}{\theexercise}} \fi \@bsphack \begingroup \FV@UseKeyValues \FV@DefineWhiteSpace \def\FV@Space{\space}% \FV@DefineTabOut \let\FV@ProcessLine\GPSS@write@detok % \relax \let\FV@FontScanPrep\relax \let\@noligs\relax \FV@Scan } \def\FVE@solution{ \endgroup\@esphack \immediate\write\solutionstream{\string\end{exsol@solution}} } \DefineVerbatimEnvironment{solution}{solution}{} \newenvironment{exsol@solution}[1] {% \ifthenelse{\boolean{exsol@minipage}}{\begin{minipage}[t]{\textwidth}}{}% \ifthenelse{\boolean{exsol@exerciseaslist}} {\begin{list}% {% }% {% \setlength{\topsep}{\exsolexercisetopbottomsep}% \setlength{\leftmargin}{\exsolexerciseleftmargin}% \setlength{\rightmargin}{\exsolexerciserightmargin}% \setlength{\listparindent}{\exsolexerciseparindent}% \setlength{\itemindent}{\exsolexerciseitemindent}% \setlength{\parsep}{\exsolexerciseparsep} \setlength{\labelsep}{\exsolexerciselabelsep} \setlength{\labelwidth}{\exsolexerciselabelwidth}} \item[\ifexsol@nolabels #1:\else% \solutionname{}\@ifmtarg{#1}{}{~}#1:\fi] }% {\ifexsol@nolabels #1:\else% \subparagraph{\solutionname{}\@ifmtarg{#1}{}{~}#1:}\fi} } {% \ifthenelse{\boolean{exsol@exerciseaslist}}% {\end{list}}{}% \ifthenelse{\boolean{exsol@minipage}}{\end{minipage}}{\par}% } \define@key{exercises}{columns}{\renewcommand\columncount{#1}} \define@key{exercises}{exsubrule}{\renewcommand\exsubrule{#1}} \define@key{exercises}{solsubrule}{\renewcommand\solsubrule{#1}} \define@key{exercises}{subrule}{\renewcommand\exsubrule{#1}\renewcommand\solsubrule{#1}} \newenvironment{exercises}[1][] {% \newcommand\columncount{1}% default \newcommand\exsubrule{}% default \newcommand\solsubrule{}% default \setkeys{exercises}{#1}% \exercisesfontsize\rule{.25\linewidth}{0.15mm}% \vspace*{-1.5\baselineskip}% \paragraph{\exercisesname}~\\* \ifthenelse{\columncount > 1}{\begin{multicols}{\columncount}}{}% }% { \ifthenelse{\columncount > 1}{\end{multicols}}{}\relax% \vspace*{-\baselineskip}\vspace*{\exsolexercisesbelowskip}% \exsubrule\par} \define@key{exerciseseries}{columns}{\renewcommand\columncount{#1}} \define@key{exerciseseries}{exsubrule}{\renewcommand\exsubrule{#1}} \define@key{exerciseseries}{solsubrule}{\renewcommand\solsubrule{#1}} \define@key{exerciseseries}{subrule}{\renewcommand\exsubrule{#1}\renewcommand\solsubrule{#1}} \newenvironment{exerciseseries}[2][] { \refstepcounter{exerciseseries}% \newcommand\columncount{1} % default \newcommand\exsubrule{} % default \newcommand\solsubrule{} % default \setkeys{exerciseseries}{#1}% \paragraph{\seriesname~\theexerciseseries:~#2}~\par \ifthenelse{\columncount > 1}{\begin{multicols}{\columncount}}{} \immediate\write\solutionstream{\string\begin\string{solutionseries\string}% \string[#1\string]\string{#2\string}\string{\theexerciseseries\string}} } { \ifthenelse{\columncount > 1}{\end{multicols}}{}\relax \exsubrule\par \immediate\write\solutionstream{\string\end\string{solutionseries\string}} } \newenvironment{solutionseries}[3][] { \newcommand\columncount{1} % default \newcommand\exsubrule{} % default \newcommand\solsubrule{} % default \setkeys{exercises}{#1}% \paragraph{\seriesname~#3\ifexsol@usesolutionserieslabels: #2\fi}~\par \ifthenelse{\columncount > 1}{\begin{multicols}{\columncount}}{} } { \ifthenelse{\columncount > 1}{\end{multicols}}{} \solsubrule\par } \def\informulacollection{\FV@Environment{}{informulacollection}} \def\FVB@informulacollection{% \immediate\openout\formulastream=\jobname.for.tex %\typeout{Writing formula to \jobname.for.tex and \jobname.fc.tex} \@bsphack \begingroup \FV@UseKeyValues \FV@DefineWhiteSpace \def\FV@Space{\space}% \FV@DefineTabOut \let\FV@ProcessLine\GPFORCOL@write@detok % \relax \let\FV@FontScanPrep\relax \let\@noligs\relax \FV@Scan } \def\FVE@informulacollection{ \endgroup\@esphack \immediate\closeout\formulastream \input{\jobname.for.tex} } \DefineVerbatimEnvironment{informulacollection}{informulacollection}{} \def\informulacollectiononly{\FV@Environment{}{informulacollectiononly}} \def\FVB@informulacollectiononly{% %\typeout{Writing special to \jobname.fc.tex} \@bsphack \begingroup \FV@UseKeyValues \FV@DefineWhiteSpace \def\FV@Space{\space}% \FV@DefineTabOut \let\FV@ProcessLine\GPFORCOLONLY@write@detok % \relax \let\FV@FontScanPrep\relax \let\@noligs\relax \FV@Scan } \def\FVE@informulacollectiononly{ \endgroup\@esphack } \DefineVerbatimEnvironment{informulacollectiononly}{informulacollectiononly}{} \newcommand{\exercisename}{Exercise} \newcommand{\exercisesname}{Exercises} \newcommand{\solutionname}{Solution} \newcommand{\solutionsname}{Solutions} \newcommand{\seriesname}{Series} \addto\captionsdutch{% \renewcommand{\exercisename}{Oefening}% \renewcommand{\exercisesname}{Oefeningen}% \renewcommand{\solutionname}{Oplossing}% \renewcommand{\solutionsname}{Oplossingen}% \renewcommand{\seriesname}{Reeks}% } \addto\captionsgerman{% \renewcommand{\exercisename}{Aufgabe}% \renewcommand{\exercisesname}{Aufgaben}% \renewcommand{\solutionname}{L\"osung}% \renewcommand{\solutionsname}{L\"osungen}% \renewcommand{\seriesname}{Serie}% } \addto\captionsngerman{% \renewcommand{\exercisename}{Aufgabe}% \renewcommand{\exercisesname}{Aufgaben}% \renewcommand{\solutionname}{L\"osung}% \renewcommand{\solutionsname}{L\"osungen}% \renewcommand{\seriesname}{Serie}% } \addto\captionsfrench{% \renewcommand{\exercisename}{Exercice}% \renewcommand{\exercisesname}{Exercices}% \renewcommand{\solutionname}{Solution}% \renewcommand{\solutionsname}{Solutions}% \renewcommand{\seriesname}{Serie}% } \addto\captionsfinnish{ \renewcommand{\exercisename}{Teht\"av\"a}% \renewcommand{\exercisesname}{Teht\"avi\"a}% \renewcommand{\solutionname}{Ratkaisu}% \renewcommand{\solutionsname}{Ratkaisut}% \renewcommand{\seriesname}{Sarja} } \addto\captionsspanish{% \renewcommand{\exercisename}{Ejercicio}% \renewcommand{\exercisesname}{Ejercicios}% \renewcommand{\solutionname}{Soluci\'on}% \renewcommand{\solutionsname}{Soluciones}% \renewcommand{\seriesname}{Serie}% } \newif\ifnoexinchapter \noexinchapterfalse \ifexsol@local \else \let\exsol@@makechapterhead\@makechapterhead \def\@makechapterhead#1{% \exsol@@makechapterhead{#1} \ifnoexinchapter \noexinchapterfalse \else \addtocounter{chapter}{-1} \immediate\write\solutionstream{\string\setcounter{chapter}{\arabic{chapter}}% \string\chapter{#1}}% \addtocounter{chapter}{1} \fi } \ifdefined\frontmatter \let\exsol@@frontmatter\frontmatter \def\frontmatter{% \immediate\write\solutionstream{\string\frontmatter}% \exsol@@frontmatter } \fi \ifdefined\frontmatter \let\exsol@@mainmatter\mainmatter \def\mainmatter{% \immediate\write\solutionstream{\string\mainmatter}% \exsol@@mainmatter } \fi \ifdefined\backmatter \let\exsol@@backmatter\backmatter \def\backmatter{% \immediate\write\solutionstream{\string\backmatter}% \exsol@@backmatter } \fi \ifdefined\appendix \let\exsol@@appendix\appendix \def\appendix{% \immediate\write\solutionstream{\string\appendix}% \exsol@@appendix } \fi \fi \newcommand{\noexercisesinnextchapter} { \noexinchaptertrue } \newcommand{\noexercisesinchapter} { \immediate\write\solutionstream{No exercises in this chapter} } \endinput %% %% End of file `exsol.sty'.