If you want to create an image or to see the result of a #LaTeX snippet, but do not want a whole paper! just the result: use the standalone class. See [1,2].
[1] https://ctan.org/pkg/standalone
[2] https://ondahostil.wordpress.com/2020/02/04/lo-que-he-aprendido-la-clase-standalone/ @ondiz

