diff options
author | Karl Berry <karl@freefriends.org> | 2019-01-21 21:40:19 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-01-21 21:40:19 +0000 |
commit | 9ef6d833e539e213797d7239c2f0332fcef1af95 (patch) | |
tree | ea7a03891dc1142225fce98617d6b4579ef05236 | |
parent | 7bd3a0a148d29159ab650662a64a32d273972a7f (diff) |
exframe (21jan19)
git-svn-id: svn://tug.org/texlive/trunk@49784 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/exframe/README.txt | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/exframe/exframe.pdf | bin | 346156 -> 346998 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/exframe/exfsmp1.tex | 2 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/exframe/exframe.dtx | 281 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/exframe/exframe.sty | 142 |
5 files changed, 257 insertions, 170 deletions
diff --git a/Master/texmf-dist/doc/latex/exframe/README.txt b/Master/texmf-dist/doc/latex/exframe/README.txt index 3db12e1f300..eeab14b5caf 100644 --- a/Master/texmf-dist/doc/latex/exframe/README.txt +++ b/Master/texmf-dist/doc/latex/exframe/README.txt @@ -1,4 +1,4 @@ -exframe v3.0 +exframe v3.1 Copyright 2011-2019 Niklas Beisert exframe is a LaTeX2e package which provides a general purpose diff --git a/Master/texmf-dist/doc/latex/exframe/exframe.pdf b/Master/texmf-dist/doc/latex/exframe/exframe.pdf Binary files differindex 9da7188b572..d6ea6502f41 100644 --- a/Master/texmf-dist/doc/latex/exframe/exframe.pdf +++ b/Master/texmf-dist/doc/latex/exframe/exframe.pdf diff --git a/Master/texmf-dist/doc/latex/exframe/exfsmp1.tex b/Master/texmf-dist/doc/latex/exframe/exfsmp1.tex index 7326930d603..015ed7fbc24 100644 --- a/Master/texmf-dist/doc/latex/exframe/exfsmp1.tex +++ b/Master/texmf-dist/doc/latex/exframe/exfsmp1.tex @@ -17,7 +17,7 @@ %% version 2005/12/01 or later. %% \NeedsTeXFormat{LaTeX2e}[1996/12/01] -\ProvidesFile{exfsmp1.tex}[2019/01/16 v3.0 sample 1 for exframe] +\ProvidesFile{exfsmp1.tex}[2019/01/21 v3.1 sample 1 for exframe] \documentclass[12pt]{article} \usepackage{geometry} diff --git a/Master/texmf-dist/source/latex/exframe/exframe.dtx b/Master/texmf-dist/source/latex/exframe/exframe.dtx index 4bfa73d693e..43557d40939 100644 --- a/Master/texmf-dist/source/latex/exframe/exframe.dtx +++ b/Master/texmf-dist/source/latex/exframe/exframe.dtx @@ -18,10 +18,10 @@ % and the derived files exframe.sty and exfsmp1.tex. % %<package|sample1>\NeedsTeXFormat{LaTeX2e}[1996/12/01] -%<package>\ProvidesPackage{exframe}[2019/01/16 v3.0 Framework for Exercise Problems] -%<sample1>\ProvidesFile{exfsmp1.tex}[2019/01/16 v3.0 sample 1 for exframe] +%<package>\ProvidesPackage{exframe}[2019/01/21 v3.1 Framework for Exercise Problems] +%<sample1>\ProvidesFile{exfsmp1.tex}[2019/01/21 v3.1 sample 1 for exframe] %<*driver> -\def\thedate#1{2019/01/16}\def\theversion#1{v3.0} +\def\thedate#1{2019/01/21}\def\theversion#1{v3.1} \ProvidesFile{exframe.dtx}[\thedate{} \theversion{} exframe reference manual file] \PassOptionsToClass{10pt,a4paper}{article} \documentclass{ltxdoc} @@ -323,10 +323,12 @@ problem (|problem|) or sheet (|sheet|) or display them at a manually chosen location (|manual|). Note that typically solutions are defined at the end of a (sub)problem and therefore the choice |here| is similar to (|sub|)|problem|. -The latter form, however, makes sure that a solution is positioned -\emph{after} the (sub)problem block -such that it does not inherit the layout (e.g.\ indentation) -of the latter even if it is defined within this block. +The latter form, however, makes sure that a solution +does not inherit the margin of the parent block. +The alternate modes |problem*| and |subproblem*| +positions the solution \emph{after} the (sub)problem block +such that it does not inherit any layout, +but also the no definitions made in the parent block. In |manual| mode, all solutions are collected (with appropriate headers) until they are output by the directive |\insertsolutions|. If no solutions are stored in the buffer @@ -1043,7 +1045,7 @@ and returns it followed by a dot. \DescribeMacro{\exerciseifempty} \DescribeMacro{\exerciseifnotempty} Handy conditionals command to check -whether an expression \textit{expr} is empty (or pure whitespace) is: +whether an expression \textit{expr} is empty are: % \begin{center} \begin{tabular}{l} @@ -1083,7 +1085,8 @@ The package defines a couple of standard styles: % \begin{itemize} \item |solutionbelow=|\textit{pos} -(can take values |here|, |subproblem|, |problem|, |sheet| and |manual|; +(can take values |here|, |subproblem|, |subproblem*|, |problem|, |problem*|, +|sheet| and |manual|; initially set to |subproblem|) -- positions the solutions below the indicated blocks; see \secref{sec:solutions} for details. @@ -1114,7 +1117,10 @@ with the prefix \textit{counter}. number problems by sheet. \item |equationbysheet| -- -number equations by sheet. +number dedicated equations for sheets, problems and solutions by sheet; +note that the main equation counter is unaffected by this setting, +it therefore makes sense to also activate the style |sheetequation| +or use |\counterwithin{equation}{sheet}|. \item |pagebysheet| -- number pages by sheet and denote pages by \textit{sheet}|.|\textit{page}; @@ -1517,6 +1523,18 @@ Define structures for multiple-choice questions. \subsection{Revision History} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\paragraph{v3.1:} 2019/01/21 + +\begin{itemize} +\item +alternate placement modes for solutions +\item +fixed expansion of problem title +\item +reset font size for problem text +\end{itemize} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \paragraph{v3.0:} 2019/01/16 \begin{itemize} @@ -2231,7 +2249,7 @@ This is beyond the scope of this example. % % Basic style for all exercise text: % \begin{macrocode} -\exerciseconfig{styletext}{\normalfont} +\exerciseconfig{styletext}{\normalsize\normalfont} % \end{macrocode} % Style for problems: % \begin{macrocode} @@ -2385,6 +2403,11 @@ This is beyond the scope of this example. % \begin{macrocode} \exerciseconfig{insertproblemafter}{} % \end{macrocode} +% Code to insert between a problem and its solution +% (if style |solutionbelow| is |problem|): +% \begin{macrocode} +\exerciseconfig{insertproblemsolution}{} +% \end{macrocode} % Code to insert text into the problem opening line % by means of |\addprobleminfo|: % \begin{macrocode} @@ -2395,6 +2418,7 @@ This is beyond the scope of this example. \exerciseconfig{insertsubproblembefore}{} \exerciseconfig{insertsubproblemafter}{} \exerciseconfig{insertsubprobleminfo}{} +\exerciseconfig{insertsubproblemsolution}{} % \end{macrocode} % Analogous definitions for solutions: % \begin{macrocode} @@ -2664,7 +2688,8 @@ This is beyond the scope of this example. % \begin{macrocode} \def\exf@solutionbelow{subproblem} \define@choicekey{exf@style}{solutionbelow}% - {here,subproblem,problem,sheet,manual}{\def\exf@solutionbelow{#1}} + {here,subproblem,subproblem*,problem,problem*,sheet,manual}% + {\def\exf@solutionbelow{#1}} % \end{macrocode} % Conditionals to compare solution locations: % \begin{macrocode} @@ -2965,8 +2990,14 @@ This is beyond the scope of this example. % \end{macrocode} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% \paragraph{Problem Info Code.} +% \paragraph{Problem Block Code.} % +% \macro{\exf@addmargin} +% Define a length for block margin: +% \begin{macrocode} +\newlength\exf@addmargin +% \end{macrocode} + % \macro{\exf@section} % Write out problem opening line followed by some amount of skip % (positive dimensions add vertical space, @@ -2984,11 +3015,12 @@ This is beyond the scope of this example. \exf@exparg{\@startsection{}{}{0pt}{0pt}{#1}{}*}{\exf@tmp}} % \end{macrocode} -% \macro{\exf@init@intro} +% \macro{\exf@init@block} % Clean info buffer, define amount of skip between items: % \begin{macrocode} -\newcommand{\exf@init@intro}[1]% - {\def\exf@intro{}\def\exf@introitem{}\def\exf@intro@skip{#1}} +\newcommand{\exf@init@block}[1]{% + \def\exf@intro{}\def\exf@intro@skip{#1}% + \exf@addmargin0pt\def\exf@introitem{}} % \end{macrocode} % \macro{\exf@append@intro} % Append to info buffer: @@ -3002,16 +3034,27 @@ This is beyond the scope of this example. \newcommand{\exf@prepend@intro}[1]% {\exf@prepend@def\exf@intro{#1\hspace{\exf@intro@skip}}} % \end{macrocode} -% \macro{\exf@write@intro} -% Compose opening line: +% \macro{\exf@open@block} +% Open block, set margin, compose opening line: % \begin{macrocode} -\newcommand{\exf@write@intro}[1]{% +\newcommand{\exf@open@block}[1]{% + \advance\leftskip\exf@addmargin% + \advance\linewidth-\exf@addmargin% + \advance\@totalleftmargin\exf@addmargin% \ifx\exf@intro\exf@empty% \exf@section{0pt}{\exf@introitem}% \else% \exf@section{#1}{\exf@introitem\exf@intro\unskip}% \fi}% % \end{macrocode} +% \macro{\exf@close@block} +% Close block, undo margin: +% \begin{macrocode} +\newcommand{\exf@close@block}{% + \advance\leftskip-\exf@addmargin% + \advance\linewidth\exf@addmargin% + \advance\@totalleftmargin-\exf@addmargin}% +% \end{macrocode} % \macro{\addprobleminfo} % Interface to append or prepend to info buffer: @@ -3675,12 +3718,6 @@ This is beyond the scope of this example. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \paragraph{Problems.} % -% \macro{\ifexf@problem@solnewsec} -% Conditional to mark whether problem has been encountered: -% \begin{macrocode} -\newif\ifexf@problem@solnewsec\exf@problem@solnewsectrue -% \end{macrocode} - % \macro{exf@problem} % Define options for |problem| environment: % \begin{macrocode} @@ -3695,16 +3732,22 @@ This is beyond the scope of this example. % \begin{macrocode} \newenvironment{\exf@problemname}[1][]{% % \end{macrocode} -% Start with new paragraph, set text style, add vspace and step counter: +% Start with new paragraph, set text style, add vspace: +% \begin{macrocode} + \par\exf@config@styletext\addvspace{\exf@config@skipproblemabove}% +% \end{macrocode} +% Step problem counter: % \begin{macrocode} - \par\exf@config@styletext% - \addvspace{\exf@config@skipproblemabove}% \refstepcounter{\exf@problemcounter}% % \end{macrocode} -% Insert hook code, remember that a new problem was encountered: +% Insert hook code: % \begin{macrocode} \exf@config@insertproblembefore% - \global\exf@problem@solnewsectrue% +% \end{macrocode} +% Begin inner group, mark in problem: +% \begin{macrocode} + \begingroup% + \def\exf@in@problem{}% % \end{macrocode} % Use equation counter for problems: % \begin{macrocode} @@ -3715,12 +3758,9 @@ This is beyond the scope of this example. \let\theHequation\theHexf@problemequation% \fi% % \end{macrocode} -% Start a block, mark in problem, initialise variables, -% process arguments: +% Initialise variables, process arguments: % \begin{macrocode} - \begingroup% - \def\exf@in@problem{}% - \exf@init@intro{\exf@config@skipprobleminfo}% + \exf@init@block{\exf@config@skipprobleminfo}% \def\problemtag{\csname the\exf@problemcounter\endcsname}% \let\exf@points@given\@undefined% \let\exf@label\@undefined% @@ -3733,8 +3773,9 @@ This is beyond the scope of this example. \ifexf@autolabelproblem\label{\exf@config@labelproblem{\problemtag}}\fi% \ifdefined\exf@label\label{\exf@label}\fi% % \end{macrocode} -% Remember problem counter, title for solutions: +% Mark for new solution section; remember problem counter, title: % \begin{macrocode} + \gdef\exf@problem@solnewsec{}% \xdef\exf@prevprob{\csname the\exf@problemcounter\endcsname}% \ifcsname theH\exf@problemcounter\endcsname% \xdef\exf@prevprobhref{\exf@problemcounter.% @@ -3743,7 +3784,8 @@ This is beyond the scope of this example. \ifx\exf@data@problem@rawtitle\exf@empty% \global\let\exf@prevprobtitle\@undefined% \else% - \xdef\exf@prevprobtitle{\exf@data@problem@rawtitle}\fi% + \protected@xdef\exf@prevprobtitle{\exf@data@problem@rawtitle}% + \fi% \global\let\exf@prevsubprob\@undefined% \global\let\exf@prevsubprobhref\@undefined% % \end{macrocode} @@ -3795,20 +3837,14 @@ This is beyond the scope of this example. % \begin{macrocode} \else% \ifdim\exf@config@skipproblemitem>0pt% - \setlength\exf@tmpdim{\exf@config@skipproblemitem}% + \setlength\exf@addmargin{\exf@config@skipproblemitem}% \else% - \settowidth\exf@tmpdim{% + \settowidth\exf@addmargin{% \exf@config@styletitle\exf@config@styletitleproblem% \exf@config@composeitemproblem{\exf@config@counterproblemmax}% \exf@config@composeitemproblemsep}% \fi% % \end{macrocode} -% Set up indentation: -% \begin{macrocode} - \advance\leftskip\exf@tmpdim% - \advance\linewidth -\exf@tmpdim% - \advance\@totalleftmargin\exf@tmpdim% -% \end{macrocode} % Define item label: % \begin{macrocode} \def\exf@introitem{\makebox[0cm][r]{% @@ -3837,7 +3873,7 @@ This is beyond the scope of this example. % \end{macrocode} % Write out opening line: % \begin{macrocode} - \exf@write@intro{\exf@config@skipproblemtitle}% + \exf@open@block{\exf@config@skipproblemtitle}% % \end{macrocode} % Add table of contents line: % \begin{macrocode} @@ -3898,22 +3934,21 @@ This is beyond the scope of this example. \PackageWarning{exframe}{no points defined for \exf@problemname}% \fi\fi% % \end{macrocode} -% End paragraph, insert hook code, vertical skip: +% Solutions to subproblems must be declared within problem block: % \begin{macrocode} - \par\endgroup% - \exf@config@insertproblemafter% - \addvspace{\exf@config@skipproblembelow}% + \global\let\exf@prevsubprob\@undefined% + \global\let\exf@prevsubprobhref\@undefined% +% \end{macrocode} +% End paragraph and block: +% \begin{macrocode} + \par\exf@close@block% % \end{macrocode} % Display solution if desired: % \begin{macrocode} \exf@solbelowis{problem}{% + \exf@config@insertproblemsolution% \exf@showsolutions{\exf@config@composetitlesolutionmulti}{}}% % \end{macrocode} -% Solutions to subproblems should be declared within problem block: -% \begin{macrocode} - \global\let\exf@prevsubprob\@undefined% - \global\let\exf@prevsubprobhref\@undefined% -% \end{macrocode} % Restore original equation counter: % \begin{macrocode} \ifexf@style@problemequation% @@ -3921,6 +3956,20 @@ This is beyond the scope of this example. \setcounter{equation}{\exf@eqsav}% \fi% % \end{macrocode} +% End inner group: +% \begin{macrocode} + \endgroup% +% \end{macrocode} +% Insert hook code, vertical skip: +% \begin{macrocode} + \exf@config@insertproblemafter% + \addvspace{\exf@config@skipproblembelow}% +% \end{macrocode} +% Display solution if desired: +% \begin{macrocode} + \exf@solbelowis{problem*}{% + \exf@showsolutions{\exf@config@composetitlesolutionmulti}{}}% +% \end{macrocode} % Done: % \begin{macrocode} \ignorespacesafterend} @@ -3943,28 +3992,21 @@ This is beyond the scope of this example. % \end{macrocode} % Start with new paragraph, set text style, add vspace and step counter: % \begin{macrocode} - \par% - {\exf@config@styletext\addvspace{\exf@config@skipsubproblemabove}}% + \par{\exf@config@styletext\addvspace{\exf@config@skipsubproblemabove}}% \refstepcounter{\exf@subproblemcounter}% % \end{macrocode} % Insert hook code: % \begin{macrocode} \exf@config@insertsubproblembefore% % \end{macrocode} -% Remember subproblem counter for solution: -% \begin{macrocode} - \xdef\exf@prevsubprob{\csname the\exf@subproblemcounter\endcsname}% - \ifcsname theH\exf@subproblemcounter\endcsname% - \xdef\exf@prevsubprobhref{\exf@subproblemcounter.% - \csname theH\exf@subproblemcounter\endcsname}% - \fi% -% \end{macrocode} -% Start a block, mark in subproblem, initialise variables, -% process arguments: +% Start inner group, mark in subproblem: % \begin{macrocode} \begingroup% \def\exf@in@subproblem{}% - \exf@init@intro{\exf@config@skipsubprobleminfo}% +% \end{macrocode} +% Initialise variables, process arguments: +% \begin{macrocode} + \exf@init@block{\exf@config@skipsubprobleminfo}% \let\exf@subproblem@points\@undefined% \let\exf@label\@undefined% \setkeys{exf@subproblem,exf@probleminfo}{#1}% @@ -3973,6 +4015,14 @@ This is beyond the scope of this example. % \begin{macrocode} \ifdefined\exf@label\label{\exf@label}\fi% % \end{macrocode} +% Remember subproblem counter for solution: +% \begin{macrocode} + \xdef\exf@prevsubprob{\csname the\exf@subproblemcounter\endcsname}% + \ifcsname theH\exf@subproblemcounter\endcsname% + \xdef\exf@prevsubprobhref{\exf@subproblemcounter.% + \csname theH\exf@subproblemcounter\endcsname}% + \fi% +% \end{macrocode} % Add given points to problem total: % \begin{macrocode} \ifdefined\exf@subproblem@points% @@ -4019,20 +4069,14 @@ This is beyond the scope of this example. % \begin{macrocode} \else% \ifdim\exf@config@skipsubproblemitem>0pt% - \setlength\exf@tmpdim{\exf@config@skipsubproblemitem}% + \setlength\exf@addmargin{\exf@config@skipsubproblemitem}% \else% - \settowidth\exf@tmpdim{% + \settowidth\exf@addmargin{% \exf@config@styletitle\exf@config@styletitlesubproblem% \exf@config@composeitemsubproblem{\exf@config@countersubproblemmax}% \exf@config@composeitemsubproblemsep}% \fi% % \end{macrocode} -% Set up indentation: -% \begin{macrocode} - \advance\leftskip\exf@tmpdim% - \advance\linewidth -\exf@tmpdim% - \advance\@totalleftmargin\exf@tmpdim% -% \end{macrocode} % Define item label: % \begin{macrocode} \def\exf@introitem{\makebox[0cm][r]{% @@ -4054,26 +4098,39 @@ This is beyond the scope of this example. % \end{macrocode} % Write out opening line: % \begin{macrocode} - \exf@write@intro{\exf@config@skipsubproblemtitle}% + \exf@open@block{\exf@config@skipsubproblemtitle}% % \end{macrocode} % Done: % \begin{macrocode} \@afterindentfalse}% % \end{macrocode} -% End environment, show points if desired, end paragraph: +% End environment, show points if desired: % \begin{macrocode} {\exf@subpointsatis{end}{\showpoints}% - \par\endgroup% % \end{macrocode} -% Vertical skip, insert hook code: +% End paragraph and block: +% \begin{macrocode} + \par\exf@close@block% +% \end{macrocode} +% Display solution if desired: +% \begin{macrocode} + \exf@solbelowis{subproblem*}{% + \exf@config@insertsubproblemsolution% + \exf@showsolutions{\exf@config@composetitlesolutionsingle}{}}% +% \end{macrocode} +% End inner group: +% \begin{macrocode} + \endgroup% +% \end{macrocode} +% Insert hook code, vertical skip: % \begin{macrocode} - {\exf@config@styletext\addvspace{\exf@config@skipsubproblembelow}}% \exf@config@insertsubproblemafter% + {\exf@config@styletext\addvspace{\exf@config@skipsubproblembelow}}% % \end{macrocode} % Display solution if desired: % \begin{macrocode} - \exf@solbelowis{subproblem}{\exf@showsolutions% - {\exf@config@composetitlesolutionsingle}{}}% + \exf@solbelowis{subproblem}{% + \exf@showsolutions{\exf@config@composetitlesolutionsingle}{}}% % \end{macrocode} % Done: % \begin{macrocode} @@ -4103,10 +4160,12 @@ This is beyond the scope of this example. % \begin{macrocode} \newenvironment{printsolution}[1]{% % \end{macrocode} -% Start new paragraph, add vertical space, insert hook code: +% Start new paragraph, add vertical space: +% \begin{macrocode} + \par{\exf@config@styletext\addvspace{\exf@config@skipsolutionabove}}% +% \end{macrocode} +% Insert hook code: % \begin{macrocode} - \par% - {\exf@config@styletext\addvspace{\exf@config@skipsolutionabove}}% \exf@config@insertsolutionbefore% % \end{macrocode} % Use equation counter for solutions: @@ -4126,7 +4185,7 @@ This is beyond the scope of this example. \let\exf@label\@undefined% \setlength{\exf@solution@points@dim}{0pt}% \def\exf@solhref{}% - \exf@init@intro{\exf@config@skipsolutioninfo}% + \exf@init@block{\exf@config@skipsolutioninfo}% \setkeys{exf@solution,exf@probleminfo}{#1}% % \end{macrocode} % Set solution counter to reflect associated problem: @@ -4168,9 +4227,9 @@ This is beyond the scope of this example. % \begin{macrocode} \else% \ifdim\exf@tmp>0pt% - \setlength\exf@tmpdim{\exf@tmp}% + \setlength\exf@addmargin{\exf@tmp}% \else% - \settowidth\exf@tmpdim{% + \settowidth\exf@addmargin{% \exf@config@styletitle\exf@config@styletitlesolution% \ifx\exf@solsubprob\exf@empty% \exf@config@composeitemsolution{\exf@config@counterproblemmax}% @@ -4181,12 +4240,6 @@ This is beyond the scope of this example. \fi\exf@config@composeitemsolutionsep}% \fi% % \end{macrocode} -% Set up indentation: -% \begin{macrocode} - \advance\leftskip\exf@tmpdim% - \advance\linewidth -\exf@tmpdim% - \advance\@totalleftmargin\exf@tmpdim% -% \end{macrocode} % Set item label up depending on problem or subproblem: % \begin{macrocode} \ifx\exf@solsubprob\exf@empty% @@ -4208,7 +4261,7 @@ This is beyond the scope of this example. % \end{macrocode} % Write out opening line: % \begin{macrocode} - \exf@write@intro{\exf@config@skipsolutiontitle}% + \exf@open@block{\exf@config@skipsolutiontitle}% % \end{macrocode} % Done: % \begin{macrocode} @@ -4223,11 +4276,9 @@ This is beyond the scope of this example. {\strip@pt\exf@solution@points@dim}{\exf@solution@points}\fi% \fi\fi\fi% % \end{macrocode} -% End paragraph, vertical skip, insert hook code: +% End paragraph and block: % \begin{macrocode} - \par\endgroup% - {\exf@config@styletext\addvspace{\exf@config@skipsolutionbelow}}% - \exf@config@insertsolutionafter% + \par\exf@close@block% % \end{macrocode} % Restore original equation counter: % \begin{macrocode} @@ -4236,6 +4287,15 @@ This is beyond the scope of this example. \setcounter{equation}{\exf@eqsav}% \fi% % \end{macrocode} +% End inner group: +% \begin{macrocode} + \endgroup% +% \end{macrocode} +% Vertical skip, insert hook code: +% \begin{macrocode} + {\exf@config@styletext\addvspace{\exf@config@skipsolutionbelow}}% + \exf@config@insertsolutionafter% +% \end{macrocode} % Done: % \begin{macrocode} \ignorespacesafterend} @@ -4263,6 +4323,8 @@ This is beyond the scope of this example. {\exf@config@composetocsolution{\exf@solprob}{\exf@solprobtitle}}}% \exf@solbelowis{problem}{\let\exf@composetitle% \exf@config@composetitlesolutionsproblemsingle}% + \exf@solbelowis{problem*}{\let\exf@composetitle% + \exf@config@composetitlesolutionsproblemsingle}% % \end{macrocode} % Write section line: % \begin{macrocode} @@ -4299,19 +4361,20 @@ This is beyond the scope of this example. % If this is the first solution within a new section, % display section heading: % \begin{macrocode} - \ifexf@problem@solnewsec% + \ifdefined\exf@problem@solnewsec% \def\exf@probarg{\ifdefined\exf@prevprob prob={\exf@prevprob}\fi% \ifdefined\exf@prevprobtitle,probtitle={\exf@prevprobtitle}\fi% \ifdefined\exf@prevprobhref,href={\exf@prevprobhref}\fi% \ifdefined\exf@sollabel,label={\exf@sollabel}\fi}% \exf@solbelowis{here}{\let\exf@probarg\@undefined}% \exf@solbelowis{subproblem}{\let\exf@probarg\@undefined}% + \exf@solbelowis{subproblem*}{\let\exf@probarg\@undefined}% \ifdefined\exf@probarg% \ifexf@lineno\exf@addbufline{\exf@linesep}\exf@addbufline{\exf@lineno}\fi% \exf@addbufline{\@backslashchar solutionssection{\exf@probarg}}% \exf@addbufline{}% \fi% - \global\exf@problem@solnewsecfalse% + \global\let\exf@problem@solnewsec\@undefined% \fi% % \end{macrocode} % Write separator to buffer: @@ -4370,10 +4433,16 @@ This is beyond the scope of this example. % \begin{macrocode} \exf@solbelowis{here}{\exf@showsolutions% {\exf@config@composetitlesolutionsingle}{}}% - \exf@solbelowis{subproblem}{\ifdefined\exf@in@subproblem\else% - \exf@showsolutions{\exf@config@composetitlesolutionsingle}{}\fi}% - \exf@solbelowis{problem}{\ifdefined\exf@in@problem\else% - \exf@showsolutions{\exf@config@composetitlesolutionmulti}{}\fi}% + \ifdefined\exf@in@subproblem\else% + \exf@solbelowis{subproblem}{% + \exf@showsolutions{\exf@config@composetitlesolutionsingle}{}}% + \exf@solbelowis{subproblem*}{% + \exf@showsolutions{\exf@config@composetitlesolutionsingle}{}}\fi% + \ifdefined\exf@in@problem\else% + \exf@solbelowis{problem}{% + \exf@showsolutions{\exf@config@composetitlesolutionmulti}{}}% + \exf@solbelowis{problem*}{% + \exf@showsolutions{\exf@config@composetitlesolutionmulti}{}}\fi% % \end{macrocode} % Done: % \begin{macrocode} diff --git a/Master/texmf-dist/tex/latex/exframe/exframe.sty b/Master/texmf-dist/tex/latex/exframe/exframe.sty index 1bdd64b858a..037ad8d0833 100644 --- a/Master/texmf-dist/tex/latex/exframe/exframe.sty +++ b/Master/texmf-dist/tex/latex/exframe/exframe.sty @@ -17,7 +17,7 @@ %% version 2005/12/01 or later. %% \NeedsTeXFormat{LaTeX2e}[1996/12/01] -\ProvidesPackage{exframe}[2019/01/16 v3.0 Framework for Exercise Problems] +\ProvidesPackage{exframe}[2019/01/21 v3.1 Framework for Exercise Problems] \RequirePackage{verbatim} \RequirePackage{xkeyval} @@ -111,7 +111,7 @@ \exerciseconfig{termpoint}{point} \exerciseconfig{termpoints}{points} -\exerciseconfig{styletext}{\normalfont} +\exerciseconfig{styletext}{\normalsize\normalfont} \exerciseconfig{styletextproblem}{} \exerciseconfig{styletextsolution}{\footnotesize} \exerciseconfig{styletitle}{\bfseries} @@ -153,10 +153,12 @@ \exerciseconfig{insertsolutionsafter}{} \exerciseconfig{insertproblembefore}{} \exerciseconfig{insertproblemafter}{} +\exerciseconfig{insertproblemsolution}{} \exerciseconfig{insertprobleminfo}{} \exerciseconfig{insertsubproblembefore}{} \exerciseconfig{insertsubproblemafter}{} \exerciseconfig{insertsubprobleminfo}{} +\exerciseconfig{insertsubproblemsolution}{} \exerciseconfig{insertsolutionbefore}{} \exerciseconfig{insertsolutionafter}{} \exerciseconfig{insertsolutioninfo}{} @@ -249,7 +251,8 @@ \def\exf@solutionbelow{subproblem} \define@choicekey{exf@style}{solutionbelow}% - {here,subproblem,problem,sheet,manual}{\def\exf@solutionbelow{#1}} + {here,subproblem,subproblem*,problem,problem*,sheet,manual}% + {\def\exf@solutionbelow{#1}} \newcommand{\exf@solbelowis}[2]% {\def\exf@tmp{#1}\ifx\exf@solutionbelow\exf@tmp#2\fi} \defexercisestyle{sheetequation}{} @@ -384,6 +387,8 @@ \def\exf@data@problem@title{\exf@config@composetitleproblem{% \csname the\exf@problemcounter\endcsname}{\exf@data@problem@rawtitle}}% +\newlength\exf@addmargin + \newcommand{\exf@section}[2]{\setlength\exf@tmpdim{#1}% \ifdim\exf@tmpdim<0pt% \protected@edef\exf@tmp{#2}% @@ -392,18 +397,26 @@ \fi% \exf@exparg{\@startsection{}{}{0pt}{0pt}{#1}{}*}{\exf@tmp}} -\newcommand{\exf@init@intro}[1]% - {\def\exf@intro{}\def\exf@introitem{}\def\exf@intro@skip{#1}} +\newcommand{\exf@init@block}[1]{% + \def\exf@intro{}\def\exf@intro@skip{#1}% + \exf@addmargin0pt\def\exf@introitem{}} \newcommand{\exf@append@intro}[1]% {\exf@append@def\exf@intro{#1\hspace{\exf@intro@skip}}} \newcommand{\exf@prepend@intro}[1]% {\exf@prepend@def\exf@intro{#1\hspace{\exf@intro@skip}}} -\newcommand{\exf@write@intro}[1]{% +\newcommand{\exf@open@block}[1]{% + \advance\leftskip\exf@addmargin% + \advance\linewidth-\exf@addmargin% + \advance\@totalleftmargin\exf@addmargin% \ifx\exf@intro\exf@empty% \exf@section{0pt}{\exf@introitem}% \else% \exf@section{#1}{\exf@introitem\exf@intro\unskip}% \fi}% +\newcommand{\exf@close@block}{% + \advance\leftskip-\exf@addmargin% + \advance\linewidth\exf@addmargin% + \advance\@totalleftmargin-\exf@addmargin}% \newcommand{\addprobleminfo}{\@ifstar\exf@prepend@intro\exf@append@intro} @@ -715,28 +728,24 @@ \clearpage\ifexf@twoside\ifodd\value{page}\else% \thispagestyle{empty}\hbox{}\newpage\fi\fi} -\newif\ifexf@problem@solnewsec\exf@problem@solnewsectrue - \define@key{exf@problem}{points}{\def\exf@points@given{#1}} \define@key{exf@problem}{label}{\def\exf@label{#1}} \define@key{exf@problem}{tag}{\def\problemtag{#1}} \define@key{exf@problem}{sollabel}{\xdef\exf@sollabel{#1}} \newenvironment{\exf@problemname}[1][]{% - \par\exf@config@styletext% - \addvspace{\exf@config@skipproblemabove}% + \par\exf@config@styletext\addvspace{\exf@config@skipproblemabove}% \refstepcounter{\exf@problemcounter}% \exf@config@insertproblembefore% - \global\exf@problem@solnewsectrue% + \begingroup% + \def\exf@in@problem{}% \ifexf@style@problemequation% \exf@eqsav\value{equation}% \setcounter{equation}{\value{exf@problemequation}}% \let\theequation\theexf@problemequation% \let\theHequation\theHexf@problemequation% \fi% - \begingroup% - \def\exf@in@problem{}% - \exf@init@intro{\exf@config@skipprobleminfo}% + \exf@init@block{\exf@config@skipprobleminfo}% \def\problemtag{\csname the\exf@problemcounter\endcsname}% \let\exf@points@given\@undefined% \let\exf@label\@undefined% @@ -745,6 +754,7 @@ \setkeys{exf@problem,exf@probleminfo}{#1}% \ifexf@autolabelproblem\label{\exf@config@labelproblem{\problemtag}}\fi% \ifdefined\exf@label\label{\exf@label}\fi% + \gdef\exf@problem@solnewsec{}% \xdef\exf@prevprob{\csname the\exf@problemcounter\endcsname}% \ifcsname theH\exf@problemcounter\endcsname% \xdef\exf@prevprobhref{\exf@problemcounter.% @@ -753,7 +763,8 @@ \ifx\exf@data@problem@rawtitle\exf@empty% \global\let\exf@prevprobtitle\@undefined% \else% - \xdef\exf@prevprobtitle{\exf@data@problem@rawtitle}\fi% + \protected@xdef\exf@prevprobtitle{\exf@data@problem@rawtitle}% + \fi% \global\let\exf@prevsubprob\@undefined% \global\let\exf@prevsubprobhref\@undefined% \let\exf@problem@points\@undefined% @@ -786,16 +797,13 @@ {\exf@data@problem@rawtitle}}}% \else% \ifdim\exf@config@skipproblemitem>0pt% - \setlength\exf@tmpdim{\exf@config@skipproblemitem}% + \setlength\exf@addmargin{\exf@config@skipproblemitem}% \else% - \settowidth\exf@tmpdim{% + \settowidth\exf@addmargin{% \exf@config@styletitle\exf@config@styletitleproblem% \exf@config@composeitemproblem{\exf@config@counterproblemmax}% \exf@config@composeitemproblemsep}% \fi% - \advance\leftskip\exf@tmpdim% - \advance\linewidth -\exf@tmpdim% - \advance\@totalleftmargin\exf@tmpdim% \def\exf@introitem{\makebox[0cm][r]{% \exf@config@styletitle\exf@config@styletitleproblem% \exf@config@composeitemproblem{\csname the\exf@problemcounter\endcsname}% @@ -812,7 +820,7 @@ \exf@config@insertpointsmargin\expandafter{\expandafter% \exf@config@composepointsmargin\expandafter{\exf@problem@pointsshow}}}% \let\exf@problem@pointsshow\@undefined\fi}% - \exf@write@intro{\exf@config@skipproblemtitle}% + \exf@open@block{\exf@config@skipproblemtitle}% \exf@addcontentsline{\exf@config@toclevelproblem}% {\exf@config@composetocproblem{\csname the\exf@problemcounter\endcsname}% {\exf@data@problem@rawtitle}}% @@ -848,39 +856,42 @@ \ifdefined\exf@problem@points\else\ifdim\exf@sheet@points@dim=0pt\else% \PackageWarning{exframe}{no points defined for \exf@problemname}% \fi\fi% - \par\endgroup% - \exf@config@insertproblemafter% - \addvspace{\exf@config@skipproblembelow}% - \exf@solbelowis{problem}{% - \exf@showsolutions{\exf@config@composetitlesolutionmulti}{}}% \global\let\exf@prevsubprob\@undefined% \global\let\exf@prevsubprobhref\@undefined% + \par\exf@close@block% + \exf@solbelowis{problem}{% + \exf@config@insertproblemsolution% + \exf@showsolutions{\exf@config@composetitlesolutionmulti}{}}% \ifexf@style@problemequation% \setcounter{exf@problemequation}{\value{equation}}% \setcounter{equation}{\exf@eqsav}% \fi% + \endgroup% + \exf@config@insertproblemafter% + \addvspace{\exf@config@skipproblembelow}% + \exf@solbelowis{problem*}{% + \exf@showsolutions{\exf@config@composetitlesolutionmulti}{}}% \ignorespacesafterend} \define@key{exf@subproblem}{points}{\def\exf@subproblem@points{#1}} \define@key{exf@subproblem}{label}{\def\exf@label{#1}} \newenvironment{\exf@subproblemname}[1][]{% - \par% - {\exf@config@styletext\addvspace{\exf@config@skipsubproblemabove}}% + \par{\exf@config@styletext\addvspace{\exf@config@skipsubproblemabove}}% \refstepcounter{\exf@subproblemcounter}% \exf@config@insertsubproblembefore% - \xdef\exf@prevsubprob{\csname the\exf@subproblemcounter\endcsname}% - \ifcsname theH\exf@subproblemcounter\endcsname% - \xdef\exf@prevsubprobhref{\exf@subproblemcounter.% - \csname theH\exf@subproblemcounter\endcsname}% - \fi% \begingroup% \def\exf@in@subproblem{}% - \exf@init@intro{\exf@config@skipsubprobleminfo}% + \exf@init@block{\exf@config@skipsubprobleminfo}% \let\exf@subproblem@points\@undefined% \let\exf@label\@undefined% \setkeys{exf@subproblem,exf@probleminfo}{#1}% \ifdefined\exf@label\label{\exf@label}\fi% + \xdef\exf@prevsubprob{\csname the\exf@subproblemcounter\endcsname}% + \ifcsname theH\exf@subproblemcounter\endcsname% + \xdef\exf@prevsubprobhref{\exf@subproblemcounter.% + \csname theH\exf@subproblemcounter\endcsname}% + \fi% \ifdefined\exf@subproblem@points% \global\let\exf@prevpoints\exf@subproblem@points% \global\addtolength{\exf@problem@points@dim}{\exf@subproblem@points pt}% @@ -906,16 +917,13 @@ \csname the\exf@subproblemcounter\endcsname}}}% \else% \ifdim\exf@config@skipsubproblemitem>0pt% - \setlength\exf@tmpdim{\exf@config@skipsubproblemitem}% + \setlength\exf@addmargin{\exf@config@skipsubproblemitem}% \else% - \settowidth\exf@tmpdim{% + \settowidth\exf@addmargin{% \exf@config@styletitle\exf@config@styletitlesubproblem% \exf@config@composeitemsubproblem{\exf@config@countersubproblemmax}% \exf@config@composeitemsubproblemsep}% \fi% - \advance\leftskip\exf@tmpdim% - \advance\linewidth -\exf@tmpdim% - \advance\@totalleftmargin\exf@tmpdim% \def\exf@introitem{\makebox[0cm][r]{% \exf@config@styletitle\exf@config@styletitlesubproblem% \exf@config@composeitemsubproblem% @@ -928,14 +936,18 @@ \exf@config@insertpointsmargin\expandafter{\expandafter% \exf@config@composepointsmargin\expandafter{\exf@subproblem@points}}}% \let\exf@subproblem@points\@undefined\fi}% - \exf@write@intro{\exf@config@skipsubproblemtitle}% + \exf@open@block{\exf@config@skipsubproblemtitle}% \@afterindentfalse}% {\exf@subpointsatis{end}{\showpoints}% - \par\endgroup% - {\exf@config@styletext\addvspace{\exf@config@skipsubproblembelow}}% + \par\exf@close@block% + \exf@solbelowis{subproblem*}{% + \exf@config@insertsubproblemsolution% + \exf@showsolutions{\exf@config@composetitlesolutionsingle}{}}% + \endgroup% \exf@config@insertsubproblemafter% - \exf@solbelowis{subproblem}{\exf@showsolutions% - {\exf@config@composetitlesolutionsingle}{}}% + {\exf@config@styletext\addvspace{\exf@config@skipsubproblembelow}}% + \exf@solbelowis{subproblem}{% + \exf@showsolutions{\exf@config@composetitlesolutionsingle}{}}% \ignorespacesafterend} \define@key{exf@solution}{prob}{\def\exf@solprob{#1}} @@ -948,8 +960,7 @@ \define@key{exf@solution}{probtitle}{\def\exf@solprobtitle{#1}} \newenvironment{printsolution}[1]{% - \par% - {\exf@config@styletext\addvspace{\exf@config@skipsolutionabove}}% + \par{\exf@config@styletext\addvspace{\exf@config@skipsolutionabove}}% \exf@config@insertsolutionbefore% \ifexf@style@solutionequation% \exf@eqsav\value{equation}% @@ -963,7 +974,7 @@ \let\exf@label\@undefined% \setlength{\exf@solution@points@dim}{0pt}% \def\exf@solhref{}% - \exf@init@intro{\exf@config@skipsolutioninfo}% + \exf@init@block{\exf@config@skipsolutioninfo}% \setkeys{exf@solution,exf@probleminfo}{#1}% \exf@csdo\def{the\exf@solutioncounter}% {\exf@config@composeitemsolution{\exf@solprob}{\exf@solsubprob}}% @@ -987,9 +998,9 @@ \fi% \else% \ifdim\exf@tmp>0pt% - \setlength\exf@tmpdim{\exf@tmp}% + \setlength\exf@addmargin{\exf@tmp}% \else% - \settowidth\exf@tmpdim{% + \settowidth\exf@addmargin{% \exf@config@styletitle\exf@config@styletitlesolution% \ifx\exf@solsubprob\exf@empty% \exf@config@composeitemsolution{\exf@config@counterproblemmax}% @@ -999,9 +1010,6 @@ {\exf@config@countersubproblemmax}% \fi\exf@config@composeitemsolutionsep}% \fi% - \advance\leftskip\exf@tmpdim% - \advance\linewidth -\exf@tmpdim% - \advance\@totalleftmargin\exf@tmpdim% \ifx\exf@solsubprob\exf@empty% \protected@edef\exf@solution@item% {\exf@config@composeitemsolution{\exf@solprob}{\exf@empty}}% @@ -1015,7 +1023,7 @@ \else\exf@solution@item\fi% \exf@config@composeitemproblemsep}}% \fi% - \exf@write@intro{\exf@config@skipsolutiontitle}% + \exf@open@block{\exf@config@skipsolutiontitle}% \@afterindentfalse}% {\ifdefined\exf@solution@points\ifdim\exf@solution@points@dim=0pt\else% \ifdim\exf@solution@points@dim=\exf@solution@points pt\else% @@ -1023,13 +1031,14 @@ \ifexf@warntext\exf@config@insertwarnpoints{\exf@solutionname}% {\strip@pt\exf@solution@points@dim}{\exf@solution@points}\fi% \fi\fi\fi% - \par\endgroup% - {\exf@config@styletext\addvspace{\exf@config@skipsolutionbelow}}% - \exf@config@insertsolutionafter% + \par\exf@close@block% \ifexf@style@solutionequation% \setcounter{exf@solutionequation}{\value{equation}}% \setcounter{equation}{\exf@eqsav}% \fi% + \endgroup% + {\exf@config@styletext\addvspace{\exf@config@skipsolutionbelow}}% + \exf@config@insertsolutionafter% \ignorespacesafterend} \newcommand{\solutionssection}[1]{\begingroup% @@ -1044,6 +1053,8 @@ {\exf@config@composetocsolution{\exf@solprob}{\exf@solprobtitle}}}% \exf@solbelowis{problem}{\let\exf@composetitle% \exf@config@composetitlesolutionsproblemsingle}% + \exf@solbelowis{problem*}{\let\exf@composetitle% + \exf@config@composetitlesolutionsproblemsingle}% \exf@solutionssection{\exf@config@styletitlesolutionsproblem}% {\exf@composetitle{\exf@solprob}{\exf@solprobtitle}}% {\exf@config@skipsolutionsproblem}% @@ -1056,19 +1067,20 @@ \newenvironment{exf@scansolution}[2]{% \exf@solbelowis{here}{\showpoints}% \global\exf@bufcleanfalse% - \ifexf@problem@solnewsec% + \ifdefined\exf@problem@solnewsec% \def\exf@probarg{\ifdefined\exf@prevprob prob={\exf@prevprob}\fi% \ifdefined\exf@prevprobtitle,probtitle={\exf@prevprobtitle}\fi% \ifdefined\exf@prevprobhref,href={\exf@prevprobhref}\fi% \ifdefined\exf@sollabel,label={\exf@sollabel}\fi}% \exf@solbelowis{here}{\let\exf@probarg\@undefined}% \exf@solbelowis{subproblem}{\let\exf@probarg\@undefined}% + \exf@solbelowis{subproblem*}{\let\exf@probarg\@undefined}% \ifdefined\exf@probarg% \ifexf@lineno\exf@addbufline{\exf@linesep}\exf@addbufline{\exf@lineno}\fi% \exf@addbufline{\@backslashchar solutionssection{\exf@probarg}}% \exf@addbufline{}% \fi% - \global\exf@problem@solnewsecfalse% + \global\let\exf@problem@solnewsec\@undefined% \fi% \ifexf@lineno\exf@addbufline{\exf@linesep}\exf@addbufline{\exf@lineno}\fi% \def\exf@subprobarg{% @@ -1096,10 +1108,16 @@ \ifsolutions\else\exf@clearbuf\fi% \exf@solbelowis{here}{\exf@showsolutions% {\exf@config@composetitlesolutionsingle}{}}% - \exf@solbelowis{subproblem}{\ifdefined\exf@in@subproblem\else% - \exf@showsolutions{\exf@config@composetitlesolutionsingle}{}\fi}% - \exf@solbelowis{problem}{\ifdefined\exf@in@problem\else% - \exf@showsolutions{\exf@config@composetitlesolutionmulti}{}\fi}% + \ifdefined\exf@in@subproblem\else% + \exf@solbelowis{subproblem}{% + \exf@showsolutions{\exf@config@composetitlesolutionsingle}{}}% + \exf@solbelowis{subproblem*}{% + \exf@showsolutions{\exf@config@composetitlesolutionsingle}{}}\fi% + \ifdefined\exf@in@problem\else% + \exf@solbelowis{problem}{% + \exf@showsolutions{\exf@config@composetitlesolutionmulti}{}}% + \exf@solbelowis{problem*}{% + \exf@showsolutions{\exf@config@composetitlesolutionmulti}{}}\fi% \ignorespacesafterend} \newcommand{\exf@solutionssection}[6]{% |