2

In the project below, I want to shift from 4 cols to 3 cols:

  1. For probs #1-4, I want 4 columns. That command is working: [style=enumerate](4)

Beginning with problem #5, I need to switch to 3 cols to allow for wider solution boxes. The enumeration should continue, e.g. 5, 6, 7, etc.

Changing the code to [style=enumerate](3) failed to render the desired 3 col formatting.

enter image description here

enter image description here

Thanks very much for taking time to review and respond to this post!

mwe:

\documentclass[12pt]{exam}
\printanswers
% un-comment to print solutions.
\renewcommand{\solutiontitle}{}
\usepackage{amsmath}
\usepackage{cancel}
\usepackage{framed}
\usepackage{bm}
\usepackage{multicol}
\usepackage[nice]{nicefrac}
\usepackage{tasks}
\usepackage[a4paper,margin=0.5in,include head]{geometry}
\usepackage{color}
\usepackage{soul}
\pagestyle{head}
\header{Algebra II: Unit 13 A\&B Fractional Exponents}
{}
{Due 05/02/23} 

\newcommand{\pagetop}{%
 }
\newlength{\lwidth}% added <<<<<
\settowidth{\lwidth}{(99)\enspace} % added

\settasks{after-item-skip=1em,
    after-skip=2cm,
    label-width=\lwidth, % changed <<<<<<<<<
    item-indent=0pt,   % changed <<<<<<<<<<
    %label-format = \bfseries, 
    %add \bf to make numbers bold <<<<<<<<<<
    label=(\arabic*), % 
    label-offset = -\lwidth,% added <<<<<
    item-format = \hspace{\lwidth},% added <<<<<
    column-sep=2em,    % changed <<<<<<<<<  
}
\makeatletter
\renewcommand{\fullwidth}[1]{%
    \vbox{%     
        \leftskip=-\lwidth \rightskip=0pt
        \advance\linewidth\@totalleftmargin%
        \@totalleftmargin=0pt%
        #1}%
    \nobreak
}
\makeatother

%******************************************** added <<<<<<<<<<
\newlength{\SolutionSpace}
\ifthenelse{\boolean{printanswers}}
{\setlength{\SolutionSpace}{5cm}
    \colorsolutionboxes 
    \definecolor{SolutionBoxColor}{gray}{0.8}}% solutions are printed
{\setlength{\SolutionSpace}{0cm}
    \colorsolutionboxes 
    \definecolor{SolutionBoxColor}{gray}{1}}% solutions are not being printed
%*********************************************
\begin{document}
%definition for bigskip = 1 line to replace all \bigskip
\def\bigskip{\vskip\bigskipamount}
\begin{tasks}
[style=enumerate](4)
\task![]\fullwidth{\textbf{Show all work on separate paper.}}
\bigskip
\task![]\fullwidth{\textbf{Change to log form.}}

\task![]\fullwidth{\textbf{Change to exponential form.}}
[style=enumerate](3)
%%% Prob #9
\task
$\log_{3}{9}=2$
\begin{solutionorbox}[\SolutionSpace]
\colorbox{yellow}{$3^2=9$}
\end{solutionorbox}
\vspace{0.25cm}
%%% Prob #10
\task
$\log_{4}{16}=2$
\begin{solutionorbox}[\SolutionSpace]
\colorbox{yellow}{$4^2=16$}
\end{solutionorbox}
\vspace{0.25cm}
%%% Prob #11
\task
$\log_{b}{c}=a$
\begin{solutionorbox}[\SolutionSpace]
\colorbox{yellow}{$b^a=c$}
\end{solutionorbox}
\vspace{0.25cm}
%%% Prob #12
\task
$\log_{c}{r}=n$
\begin{solutionorbox}[\SolutionSpace]
\colorbox{yellow}{$c^n=r$}
\end{solutionorbox}
\vspace{0.25cm}
%%%%%
\task![]\fullwidth{\textbf{Solve for $x$}}
%%% Prob #19
\task
$\log_{2}{(1/8)}=x$
\begin{solutionorbox}[\SolutionSpace]
Apply the log rule:\bigskip
$\log{a}{(1/x)}=-\log_{a}{x}$
\bigskip
$-\log_{2}{8}=x$
\bigskip
Rewrite 8 in exponential form $=2^3$
\bigskip
$-\log_{2}{2^3}=x$
\bigskip
Roll the exponent.
\bigskip
$-3\log_{2}{2}=x$
\bigskip
Apply log rule" $\log_{a}{a}=1$
\colorbox{yellow}{$x=-3$}
\end{solutionorbox}
%%% Prob #20
\task
$8^{x-4}=204$
\begin{solutionorbox}[\SolutionSpace]
With no common base, we must take the log of both sides:
\bigskip
$\log_{}8^{(x+1)}=\log_{}{208}$
\bigskip
Now apply log rule:
\medskip
$\log_{a}{x^b}=b\log_{a}{x}$
\bigskip
$(x+1)\log_{}{8}=1\log_{}208$
\bigskip
$\dfrac{(x+1)\log_{}{8}}{\log_{}{8}}=\dfrac{\log_{}208}{\log_{}{8}}$
\bigskip
\colorbox{yellow}{$x=3$}
\end{solutionorbox}
%%% Prob #21
\task
\begin{solutionorbox}[\SolutionSpace]
$4^{x-1}=4^2$\bigskip
$x-1=2$
\colorbox{yellow}{$x=3$}
\end{solutionorbox}
%%% Prob #22
\task
\begin{solutionorbox}[\SolutionSpace]
$4^{x-1}=4^2$\bigskip
$x-1=2$
\colorbox{yellow}{$x=3$}
\end{solutionorbox}

\end{tasks}
\end{document}
4
  • 1
    Stack sites work best when you keep things to one question per post. For #2, you've typed \nl, so I'm not sure what's confusing you. (And please post code that corresponds to your image: $8^{x-4}=204$ is problem #20 in your code.
    – Teepeemm
    May 8, 2023 at 19:46
  • 1
    The M in MWE stands for "minimal". May 8, 2023 at 19:50
  • @JohnKormylo Noted. Thanks for the reminder. I deleted several of the problems to slim down the code. May 8, 2023 at 20:09
  • @Teepeemm I have taken your words to heart and delete the second question re: natural log. Thank you! May 8, 2023 at 20:20

1 Answer 1

1

In order to change the number of "columns" you need to stop and restart tasks. Note the use of \lasttask to reset the counter (task).

\documentclass[12pt]{exam}
\printanswers
% un-comment to print solutions.
\renewcommand{\solutiontitle}{}
\usepackage{amsmath}
\usepackage{cancel}
\usepackage{framed}
\usepackage{bm}
\usepackage{multicol}
\usepackage[nice]{nicefrac}
\usepackage{tasks}
\usepackage[a4paper,margin=0.5in,include head]{geometry}
\usepackage{color}
\usepackage{soul}
\pagestyle{head}
\header{Algebra II: Unit 13 A\&B Fractional Exponents}
{}
{Due 05/02/23} 

\newcommand{\pagetop}{%
 }
\newlength{\lwidth}% added <<<<<
\settowidth{\lwidth}{(99)\enspace} % added

\settasks{after-item-skip=1em,
    after-skip=2cm,
    label-width=\lwidth, % changed <<<<<<<<<
    item-indent=0pt,   % changed <<<<<<<<<<
    %label-format = \bfseries, 
    %add \bf to make numbers bold <<<<<<<<<<
    label=(\arabic*), % 
    label-offset = -\lwidth,% added <<<<<
    item-format = \hspace{\lwidth},% added <<<<<
    column-sep=2em,    % changed <<<<<<<<<  
}
\makeatletter
\renewcommand{\fullwidth}[1]{%
    \vbox{%     
        \leftskip=-\lwidth \rightskip=0pt
        \advance\linewidth\@totalleftmargin%
        \@totalleftmargin=0pt%
        #1}%
    \nobreak
}
\makeatother

%******************************************** added <<<<<<<<<<
\newlength{\SolutionSpace}
\ifthenelse{\boolean{printanswers}}
{\setlength{\SolutionSpace}{5cm}
    \colorsolutionboxes 
    \definecolor{SolutionBoxColor}{gray}{0.8}}% solutions are printed
{\setlength{\SolutionSpace}{0cm}
    \colorsolutionboxes 
    \definecolor{SolutionBoxColor}{gray}{1}}% solutions are not being printed
%*********************************************
\begin{document}
%definition for bigskip = 1 line to replace all \bigskip
\def\bigskip{\vskip\bigskipamount}
\begin{tasks}
[style=enumerate](4)
\task![]\fullwidth{\textbf{Show all work on separate paper.}}
\bigskip
\task![]\fullwidth{\textbf{Change to log form.}}
%%% Prob #1
\task 
$2^4=16$
\begin{solutionorbox}[\SolutionSpace]
\colorbox{yellow}{$\log16_{2} =4$}
\end{solutionorbox}
\vspace{0.25cm}
%%%%
%%%%Prob #2
\task 
$3^3=27$
\begin{solutionorbox}[\SolutionSpace]
\colorbox{yellow}{$\log27_{3}=3$}
\end{solutionorbox}
\vspace{0.25cm}
%%%Prob #3
\task 
$a^2=b$
\begin{solutionorbox}[\SolutionSpace]
\colorbox{yellow}{$\log{a}_{b}=2$}
\end{solutionorbox}
\vspace{0.25cm}
%%% Prob #4
\task 
$c^r=m$
\begin{solutionorbox}[\SolutionSpace]
\colorbox{yellow}{$\log{c}_{m}=r$}
\end{solutionorbox}
%\vspace{0.25cm}
\end{tasks}\unskip
\edef\lasttask{\arabic{task}}%
\begin{tasks}[style=enumerate](3)
\task![]\fullwidth{\textbf{Change to exponential form.}}%
\setcounter{task}{\lasttask}
%%% Prob #9
\task
$\log_{3}{9}=2$
\begin{solutionorbox}[\SolutionSpace]
\colorbox{yellow}{$3^2=9$}
\end{solutionorbox}
\vspace{0.25cm}
%%% Prob #10
\task
$\log_{4}{16}=2$
\begin{solutionorbox}[\SolutionSpace]
\colorbox{yellow}{$4^2=16$}
\end{solutionorbox}
\vspace{0.25cm}
%%% Prob #11
\task
$\log_{b}{c}=a$
\begin{solutionorbox}[\SolutionSpace]
\colorbox{yellow}{$b^a=c$}
\end{solutionorbox}
\vspace{0.25cm}
%%% Prob #12
\task
$\log_{c}{r}=n$
\begin{solutionorbox}[\SolutionSpace]
\colorbox{yellow}{$c^n=r$}
\end{solutionorbox}
\vspace{0.25cm}
%%%% Prob #13
\task
$\log_{4}{(1/4)=-1}$
\begin{solutionorbox}[\SolutionSpace]
\colorbox{yellow}{$4^{-1}=1/4$}
\end{solutionorbox}
\vspace{0.25cm}
%%% Prob #14
\task
$\log_{6}{36}=2$
\begin{solutionorbox}[\SolutionSpace]
\colorbox{yellow}{$6^2=36$}
\end{solutionorbox}
\vspace{0.25cm}
%%%%%
\task![]\fullwidth{\textbf{Solve for $x$}}
%%% Prob #15
\task
$\log_{5}{25}=x$
\begin{solutionorbox}[\SolutionSpace]
\colorbox{yellow}{$x=2$}
\end{solutionorbox}
%%% Prob #16
\task
$\log_{9}{81}=x$
\begin{solutionorbox}[\SolutionSpace]
\colorbox{yellow}{$x=2$}
\end{solutionorbox}
%%% Prob #17
\task
$\log_{4}{2}=x$
\begin{solutionorbox}[\SolutionSpace]
\colorbox{yellow}{$x=16$}
\end{solutionorbox}
%%% Prob #18
\task
$\log_{1/2}{(1/2)}=x$
\begin{solutionorbox}[\SolutionSpace]
\colorbox{yellow}{$x=1$}
\end{solutionorbox}
%%% Prob #19
\task
$4^{x-1}=16$
\begin{solutionorbox}[\SolutionSpace]
$4^{x-1}=4^2$\bigskip
$x-1=2$
\colorbox{yellow}{$x=3$}
\end{solutionorbox}
%%% Prob #20
\task
$8^{x-4}=204$
\begin{solutionorbox}[\SolutionSpace]
\parskip=1ex
Take the natural log of both sides:
\par
$\ln8^{(x+1})=\ln{204}$
\par
apply log rule:
\par
$\log_{a}{x^b}=b\log_{a}{x}$
\par
$(x-4)\ln(8) = \ln(204)$
\par
$x-4=2.557$
\colorbox{yellow}{$x=6.557$}
\end{solutionorbox}
\end{tasks}
\end{document}
2
  • Thanks very much for the fix! If possible, could you briefly explain the inclusion of \edef and unskip? Have not seen those before. May 8, 2023 at 20:35
  • \edef (and \xdef) expand immediately. To illustrate, if I had use \def or \newcommand then \setcounter{task}{\lasttask} would have used the current value for \c@task which is 0. \unskip will sometines undo the last \skip command (similar of \unvbox and \unhbox). May 9, 2023 at 12:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .