Problems with in_header, \usepackage{cancel} for Rmarkdown. Cancel package not working/recognized

Glad you found a solution.

About the preview, this is HTML math I believe using MathJax. Not all packages and command are known by default. So this \cancel is not recognized by mathjax.

Mathjax support some packages including this ones cancel — MathJax 3.2 documentation

However for the preview it is not easy to setup to make it work.

Easy way is to use

$$
\require{cancel}
\cancel{\binom{n}{s}}
$$

and this should preview ok but no compile in PDF.

To change the mathjax configuration of the preview is not something I know how to do. This would probably be a feature request for the IDE.

2 Likes