## Problem Similar changes required to PR #1476 in pgmpy/pgmpy repo. ## Suggested solution Need to remove spaces between "$" characters and latex expressions for nbsphinx to interpret correctly when generating html output. Will create PR shortly.