Specifically, the portion and chapter commands are only obtainable in the report and ebook document courses. $$ is TeX primitive syntax, which, as Other people have commented is tough to redefine (in classic TeX there's no command name which triggers coming into or leaving display math). This example creates output https://gdblogaccount1.wixsite.com/fashion-latex