Florian Leupold
19. Oktober 2016 um 14:51
Dear list,

how can I clone \underbar (for the purpose of changing settings for the clone afterwards)?

Just using \definebar to inherit \underbar’s properties does not entirely work, see MWE:

\definebar[myBar][underbar]
\starttext
underbar text mode: \underbar{$a^b$} \crlf
underbar math mode: $\underbar{a^b}$ \crlf
myBar text mode: \myBar{$a^b$} \crlf
myBar math mode: $\myBar{a^b}$
\stoptext
ConTeXt uses different code for the \underbar commands inside and outside of math mode,
in text mode \underbar uses the version which is created with \definebar but when you’re
in math mode a simpler version (which is taken from plain TeX) is used.

Your \myBar command on the other side is always the same in text and math mode.

Wolfgang