2

The mwe code below compiles and produces the desired layout.

However, the log shows 3 errors which I can't find after going through the code several times.

Your assistance identifying the source of these errors is greatly appreciated.

Log errors:

enter image description here

enter image description here

enter image description here

mwe

\documentclass[12pt]{exam}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{framed} %box para
\usepackage{multicol}
\usepackage{tasks}
\usepackage{cancel}
\usepackage[margin=0.5in]{geometry}

%\usepackage{bm}%bold equation
\setlength{\parindent}{0pt} % removes paragraph indentation

\pagestyle{head}
\header{Algebra II: Assignment 11-A\&B}
       {}
       {Due 03/23/2023} 

\newcommand{\pagetop}{%
  %\makebox[\textwidth]%{Name:\enspace\hrulefill}\par
  \vspace{4mm}
  \fbox{\fbox{\parbox{\dimexpr\textwidth-4\fboxsep-4\fboxrule}{
    \textbf {Simplify each expression.}
    %\par
    %\bigskip

  }}}\par
  \vspace{0.5mm}
}
\setlength{\jot}{1em}  
\begin{document}
\pagetop

\settasks{
    after-item-skip=3em,    after-skip=2cm,
    label-width=2em,
    item-indent=3em,
    label=(\arabic*),
    column-sep=2em
}
\begin{tasks}(2)
%Prob #1
\task \(\begin{aligned}[t]
&\dfrac{15n+10}{35} \\
& \hspace{2em}\begin{aligned}[t]
&=\dfrac{5(3n+2)}{7\cdot5} \\
&=\dfrac{\cancel{5}(3n+2)}{7\cdot\cancel{5}} \\
&=\fbox{\dfrac{3n+2}{7}}
\end{aligned}
\end{aligned}\)
%Problem #2
\task \(\begin{aligned}[t]
&\dfrac{x^2+8x+15}{x+3} \\
& \hspace{2em}\begin{aligned}[t]
&=\dfrac{(x+3)(x+5)}{(x+3)} \\
&=\dfrac{\cancel{(x+3)}(x+5)}{\cancel{(x+3)}}\\
&=\fbox{{x+5}}
\end{aligned}
\end{aligned}\)

%Problem #3

%Problem 4

%Problem 5

%Problem 6
       
\end{tasks}
\end{document}```

1 Answer 1

4

\fbox is a text-mode macro and assumes its content to be text, not math: using \dfrac in it leads to the error, though TeX's error recovery manages to give you a more or less correct looking result (though you'll see that spacing is off). Stripping everything unrelated, the problem boils down to

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\fbox{\dfrac{3n+2}{7}}$
$\fbox{{x+5}}$
\end{document}

enter image description here

Notice, however, that while the second formula doesn't throw any error it's actually wrong, since it's not in math mode. For boxing formulas you should use amsmath's \boxed

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\boxed{\dfrac{3n+2}{7}}$
$\boxed{x+5}$
\end{document}

enter image description here

3
  • Perfect fix! Thanks also for your very helpful explanation of \fbox vs \boxed . That tip will help me avoid problems with future projects. Commented Mar 22, 2023 at 18:26
  • @SiuslawMath You're welcome. \boxed{...} uses \fbox internally, in fact it is basically just \fbox{$\displaystyle...$}. Commented Mar 22, 2023 at 18:28
  • At the risk of imposing on your generosity, could you possibly look at this LaTeX project (a step-by-step solution for factoring polynomials). It's a resource for my high school Alg II students. The code is a bit of a mess. Thank you! tex.stackexchange.com/questions/679746/… Commented Mar 22, 2023 at 18:45

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.