Indeed, if you go through the simple “Hello world”  TEX4ht example outlined below and study the HTML code, you can see how LATEX commands such as \LaTeX{} are constructed internally, because TEX4ht works on such a low level.