答案1
\documentclass{article}
\usepackage{amsmath}
\makeatletter
\newcommand{\evalat}[2]{\mathpalette\eval@at{{#1}{#2}}}
\newcommand{\eval@at}[2]{\eval@@at#1#2}
\newcommand{\eval@@at}[3]{%
#2\,
{%
\sbox0{$#1\left|#2\right|$}%
\vrule height \ht0 depth \dimexpr\dp0+1ex\relax
}_{\,#3}
}
\makeatother
\begin{document}
\[
\evalat{x}{x\gets5}
\qquad
\evalat{\frac{x+1}{x-1}}{x\gets2}
\]
\end{document}