TransWikia.com

empheq amsart enumerate error

TeX - LaTeX Asked by Math-user on January 20, 2021

I have started using the empheq package and run into some issues. The following compiles normally:

documentclass[fleqn]{article}
usepackage{empheq}
usepackage{xcolor}
newcommand*mybluebox[1]{colorbox{blue!20}{hspace{1em}#1hspace{1em}}}

begin{document}
begin{enumerate}
item We have
begin{empheq}[box=mybluebox]{equation}
f(x)=g(x)
end{empheq}
begin{empheq}[box=mybluebox]{align}
f(x)=f(x)=g(x)
end{empheq}
item etc.
end{enumerate}
end{document}

Result:

enter image description here

On the other hand, in the amsart class, there is a glitch with the align environment and empheq (which does not seem to appear with the equation environment), namely, replacing the class with

documentclass[fleqn]{amsart}

messes up the empheq environment. Does anybody have an idea of how to fix it?
enter image description here

One Answer

Not really an answer, but need more space

Update 2020/03/18: Updated fix. Though this does not work with the flalign env

documentclass[fleqn]{amsart}
usepackage{empheq}
usepackage{xcolor}
newcommand*mybluebox[1]{colorbox{blue!20}{hspace{1em}#1hspace{1em}}}

usepackage{xpatch}
MHInternalSyntaxOn
defEQ_initialize:{%
  m@th
  MH_let:NwNSetTagPlusEndMarkEQ_tag_plus_endmark:
  MH_let:NwNSetOnlyEndMarkEQ_only_endmark:
  l_EQ_temp_linewidth_dimlinewidth
  @tempdimaz@
  begingroup
  ifdefinedfullwidthdisplayrelax
    fullwidthdisplay
    global@tempdimadisplaywidth
  fi
  endgroup
  ifdim@tempdima>linewidthrelax
    l_EQ_temp_linewidth_dim@tempdima
  fi
  @tempdimaz@
  g_EQ_toprow_height_dimz@
  g_EQ_bottomrow_depth_dimz@
  g_EQ_toptag_height_dimz@
  g_EQ_bottomtag_depth_dimz@
  g_EQ_widesttag_dimz@
  xdefg_EQ_latest_nonzerodepth_row_fint{z@}
  edefEQ_restore_tex_delimiter:{%
    delimiterfactorthedelimiterfactor
    delimitershortfallthedelimitershortfallrelax}%
  g@addto@macroEQ_complete_mathdisplay:
                EQ_restore_tex_delimiter:
  delimitershortfallEmphEqdelimitershortfall
  delimiterfactorEmphEqdelimiterfactor
  MH_let:NwNintertext@EQ_intertext:
  EQ_displaybreak:}


% trick to see what empheq is typesetting
%defEQ_use_mathdisplay:{%
%  EQ_outerbox:{fbox{usebox{EQ_mathdisplay_box}}}}

MHInternalSyntaxOff

begin{document}
begin{enumerate}
item We have
begin{empheq}[box=mybluebox]{equation}
f(x)=g(x)
end{empheq}
begin{empheq}[box=mybluebox]{align}
f(x)=f(x)=g(x)
end{empheq}
item no empheq
  begin{equation}
    f(x)=g(x)
  end{equation}
  begin{align}
    f(x)=f(x)=g(x)
end{align}
end{enumerate}
end{document}

Answered by daleif on January 20, 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