Escaping # in macro defs. #3248
Unanswered
JacobBeaudry
asked this question in
Q&A
Replies: 1 comment
-
In TeX and KaTeX, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
It seems that KaTeX currently supports neither
\string
nor\catcode
commands, which are my go-to for escapting#
in macro definitions.E.g. I'd like to be able to pass Hex colour values to a macro, using
\htmlStyle{color: <hex-value>}...
by creating a macro that just takes the hex value:\newcommand{\HexColour}[2]{\htmlStyle{color:\hash#1}{#2}}
so that I could then define something like\newcommand{\colorOne}[1]{\HexColour{228b22}{#1}}
(NB the reason for wanting to define the macro in this way is that these colours are used throughout the site and I'd like to define them in such a way that they don't have to be updated in multiple places, if / when I make a change.Any ideas on how to escape
#
within macros on KaTeX? FWIW this question and this question show possible ways of doing this in LaTeX.Thanks in advance for your time & help.
All the best,
Jacob
Beta Was this translation helpful? Give feedback.
All reactions