答案1
以下是使用包leftidx
和否定版本执行此操作的方法:stackinset
stackengine
\documentclass{article}
\usepackage{leftidx}
\usepackage{stackengine, graphicx}
\newcommand{\divides}[2]{\leftidx{^{#1}}{\Big\vert}{_{#2}}}
\newcommand{\ndivides}[2]{\leftidx{^{#1}}{\nBigvert}{_{#2}}}
\newcommand{\nBigvert}{\stackMath\mathord{\stackinset{l}{0.15ex}{c}{0ex}{\rotatebox{45}{$\relbar $}}{\Big\vert}}}
\begin{document}
$\divides{\mathsf{a}\mkern-1.5mu}{\mathsf{b}}\quad \ndivides{\mathsf{b}\mkern-1.5mu}{\mathsf{a}}$
\end{document}