I want to create a command \points
working in both math and text mode. Unfortunately I still have problems creating the correct (horizontal) spacing after several attempts. Here is my basic „setup“, where I am missing space before \points{3}
inside math mode.
Code
\documentclass{article}
\usepackage{amsmath}
\usepackage{xparse}
\DeclareDocumentCommand \points { m } {\text{[#1\,P]}}
\begin{document}
Sentence end \points{1}. Between \points{2} words.
$x^2 + 9 = 0 \points{3}$
\end{document}
macro
...