Skip to content

Commit

Permalink
Updated sample problem docs
Browse files Browse the repository at this point in the history
Files changed:
M	sample-problems/Algebra/AlgebraicFractionAnswer.html
M	sample-problems/Algebra/AlgebraicFractionAnswer.pg
M	sample-problems/Algebra/AnswerBlankInExponent.html
M	sample-problems/Algebra/AnswerBlankInExponent.pg
M	sample-problems/Algebra/AnswerUpToMultiplication.html
M	sample-problems/Algebra/DomainRange.html
M	sample-problems/Algebra/DynamicGraph.html
M	sample-problems/Algebra/DynamicGraph.pg
M	sample-problems/Algebra/EquationDefiningFunction.html
M	sample-problems/Algebra/EquationImplicitFunction.html
M	sample-problems/Algebra/ExpandedPolynomial.html
M	sample-problems/Algebra/FactoredPolynomial.html
M	sample-problems/Algebra/FractionAnswer.html
M	sample-problems/Algebra/FunctionDecomposition.html
M	sample-problems/Algebra/GraphToolCircle.html
M	sample-problems/Algebra/GraphToolCubic.html
M	sample-problems/Algebra/GraphToolCustomChecker.html
M	sample-problems/Algebra/GraphToolLine.html
M	sample-problems/Algebra/GraphToolNumberLine.html
M	sample-problems/Algebra/GraphToolNumberLine.pg
M	sample-problems/Algebra/GraphToolPoints.html
M	sample-problems/Algebra/InequalityAnswer.html
M	sample-problems/Algebra/InequalityAnswer.pg
M	sample-problems/Algebra/LinearInequality.html
M	sample-problems/Algebra/LinearInequality.pg
M	sample-problems/Algebra/Logarithms.html
M	sample-problems/Algebra/PointAnswers.html
M	sample-problems/Algebra/ScalingTranslating.html
A	sample-problems/Algebra/SimpleFactoring.html
A	sample-problems/Algebra/SimpleFactoring.pg
M	sample-problems/Algebra/SolutionForEquation.html
M	sample-problems/Algebra/StringOrOtherType.html
M	sample-problems/Algebra/TableOfValues.html
M	sample-problems/Algebra/UnorderedAnswers.html
M	sample-problems/Complex/ComplexOperations.html
M	sample-problems/Complex/ComplexOperations.pg
M	sample-problems/Complex/LimitedComplex.html
M	sample-problems/Complex/LimitedComplex.pg
M	sample-problems/Complex/OtherOperations.html
M	sample-problems/Complex/OtherOperations.pg
M	sample-problems/DiffCalc/AnswerWithUnits.html
M	sample-problems/DiffCalc/DifferenceQuotient.html
M	sample-problems/DiffCalc/DifferentiateFunction.html
M	sample-problems/DiffCalc/LinearApprox.html
M	sample-problems/DiffCalcMV/ContourPlot.html
M	sample-problems/DiffCalcMV/ContourPlot.pg
M	sample-problems/DiffCalcMV/ImplicitPlane.html
M	sample-problems/DiffEq/GeneralSolutionODE.html
M	sample-problems/DiffEq/GeneralSolutionODE.pg
M	sample-problems/DiffEq/HeavisideStep.html
M	sample-problems/DiffEq/HeavisideStep.pg
M	sample-problems/DiffEq/PrimesInFormulas.html
M	sample-problems/IntegralCalc/DoubleIntegral.html
M	sample-problems/IntegralCalc/GraphShading.html
M	sample-problems/IntegralCalc/IndefiniteIntegrals.html
M	sample-problems/IntegralCalc/LimitsOfIntegration.html
M	sample-problems/IntegralCalc/LimitsOfIntegration.pg
M	sample-problems/IntegralCalc/RiemannSums.html
M	sample-problems/IntegralCalc/VolumeOfRevolution.html
M	sample-problems/IntegralCalc/VolumeOfRevolution.pg
M	sample-problems/LinearAlgebra/MatrixAnswer1.html
M	sample-problems/LinearAlgebra/MatrixAnswer2.html
M	sample-problems/LinearAlgebra/MatrixCustomAnswerChecker.html
M	sample-problems/LinearAlgebra/MatrixOperations.html
M	sample-problems/LinearAlgebra/RowOperations.html
M	sample-problems/Misc/ChemicalReaction.html
M	sample-problems/Misc/DraggableProof.html
A	sample-problems/Misc/DynamicGraphPolygon.html
A	sample-problems/Misc/DynamicGraphPolygon.pg
M	sample-problems/Misc/EssayAnswer.html
M	sample-problems/Misc/FormulaAnswer.html
M	sample-problems/Misc/FormulaDomain.html
M	sample-problems/Misc/FormulaTestPoints.html
M	sample-problems/Misc/FormulaTestPoints.pg
M	sample-problems/Misc/IframeEmbedding.html
M	sample-problems/Misc/ManyMultipleChoice.html
M	sample-problems/Misc/Matching.html
M	sample-problems/Misc/Matching.pg
M	sample-problems/Misc/MatchingAlt.html
A	sample-problems/Misc/MatchingGraphs.html
A	sample-problems/Misc/MatchingGraphs.pg
M	sample-problems/Misc/MultipleChoiceCheckbox.html
M	sample-problems/Misc/MultipleChoicePopup.html
M	sample-problems/Misc/MultipleChoiceRadio.html
M	sample-problems/Misc/RandomPerson.html
M	sample-problems/Misc/Scaffolding.html
A	sample-problems/Parametric/ParametricEquationAnswers.html
A	sample-problems/Parametric/ParametricEquationAnswers.pg
M	sample-problems/Parametric/ParametricPlot.html
M	sample-problems/Parametric/ParametricPlot.pg
M	sample-problems/Parametric/PolarGraph.html
M	sample-problems/Parametric/SpaceCurveGraph.html
M	sample-problems/Parametric/Spacecurve.html
M	sample-problems/Parametric/SurfaceGraph.html
M	sample-problems/Parametric/VectorParametricDerivative.html
M	sample-problems/Parametric/VectorParametricFunction.html
M	sample-problems/Parametric/VectorParametricLines.html
M	sample-problems/Parametric/VectorParametricLines.pg
M	sample-problems/Sequences/AnswerOrderedList.html
M	sample-problems/Sequences/AnswerOrderedList.pg
M	sample-problems/Sequences/ExplicitSequence.html
M	sample-problems/Sequences/RecursiveSequence.html
M	sample-problems/Sequences/SeriesTest.html
M	sample-problems/Sequences/SeriesTest.pg
A	sample-problems/Statistics/linearRegression.html
A	sample-problems/Statistics/linearRegression.pg
A	sample-problems/Statistics/meanStdDev.html
A	sample-problems/Statistics/meanStdDev.pg
A	sample-problems/Trig/DisableFunctionsTrig.html
A	sample-problems/Trig/DisableFunctionsTrig.pg
M	sample-problems/Trig/DraggableIdentity.html
M	sample-problems/Trig/PeriodicAnswers.html
M	sample-problems/Trig/ProvingTrigIdentities.html
A	sample-problems/Trig/SpecialTrigValues.html
A	sample-problems/Trig/SpecialTrigValues.pg
M	sample-problems/Trig/TrigDegrees.html
M	sample-problems/Trig/TrigIdentities.html
M	sample-problems/Trig/TrigIdentities.pg
M	sample-problems/VectorCalc/CylindricalGraph3D.html
M	sample-problems/VectorCalc/CylindricalGraph3D.pg
M	sample-problems/VectorCalc/DirectionField.html
M	sample-problems/VectorCalc/RectangularGraph3D.html
M	sample-problems/VectorCalc/RectangularGraph3D.pg
M	sample-problems/VectorCalc/VectorFieldGraph2D.html
M	sample-problems/VectorCalc/VectorFieldGraph3D/VectorFieldGraph3D1.html
M	sample-problems/VectorCalc/VectorFieldGraph3D/VectorFieldGraph3D1.pg
A	sample-problems/VectorCalc/VectorLineSegment1.html
A	sample-problems/VectorCalc/VectorLineSegment1.pg
A	sample-problems/VectorCalc/VectorLineSegment2.html
A	sample-problems/VectorCalc/VectorLineSegment2.pg
M	sample-problems/VectorCalc/VectorOperations.html
M	sample-problems/VectorCalc/VectorOperations.pg
A	sample-problems/VectorCalc/VectorParametricLine.html
A	sample-problems/VectorCalc/VectorParametricLine.pg
M	sample-problems/VectorCalc/Vectors.html
M	sample-problems/VectorCalc/Vectors.pg
M	sample-problems/categories.html
M	sample-problems/macros.html
M	sample-problems/problem-techniques/AdaptiveParameters.html
M	sample-problems/problem-techniques/AddingFunctions.html
M	sample-problems/problem-techniques/AnswerHints.html
M	sample-problems/problem-techniques/AnswerInExponent.html
M	sample-problems/problem-techniques/AnswerIsSolutionToEquation.html
M	sample-problems/problem-techniques/AnyAnswerMarkedCorrect.html
M	sample-problems/problem-techniques/CalculatingWithPoints.html
M	sample-problems/problem-techniques/CalculatingWithPoints.pg
M	sample-problems/problem-techniques/ComposingFunctions.html
M	sample-problems/problem-techniques/ConstantsInProblems.html
M	sample-problems/problem-techniques/CustomAnswerCheckers.html
M	sample-problems/problem-techniques/CustomAnswerListChecker.html
M	sample-problems/problem-techniques/CustomAnswerListChecker.pg
M	sample-problems/problem-techniques/DataTables.html
M	sample-problems/problem-techniques/DifferentiatingFormulas.html
M	sample-problems/problem-techniques/DigitsTolType.html
M	sample-problems/problem-techniques/DisableFunctions.html
M	sample-problems/problem-techniques/DraggableSubsets.html
M	sample-problems/problem-techniques/DraggableSubsets.pg
M	sample-problems/problem-techniques/EquationEvaluators.html
M	sample-problems/problem-techniques/EquationEvaluators.pg
M	sample-problems/problem-techniques/EquationsDefiningFunctions.html
M	sample-problems/problem-techniques/ErrorMessageCustomization.html
M	sample-problems/problem-techniques/EvalVersusSubstitute.html
M	sample-problems/problem-techniques/ExtractingCoordinatesFromPoint.html
M	sample-problems/problem-techniques/ExtractingCoordinatesFromPoint.pg
M	sample-problems/problem-techniques/FactoringAndExpanding.html
M	sample-problems/problem-techniques/FormattingDecimals.html
M	sample-problems/problem-techniques/FormulasToConstants.html
M	sample-problems/problem-techniques/FormulasToConstants.pg
M	sample-problems/problem-techniques/GraphsInTables.html
M	sample-problems/problem-techniques/GraphsInTables.pg
M	sample-problems/problem-techniques/HtmlLinks.html
M	sample-problems/problem-techniques/HtmlLinks.pg
M	sample-problems/problem-techniques/Images.html
M	sample-problems/problem-techniques/Images.pg
M	sample-problems/problem-techniques/InequalityEvaluators.html
M	sample-problems/problem-techniques/IntervalEvaluators.html
M	sample-problems/problem-techniques/Knowls.html
M	sample-problems/problem-techniques/LayoutTable.html
M	sample-problems/problem-techniques/LayoutTable.pg
A	sample-problems/problem-techniques/Multianswer.html
A	sample-problems/problem-techniques/Multianswer.pg
M	sample-problems/problem-techniques/NumericalTolerance.html
M	sample-problems/problem-techniques/OtherVariables.html
M	sample-problems/problem-techniques/Percent.html
M	sample-problems/problem-techniques/RandomFunction.html
M	sample-problems/problem-techniques/RandomFunction.pg
A	sample-problems/problem-techniques/RestrictAnswerToFraction.html
A	sample-problems/problem-techniques/RestrictAnswerToFraction.pg
A	sample-problems/problem-techniques/RestrictingFunctions.html
A	sample-problems/problem-techniques/RestrictingFunctions.pg
A	sample-problems/problem-techniques/SimplePopUp.html
A	sample-problems/problem-techniques/SimplePopUp.pg
M	sample-problems/problem-techniques/StaticImages.html
M	sample-problems/problem-techniques/StringsInContext.html
M	sample-problems/problem-techniques/TikZImages.html
M	sample-problems/problem-techniques/WeightedGrader.html
M	sample-problems/problem-techniques/WeightedGrader.pg
M	sample-problems/snippets/CommentsForInstructors.html
M	sample-problems/subjects.html
M	sample-problems/techniques.html
  • Loading branch information
pstaabp committed Jul 18, 2023
1 parent d555530 commit 36c7e9d
Show file tree
Hide file tree
Showing 200 changed files with 6,830 additions and 800 deletions.
47 changes: 22 additions & 25 deletions sample-problems/Algebra/AlgebraicFractionAnswer.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ <h2>POD for Macro Files</h2>
type="button" data-code="DOCUMENT();
loadMacros(
&#39;PGstandard.pl&#39;, &#39;PGML.pl&#39;, &#39;niceTables.pl&#39;,
&#39;parserMultiAnswer.pl&#39;, &#39;PGcourse.pl&#39;
&#39;PGstandard.pl&#39;, &#39;PGML.pl&#39;,
&#39;niceTables.pl&#39;, &#39;parserMultiAnswer.pl&#39;,
&#39;PGcourse.pl&#39;
);
" aria-label="copy to clipboard">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
Expand All @@ -63,8 +64,9 @@ <h2>POD for Macro Files</h2>
<pre class="CodeMirror cm-s-default m-0 h-100 p-3 border border-secondary overflow-x-scroll">DOCUMENT();

loadMacros(
&#39;PGstandard.pl&#39;, &#39;PGML.pl&#39;, &#39;niceTables.pl&#39;,
&#39;parserMultiAnswer.pl&#39;, &#39;PGcourse.pl&#39;
&#39;PGstandard.pl&#39;, &#39;PGML.pl&#39;,
&#39;niceTables.pl&#39;, &#39;parserMultiAnswer.pl&#39;,
&#39;PGcourse.pl&#39;
);
</pre>
</div>
Expand All @@ -83,7 +85,7 @@ <h2>POD for Macro Files</h2>
$a = random(2, 8, 2);
$b = random(3, 9, 2);
$c = random(1, 9, 1);
} until ($a*$c != $b);
} until ($a * $c != $b);
$num = Formula(&quot;$a y - $b&quot;);
$den = Formula(&quot;y - $c&quot;);
Expand Down Expand Up @@ -124,18 +126,15 @@ <h2>POD for Macro Files</h2>
);
$frac = LayoutTable(
[[
[ [
&quot;\(\displaystyle\frac{$a y}{y-$c} + \frac{$b}{$c - y}=\)&quot;,
LayoutTable(
[
[[ans_rule(4), bottom =&gt; 1]],
[ans_rule(4)],
],
padding =&gt; [0.5, 0],
[ [ [ ans_rule(4), bottom =&gt; 1 ] ], [ ans_rule(4) ], ],
padding =&gt; [ 0.5, 0 ],
)
]],
padding =&gt; [0, 0.5],
valign =&gt; &#39;middle&#39;,
] ],
padding =&gt; [ 0, 0.5 ],
valign =&gt; &#39;middle&#39;,
);
" aria-label="copy to clipboard">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
Expand All @@ -150,7 +149,7 @@ <h2>POD for Macro Files</h2>
$a = random(2, 8, 2);
$b = random(3, 9, 2);
$c = random(1, 9, 1);
} until ($a*$c != $b);
} until ($a * $c != $b);

$num = Formula(&quot;$a y - $b&quot;);
$den = Formula(&quot;y - $c&quot;);
Expand Down Expand Up @@ -191,18 +190,15 @@ <h2>POD for Macro Files</h2>
);

$frac = LayoutTable(
[[
[ [
&quot;\(\displaystyle\frac{$a y}{y-$c} + \frac{$b}{$c - y}=\)&quot;,
LayoutTable(
[
[[ans_rule(4), bottom =&gt; 1]],
[ans_rule(4)],
],
padding =&gt; [0.5, 0],
[ [ [ ans_rule(4), bottom =&gt; 1 ] ], [ ans_rule(4) ], ],
padding =&gt; [ 0.5, 0 ],
)
]],
padding =&gt; [0, 0.5],
valign =&gt; &#39;middle&#39;,
] ],
padding =&gt; [ 0, 0.5 ],
valign =&gt; &#39;middle&#39;,
);
</pre>
</div>
Expand Down Expand Up @@ -290,7 +286,8 @@ <h2>POD for Macro Files</h2>
}

for (const btn of document.querySelectorAll('.clipboard-btn')) {
btn.addEventListener('click', () => navigator.clipboard.writeText(btn.dataset.code));
if (navigator.clipboard) btn.addEventListener('click', () => navigator.clipboard.writeText(btn.dataset.code));
else btn?.remove();
}
</script>
</body>
Expand Down
22 changes: 10 additions & 12 deletions sample-problems/Algebra/AlgebraicFractionAnswer.pg
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
DOCUMENT();

loadMacros(
'PGstandard.pl', 'PGML.pl', 'niceTables.pl',
'parserMultiAnswer.pl', 'PGcourse.pl'
'PGstandard.pl', 'PGML.pl',
'niceTables.pl', 'parserMultiAnswer.pl',
'PGcourse.pl'
);

Context()->variables->are(y => 'Real');
Expand All @@ -12,7 +13,7 @@ do {
$a = random(2, 8, 2);
$b = random(3, 9, 2);
$c = random(1, 9, 1);
} until ($a*$c != $b);
} until ($a * $c != $b);

$num = Formula("$a y - $b");
$den = Formula("y - $c");
Expand Down Expand Up @@ -53,18 +54,15 @@ $multians = MultiAnswer($num, $den)->with(
);

$frac = LayoutTable(
[[
[ [
"\(\displaystyle\frac{$a y}{y-$c} + \frac{$b}{$c - y}=\)",
LayoutTable(
[
[[ans_rule(4), bottom => 1]],
[ans_rule(4)],
],
padding => [0.5, 0],
[ [ [ ans_rule(4), bottom => 1 ] ], [ ans_rule(4) ], ],
padding => [ 0.5, 0 ],
)
]],
padding => [0, 0.5],
valign => 'middle',
] ],
padding => [ 0, 0.5 ],
valign => 'middle',
);

BEGIN_PGML
Expand Down
91 changes: 29 additions & 62 deletions sample-problems/Algebra/AnswerBlankInExponent.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@ <h2>Complete Code</h2>
Download file: <a href="AnswerBlankInExponent.pg">AnswerBlankInExponent.pg</a>
</p>
</div>
<div class="col">
<h2>POD for Macro Files</h2>
<ul>
<li><a href="https://openwebwork.github.io/pg-docs/pod/pg/macros/ui/niceTables.html">niceTables.pl</a></li>
</ul>
</div>
</div>
<div class="row">
<div class="col text-center"><h2 class="fw-bold fs-3">PG problem file</h2></div>
Expand All @@ -49,7 +43,7 @@ <h2>POD for Macro Files</h2>
<button class="clipboard-btn btn btn-sm btn-secondary position-absolute top-0 end-0 me-1 mt-1 z-1"
type="button" data-code="DOCUMENT();
loadMacros(&#39;PGstandard.pl&#39;, &#39;PGML.pl&#39;, &#39;niceTables.pl&#39;, &#39;PGcourse.pl&#39;);
loadMacros(&#39;PGstandard.pl&#39;, &#39;PGML.pl&#39;, &#39;PGcourse.pl&#39;);
" aria-label="copy to clipboard">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
class="bi bi-clipboard-fill" viewBox="0 0 16 16">
Expand All @@ -58,12 +52,12 @@ <h2>POD for Macro Files</h2>
</button>
<pre class="CodeMirror cm-s-default m-0 h-100 p-3 border border-secondary overflow-x-scroll">DOCUMENT();

loadMacros(&#39;PGstandard.pl&#39;, &#39;PGML.pl&#39;, &#39;niceTables.pl&#39;, &#39;PGcourse.pl&#39;);
loadMacros(&#39;PGstandard.pl&#39;, &#39;PGML.pl&#39;, &#39;PGcourse.pl&#39;);
</pre>
</div>
<div class="explanation preamble col-sm-12 col-md-6 order-md-last order-first p-3 border border-dark">
<p><b>Preamble</b></p>
<p>The macro <code>niceTables.pl</code> provides a way to format the problem.</p>
These standard macros need to be loaded.
</div>
</div>
<div class="row">
Expand All @@ -81,30 +75,16 @@ <h2>POD for Macro Files</h2>
$exponent = Formula(&quot;$n&quot;);
# Display exponents nicely
# Context()-&gt;texStrings;
$tab = LayoutTable([[
[&quot;\(\displaystyle $expression= \Big(\)&quot; . ans_rule(4) . &quot;\(\Big)\)&quot;, cellcss =&gt; { padding =&gt; &#39;20pt 0pt 0pt 4pt&#39;}],
[ ans_rule(4), cellcss =&gt; {padding =&gt; &#39;0pt 0pt 20pt 0pt&#39;}]
]]);
# if ($displayMode eq &#39;TeX&#39;) {
# $showpower =
# &quot;\( \displaystyle $expression = (&quot;
# . ans_rule(4) . &quot;)^{&quot;
# . ans_rule(4) . &quot;}\)&quot;;
# } else {
# $showpower = ColumnTable(
# &quot;\( \displaystyle $expression = \Big( \)&quot;
# . ans_rule(4)
# . &quot;\( \Big) \)&quot;,
# ans_rule(4) . $BR . $BR,
# indent =&gt; 0,
# separation =&gt; 0,
# valign =&gt; &#39;BOTTOM&#39;
# );
# }
# Context()-&gt;normalStrings;
$exp = MODES(
HTML =&gt; &quot;&lt;span&gt;\(\displaystyle $expression= \Big(\)&quot;
. ans_rule(4)
. &#39;\(\Big)\)&lt;/span&gt;&lt;span style=&quot;vertical-align: 12pt;&quot;&gt;&#39;
. ans_rule(4)
. &#39;&lt;/span&gt;&#39;,
TeX =&gt; &quot;\( \displaystyle $expression = (&quot;
. ans_rule(4) . &quot;)^{&quot;
. ans_rule(4) . &quot;}\)&quot;
);
" aria-label="copy to clipboard">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
class="bi bi-clipboard-fill" viewBox="0 0 16 16">
Expand All @@ -123,36 +103,22 @@ <h2>POD for Macro Files</h2>
$exponent = Formula(&quot;$n&quot;);

# Display exponents nicely
# Context()-&gt;texStrings;

$tab = LayoutTable([[
[&quot;\(\displaystyle $expression= \Big(\)&quot; . ans_rule(4) . &quot;\(\Big)\)&quot;, cellcss =&gt; { padding =&gt; &#39;20pt 0pt 0pt 4pt&#39;}],
[ ans_rule(4), cellcss =&gt; {padding =&gt; &#39;0pt 0pt 20pt 0pt&#39;}]
]]);

# if ($displayMode eq &#39;TeX&#39;) {
# $showpower =
# &quot;\( \displaystyle $expression = (&quot;
# . ans_rule(4) . &quot;)^{&quot;
# . ans_rule(4) . &quot;}\)&quot;;
# } else {
# $showpower = ColumnTable(
# &quot;\( \displaystyle $expression = \Big( \)&quot;
# . ans_rule(4)
# . &quot;\( \Big) \)&quot;,
# ans_rule(4) . $BR . $BR,
# indent =&gt; 0,
# separation =&gt; 0,
# valign =&gt; &#39;BOTTOM&#39;
# );
# }
# Context()-&gt;normalStrings;
$exp = MODES(
HTML =&gt; &quot;&lt;span&gt;\(\displaystyle $expression= \Big(\)&quot;
. ans_rule(4)
. &#39;\(\Big)\)&lt;/span&gt;&lt;span style=&quot;vertical-align: 12pt;&quot;&gt;&#39;
. ans_rule(4)
. &#39;&lt;/span&gt;&#39;,
TeX =&gt; &quot;\( \displaystyle $expression = (&quot;
. ans_rule(4) . &quot;)^{&quot;
. ans_rule(4) . &quot;}\)&quot;
);
</pre>
</div>
<div class="explanation setup col-sm-12 col-md-6 order-md-last order-first p-3 border border-dark">
<p><b>Setup</b></p>
<p>We want the only variables to be <code>a</code> and <code>b</code> and choose a random power.</p>
<p>The exponential layout is made with a table with padding on the top of the left cell and on the bottom of the right cell.</p>
<p>The exponential layout is in HTML using a pair of adjacent <code>span</code> elements with the right one shifted up using the CSS style <code>vertical-align</code>. In hardcopy mode, we use the LaTeX exponent.</p>
</div>
</div>
<div class="row">
Expand All @@ -161,7 +127,7 @@ <h2>POD for Macro Files</h2>
type="button" data-code="BEGIN_PGML
Rewrite the following using a single exponent.
[$tab]***
[$exp]*
END_PGML
" aria-label="copy to clipboard">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
Expand All @@ -172,13 +138,13 @@ <h2>POD for Macro Files</h2>
<pre class="CodeMirror cm-s-default m-0 h-100 p-3 border border-secondary overflow-x-scroll">BEGIN_PGML
Rewrite the following using a single exponent.

[$tab]***
[$exp]*
END_PGML
</pre>
</div>
<div class="explanation statement col-sm-12 col-md-6 order-md-last order-first p-3 border border-dark">
<p><b>Statement</b></p>
<p>We insert the nicely formatted answer blanks using <code>$showpower</code>.</p>
<p>We insert exponential stored as <code>$exp</code>.</p>
</div>
</div>
<div class="row">
Expand Down Expand Up @@ -233,7 +199,8 @@ <h2>POD for Macro Files</h2>
}

for (const btn of document.querySelectorAll('.clipboard-btn')) {
btn.addEventListener('click', () => navigator.clipboard.writeText(btn.dataset.code));
if (navigator.clipboard) btn.addEventListener('click', () => navigator.clipboard.writeText(btn.dataset.code));
else btn?.remove();
}
</script>
</body>
Expand Down
38 changes: 12 additions & 26 deletions sample-problems/Algebra/AnswerBlankInExponent.pg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
DOCUMENT();

loadMacros('PGstandard.pl', 'PGML.pl', 'niceTables.pl', 'PGcourse.pl');
loadMacros('PGstandard.pl', 'PGML.pl', 'PGcourse.pl');

Context()->variables->are(a => 'Real', b => 'Real');

Expand All @@ -14,35 +14,21 @@ $base = Formula("a*b");
$exponent = Formula("$n");

# Display exponents nicely
# Context()->texStrings;

$tab = LayoutTable([[
["\(\displaystyle $expression= \Big(\)" . ans_rule(4) . "\(\Big)\)", cellcss => { padding => '20pt 0pt 0pt 4pt'}],
[ ans_rule(4), cellcss => {padding => '0pt 0pt 20pt 0pt'}]
]]);

# if ($displayMode eq 'TeX') {
# $showpower =
# "\( \displaystyle $expression = ("
# . ans_rule(4) . ")^{"
# . ans_rule(4) . "}\)";
# } else {
# $showpower = ColumnTable(
# "\( \displaystyle $expression = \Big( \)"
# . ans_rule(4)
# . "\( \Big) \)",
# ans_rule(4) . $BR . $BR,
# indent => 0,
# separation => 0,
# valign => 'BOTTOM'
# );
# }
# Context()->normalStrings;
$exp = MODES(
HTML => "<span>\(\displaystyle $expression= \Big(\)"
. ans_rule(4)
. '\(\Big)\)</span><span style="vertical-align: 12pt;">'
. ans_rule(4)
. '</span>',
TeX => "\( \displaystyle $expression = ("
. ans_rule(4) . ")^{"
. ans_rule(4) . "}\)"
);

BEGIN_PGML
Rewrite the following using a single exponent.

[$tab]***
[$exp]*
END_PGML

ANS($base->cmp());
Expand Down
3 changes: 2 additions & 1 deletion sample-problems/Algebra/AnswerUpToMultiplication.html
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ <h2>Complete Code</h2>
}

for (const btn of document.querySelectorAll('.clipboard-btn')) {
btn.addEventListener('click', () => navigator.clipboard.writeText(btn.dataset.code));
if (navigator.clipboard) btn.addEventListener('click', () => navigator.clipboard.writeText(btn.dataset.code));
else btn?.remove();
}
</script>
</body>
Expand Down
3 changes: 2 additions & 1 deletion sample-problems/Algebra/DomainRange.html
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ <h2>POD for Macro Files</h2>
}

for (const btn of document.querySelectorAll('.clipboard-btn')) {
btn.addEventListener('click', () => navigator.clipboard.writeText(btn.dataset.code));
if (navigator.clipboard) btn.addEventListener('click', () => navigator.clipboard.writeText(btn.dataset.code));
else btn?.remove();
}
</script>
</body>
Expand Down
Loading

0 comments on commit 36c7e9d

Please sign in to comment.