TransWikia.com

Doc class Exam: how to control horizontal width of answer box / frame

TeX - LaTeX Asked by WyoWindStorm on February 17, 2021

The MWE below specifies 2 column format – one problem per column. As presently coded, the step-by-step solution box is a bit narrow, causing hyphenation that negatively impacts readability (IMHO) and unnecessarily extends the length / depth of the solution box.

Since I didn’t create this code, I’m confused about the parameters, specifically re: how to slightly increase the size of the solution box while still preserving the 2 column format, i.e. 1 problem at the top of each column.

You assistance is much appreciated.

documentclass[12pt]{exam}

printanswers
% un-comment to print solutions.
renewcommand{solutiontitle}{}

usepackage{multirow, tabularx}
newcolumntype{C}{>{centeringarraybackslash}X}
usepackage[table]{xcolor}
usepackage{amsmath}
usepackage{cancel}
usepackage{framed}
usepackage{multicol}
usepackage{tasks}
usepackage[a4paper,margin=0.5in,include head]{geometry}

everymath{displaystyle}
setlengthparindent{1em}

pagestyle{head}
header{Algebra II Review Ch 3.2: Operations Rational Expressions and Equations: K E Y}
       {}
       {01/13-14/21} 

newcommand{pagetop}{%
noindent 
  fbox{fbox{parbox{dimexprtextwidth-4fboxsep-4fboxrule}{
    textbf {Obj. 3.2.a: I can simplify factored rational expressions and find their restrictions.
    bigskip
    bigskipSimplify expression and state the excluded values (+1 pt numerator, +1 pt denominator, +1 pt restrictions.) each equation. Show all work/steps on this page.}
  }}}
  bigskip
  vspace{0.5mm}
}

settasks{after-item-skip=1em,
          after-skip=2cm,
          label-width=2em,
          item-indent=3em,
          label=(arabic*),
          column-sep=2em
          }
% ------------ DOCUMENT STARTS HERE---------- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
begin{document}

%definition for bigskip = 1 line to replace all bigskip
defbigskip{vskipbigskipamount}

%macro diamondscheme. The lines are drawn too, you need not tikz. The size is controlled by the diaw parameter. It is set to 1.5cm in this example.

% definition
newdimendiaw diaw=1.5cm
defdiamondscheme#1#2#3#4{%
    vbox todiaw{
       kern-1ex
       hbox todiaw{hss$#1$hss}
       vss
       hbox todiaw{hbox to0pt{hss$#2$hss}hss
                     raise.7exhbox{diacross}hss
                     hbox to0pt{hss$#3$hss}}
       vss
       hbox todiaw{hss$#4$hss}
       kern-1ex
    }
}
newcounttmpnum 
tmpnum=diaw 
dividetmpnum by65781  % tmpnum is now equal to diaw in bp units
dividetmpnum by2
deftmp{thetmpnumspace}
edefdiacross{pdfliteral
   {q 0.4 w -tmp tmp m tmp -tmp l S -tmp -tmp m tmp tmp l S Q}}

begin{tasks}
[style=enumerate](2)
% Prob #1
task $dfrac{10k^2+32k+24}{15k+18}$
begin{solutionorbox}[5cm]
Factor 2 out of the numerator.bigskip

$dfrac{2(5k^2+16k+12)} {15k+18}$bigskip

Now factor the numerator using diamond method. 
bigskip
%call diamondscheme macro
hspace{2cm}
diamondscheme{60}{10}{6}{16}
bigskip
The 5 in front of $5k^2$ means this is a non-monic quadratic trinomial. So use the box method to complete the factorization.

newcommandmcc[1]{multicolumn{1}{c}{#1}} 
hspace{1cm}
renewcommandarraystretch{2}
begin{tabular}{ c | c | c | }
  mcc{} & mcc{textcolor{red}{$5k$}} & mcc{textcolor{red}{$+6$}} 
    cline{2-3}
 textcolor{red}{$k$} & $5k^2$ & $6$ 
    cline{2-3}
 textcolor{red}{$+2$} & $10k$ & $12$ 
    cline{2-3}
end{tabular}

vspace{0.2cm}
Numerator factors to $color{red}dfrac{(5k+6)(k+2)}{color{black} 15k+18}$ 

Now factor the bottom:

hspace{2cm}$3(5k+6)$
vspace{0.25cm}

Cancel common factors (this creates a HOLE in the graph):

hspace{2cm}
$dfrac{cancel{(5k+6)}(k+2)}{3cancel{(5k+6)}}$ 
vspace{0.25cm}

Simplified form: $dfrac{(k+2)}{3}$

textcolor{blue}{textbf {Reminder:}}

textbf{Zeros occur on top} (in the numerator).

textbf{VA's (vertical asymptotes) are restrictions in the denominator}...to prevent division by $0$.

textcolor{red}
{Zeros: $k=-2$}

textcolor{red}
{Holes: $k=-6/5$}

textcolor{red}
{VA: $none$}

end{solutionorbox}

vspace{0.25cm}
% Prob #1
task $dfrac{5k^2+10k+24}{6k+12}$
begin{solutionorbox}[5cm]
step-by-step solution goes here
end{solutionorbox}
end{tasks}
end{document}

One Answer

I don't know if I have well understood the problem!

May be you can modify the tasks environment options like this:

settasks{after-item-skip=1em,
      after-skip=2cm,
      label-width=1.5em, % <---------
      item-indent=2em,  % <----------
      label=(arabic*),
      column-sep=1em % <----------
      }

enter image description here

The figure is from the tasks package documentation

The complete code

documentclass[12pt]{exam}

printanswers
% un-comment to print solutions.
renewcommand{solutiontitle}{}

usepackage{multirow, tabularx}
newcolumntype{C}{>{centeringarraybackslash}X}
usepackage[table]{xcolor}
usepackage{amsmath}
usepackage{cancel}
usepackage{framed}
usepackage{multicol}
usepackage{tasks}
usepackage[a4paper,margin=0.5in,include head]{geometry}

everymath{displaystyle}
setlengthparindent{1em}

pagestyle{head}
header{Algebra II Review Ch 3.2: Operations Rational Expressions and Equations: K E Y}
       {}
       {01/13-14/21} 

newcommand{pagetop}{%
noindent 
  fbox{fbox{parbox{dimexprtextwidth-4fboxsep-4fboxrule}{
    textbf {Obj. 3.2.a: I can simplify factored rational expressions and find their restrictions.
    bigskip
    bigskipSimplify expression and state the excluded values (+1 pt numerator, +1 pt denominator, +1 pt restrictions.) each equation. Show all work/steps on this page.}
  }}}
  bigskip
  vspace{0.5mm}
}

settasks{after-item-skip=1em,
          after-skip=2cm,
          label-width=1.5em, %<---------
          item-indent=2em,  % <---------
          label=(arabic*),
          column-sep=1em   %  <----------
          }
% ------------ DOCUMENT STARTS HERE---------- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
begin{document}

%definition for bigskip = 1 line to replace all bigskip
defbigskip{vskipbigskipamount}

%macro diamondscheme. The lines are drawn too, you need not tikz. The size is controlled by the diaw parameter. It is set to 1.5cm in this example.

% definition
newdimendiaw diaw=1.5cm
defdiamondscheme#1#2#3#4{%
    vbox todiaw{
       kern-1ex
       hbox todiaw{hss$#1$hss}
       vss
       hbox todiaw{hbox to0pt{hss$#2$hss}hss
                     raise.7exhbox{diacross}hss
                     hbox to0pt{hss$#3$hss}}
       vss
       hbox todiaw{hss$#4$hss}
       kern-1ex
    }
}
newcounttmpnum 
tmpnum=diaw 
dividetmpnum by65781  % tmpnum is now equal to diaw in bp units
dividetmpnum by2
deftmp{thetmpnumspace}
edefdiacross{pdfliteral
   {q 0.4 w -tmp tmp m tmp -tmp l S -tmp -tmp m tmp tmp l S Q}}

begin{tasks}
[style=enumerate](2)
% Prob #1
task $dfrac{10k^2+32k+24}{15k+18}$
begin{solutionorbox}[5cm]
Factor 2 out of the numerator.bigskip

$dfrac{2(5k^2+16k+12)} {15k+18}$bigskip

Now factor the numerator using diamond method. 
bigskip
%call diamondscheme macro
hspace{2cm}
diamondscheme{60}{10}{6}{16}
bigskip
The 5 in front of $5k^2$ means this is a non-monic quadratic trinomial. So use the box method to complete the factorization.

newcommandmcc[1]{multicolumn{1}{c}{#1}} 
hspace{1cm}
renewcommandarraystretch{2}
begin{tabular}{ c | c | c | }
  mcc{} & mcc{textcolor{red}{$5k$}} & mcc{textcolor{red}{$+6$}} 
    cline{2-3}
 textcolor{red}{$k$} & $5k^2$ & $6$ 
    cline{2-3}
 textcolor{red}{$+2$} & $10k$ & $12$ 
    cline{2-3}
end{tabular}

vspace{0.2cm}
Numerator factors to $color{red}dfrac{(5k+6)(k+2)}{color{black} 15k+18}$ 

Now factor the bottom:

hspace{2cm}$3(5k+6)$
vspace{0.25cm}

Cancel common factors (this creates a HOLE in the graph):

hspace{2cm}
$dfrac{cancel{(5k+6)}(k+2)}{3cancel{(5k+6)}}$ 
vspace{0.25cm}

Simplified form: $dfrac{(k+2)}{3}$

textcolor{blue}{textbf {Reminder:}}

textbf{Zeros occur on top} (in the numerator).

textbf{VA's (vertical asymptotes) are restrictions in the denominator}...to prevent division by $0$.

textcolor{red}
{Zeros: $k=-2$}

textcolor{red}
{Holes: $k=-6/5$}

textcolor{red}
{VA: $none$}

end{solutionorbox}

vspace{0.25cm}
% Prob #1
task $dfrac{5k^2+10k+24}{6k+12}$
begin{solutionorbox}[5cm]
step-by-step solution goes here
end{solutionorbox}
end{tasks}
end{document}

Correct answer by Hafid Boukhoulda on February 17, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP