transforming character into rule in LaTeX

Daniel Molina lluvia at
Tue Sep 8 17:37:25 CEST 2020

Dear all,

My original problem is to substitute any subformula with a rule of a
specific color. The problem I am facing is that techniques such as
creating a box as

\setbox\mybox=\hbox{$\m at th #1{#2}$}

and getting its dimensions do not work for cramped subformulas. I know
about \cramped in mathtools, but I do not know in advance when a cramped
subformula will be cramped since equations are arbitrary.

As a solution I thought in using a fake font which is equivalent to the
current one but with the full box filled with ink. It would be something
like transforming a character into a rule. I do not know how to do that.


Best regards,


PS: This is what I coded until know, which works well except for cramped
subformulas (and the fact that subformulas are still printed over the
color box)


\mathpalette\myauxcol at rphant{{#1}{#2}}


\def\myauxcol at rphant#1#2{

\mycol at rphant#1#2


\def\mycol at rphant#1#2#3{

\setbox\mycpbox=\hbox{$\m at th #1{#3}$}



\color at block{\wd\mycpbox}{\ht\mycpbox}{\dp\mycpbox}




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the texhax mailing list.