在 amsmath 中使用 \bm 与 \dfrac 时出现问题

在 amsmath 中使用 \bm 与 \dfrac 时出现问题

请告诉我为什么 \bm 和 amsmath 中的 \dfrac 不能很好地配合。

此代码\hl{$=\bm{\frac{7\sqrt[3]{2}}{2}}$}产生:

在此处输入图片描述

\hl{$=\bm{\dfrac{7\sqrt[3]{2}}{2}}$}会导致编译器崩溃。

我之所以使用它是\dfrac因为在我看来得到的分数更容易阅读。

那么为什么\bm不兼容\dfrac

非常感谢您的帮助!

母语:

\documentclass[11pt]{exam}
\printanswers
% un-comment to print solutions.
\renewcommand{\solutiontitle}{}
\usepackage{amsmath}
\usepackage{bm}
\usepackage{framed}
\usepackage{multicol}
\usepackage{tasks}
\usepackage[a4paper,margin=0.5in,include head]{geometry}
\usepackage{soul}
\usepackage{xcolor}
\thispagestyle{myheadings}
\markright{\normalfont\textbf{Algebra II: Unit 12 Radical Expressions Other Roots 12 AB 2}\hfill  04/17/23} 

\newcommand{\pagetop}{%
    \noindent 
    
    \bigskip
    \vspace{0.5mm}
}

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

%**************************************************** only this code was added/ modified
\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, % numbers in bold added <<<<<<<<<<
    label=(\arabic*), % 
    label-offset = -\lwidth,% added <<<<<
    item-format = \hspace{\lwidth},% added <<<<<
    column-sep=2em,    % changed <<<<<<<<<  
}
%****************************************************

\begin{document}
    %definition for bigskip = 1 line to replace all \bigskip
    \def\bigskip{\vskip\bigskipamount}
    
    \textbf{Simplify.}
    \begin{tasks}
        [style=enumerate](3)
% Prob #1
\task 
$\sqrt[3]{8}$
\vspace{3mm}
\begin{solutionorbox}[3cm]
$8$ is a perfect cube.
    \bigskip
\hl{$\bm{\sqrt[3]{8}=2}$}
\end{solutionorbox}
\vspace{0.25cm}

% Prob #2
\task 
$\sqrt[3]{250}$
\vspace{3mm}
\begin{solutionorbox}[3cm]
Find perfect cube factor of $250$
\bigskip
$=(\sqrt[3]{125})(\sqrt[3]{2})$
\bigskip
    \hl{$=\bm{5\sqrt[3]{2}}$}
\end{solutionorbox}
\vspace{0.25cm}

% Prob #3
\task 
$\sqrt[4]{64}$
\vspace{3mm}
\begin{solutionorbox}[3cm]
Prime factorization of $64=2^6$
\bigskip
$\sqrt[4]{2^6}=(\sqrt[4]{2^4})(\sqrt[4]{2^4})$
\bigskip
$=2\sqrt[4]{2^2}$
\bigskip
$=2\bm{\cdot}2^{2\bm{\div}4}$
\bigskip
\hl{$=\bm {2{\sqrt{2}}}$}
\end{solutionorbox}
\vspace{0.25cm}


% Prob #12
\task 
$\dfrac{7}{\sqrt[3]{2}}$ 
\vspace{3mm}
\begin{solutionorbox}[3cm]
$=\dfrac{7}{\sqrt[3]{2}}\bm{\cdot}\dfrac{\sqrt[3]{2^2}}{\sqrt[3]{2^2}}$
\bigskip
$=\dfrac{7\sqrt[3]{2^2}}{(\sqrt[3]{2})(\sqrt[3]{2^2})}$
\bigskip
$=\dfrac{7\sqrt[3]{2^2}}{\sqrt[3]{2^3}}$
\bigskip
\hl{$=\bm{\frac{7\sqrt[3]{2}}{2}}$}
\end{solutionorbox}
\vspace{0.25cm}


\newpage

\end{tasks}
\end{document} 

答案1

不要使用\dfrac; 而是改变

\hl{$=\bm{\frac{7\sqrt[3]{2}}{2}}$}

\hl{$\displaystyle=\bm{\frac{7\sqrt[3]{2}}{2}}$}

但是,高亮带无法覆盖整个表情。到目前为止,更好的方法是

\colorbox{yellow}{$\displaystyle=\bm{\frac{7\sqrt[3]{2}}{2}}$}

在此处输入图片描述

\documentclass[11pt]{exam}
\usepackage{amsmath,bm}
\usepackage{soul}   % for \hl macro
\usepackage{xcolor} % for \colorbox macro

\begin{document}
\hl{$=\bm{\frac{7\sqrt[3]{2}}{2}}$}
\qquad
\hl{$\displaystyle=\bm{\frac{7\sqrt[3]{2}}{2}}$}
\qquad
\colorbox{yellow}{$\displaystyle=\bm{\frac{7\sqrt[3]{2}}{2}}$}
\end{document}

相关内容