TeX - LaTeX Asked by Hyperplane on August 13, 2021
I recently needed to cover some over- and underbrace and found a solution here: Beamer: Uncover underbrace
However, I was not 100% satisfied with the offered solutions, in particular, my goal was to create commands underbrace<>{}_{}
and overbrace<>{}^{}
that should just work like you’d expect, with no additional restrictions on overlay specifications or content. I succeeded doing this for underbrace
[A], although I do not know exactly why my solution works (I was very surprised it did!) However, to my even bigger surprise, it does not work with overbrace
! However, it turned out it would again with a slight modification – which again I do not understand why it works at all in one case but not the other. The crucial part of the code is:
% underbrace version A
onslide<#1>underbrace{onslide<1->#2}_{#3}onslide
% underbrace version B
underbrace{#2onslide<#1>}_{#3}onslide
% overbrace version A
onslide<#1>overbrace{onslide<1->#2}^{#3}onslide
% overbrace version B
overbrace{#2onslide<#1>}^{#3}onslide
The only combination that works as intended is underbrace version B and overbrace version A. But why? EDIT: I just noted, for overset
and underset
one has to do it the other way round! Full MWE:
documentclass{beamer}
setbeamercovered{transparent}
usepackage{xparse}
DeclareDocumentCommand{ubraceA}{d<> m e{_}}{%
IfValueTF{#1}{% IF <overlay-specification> given
onslide<#1>underbrace{onslide<1->#2}_{#3}onslide
}{% ELSE
underbrace{#2}_{#3}
}%
}%
DeclareDocumentCommand{ubraceB}{d<> m e{_}}{%
IfValueTF{#1}{% IF <overlay-specification> given
underbrace{#2onslide<#1>}_{#3}onslide
}{% ELSE
underbrace{#2}_{#3}
}%
}%
DeclareDocumentCommand{obraceA}{d<> m e{^}}{%
IfValueTF{#1}{% IF <overlay-specification> given
onslide<#1>overbrace{onslide<1->#2}^{#3}onslide
}{% ELSE
overbrace{#2}^{#3}
}%
}%
DeclareDocumentCommand{obraceB}{d<> m e{^}}{%
IfValueTF{#1}{% IF <overlay-specification> given
overbrace{#2onslide<#1>}^{#3}onslide
}{% ELSE
overbrace{#2}^{#3}
}%
}%
begin{document}
begin{frame}{underA, overA}
begin{align*}
ubraceA<5->{p(xmid y)}_{text{posterior}}
= frac{obraceA<2->{p(ymid x)}^{text{likelihood}}
,obraceA<3->{p(x)}^{text{prior}}
}{ubraceA<4->{p(y)}_{text{evidence}}}
end{align*}
end{frame}
%
begin{frame}{underA, overB}
begin{align*}
ubraceA<5->{p(xmid y)}_{text{posterior}}
= frac{obraceB<2->{p(ymid x)}^{text{likelihood}}
,obraceB<3->{p(x)}^{text{prior}}
}{ubraceA<4->{p(y)}_{text{evidence}}}
end{align*}
end{frame}
%
begin{frame}{underB, overA}
begin{align*}
ubraceB<5->{p(xmid y)}_{text{posterior}}
= frac{obraceA<2->{p(ymid x)}^{text{likelihood}}
,obraceA<3->{p(x)}^{text{prior}}
}{ubraceB<4->{p(y)}_{text{evidence}}}
end{align*}
end{frame}
%
begin{frame}{underB, overB}
begin{align*}
ubraceB<5->{p(xmid y)}_{text{posterior}}
= frac{ obraceB<2->{p(ymid x)}^{text{likelihood}}
,obraceB<3->{p(x)}^{text{prior}}
}{ubraceB<4->{p(y)}_{text{evidence}}}
end{align*}
end{frame}
end{document}
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP