# [OS X TeX] colorbox

Alain Schremmer schremmer.alain at gmail.com
Wed Jul 30 08:03:27 EDT 2008

On Jul 30, 2008, at 2:40 AM, Peter Dyballa wrote:

> What are you trying to achieve?

In general, I want to be able to highlight specific spots in
mathematical expressions. I can now do it, at least to an extent, but
highlighting is indeed hard business. A good thing I don't have to do
it too often.

Here are a couple of examples:

1) In my previous request for help, I wanted to highlight the
replacement of  the generic input x by a specific value such as 3:

\begin{align*}
x\colorbox{yellow}{$\left.\rule{0mm}{4mm} \right|_{x:=-3}$}
\xrightarrow{\hspace{2mm} FLIP\hspace{2mm}} FLIP(x)\colorbox{yellow}{$\left.\rule{0mm}{4mm}\right|_{x:=-3}$}
&=     (-13.44)\cdot \underset{6 \text{ copies of }x}{\underbrace{x
\cdot x \cdot x \cdot x \cdot x \cdot
x}}\colorbox{yellow}{$\left.\rule{0mm}{4mm}\right|_{x:=-3}$}
\\
\intertext{which gives us the following specifying-phrase}
&=	(-13.44)\cdot \underset{6 \text{ copies of }-3}{\underbrace{(-3)
\cdot (-3) \cdot (-3) \cdot (-3) \cdot (-3) \cdot (-3)}}
\\
\end{align*}

2) Now, in x --f--> kx^p, I want to highlight the fact that sign(p)
(where p is an integer) says whether the coefficient k is to be
multiplied or divided by "copies" of the input x:

\begin{align*}
x \xrightarrow{\hspace{2mm} FLIP\hspace{2mm}} FLIP(x)
&=(-13.44) x^{\colorbox{yellow}{\hspace{-0.8mm}$+$\hspace{-0.8mm}}6}
\\
&= (-13.44)\colorbox{yellow}{\hspace{-0.8mm}$\; \cdot \;$\hspace
{-0.8mm}}\underset{6 \text{ copies of }x}{\underbrace{x \cdot x \cdot
x \cdot x \cdot x \cdot x}}
\\
\intertext{versus}
x \xrightarrow{\hspace{2mm} FLOP\hspace{2mm}} FLOP(x)
&= (+8\,273.1) \cdot x^{\colorbox{yellow}{\hspace{-0.8mm}$-$\hspace
{-0.8mm}}5}
\\
&= \colorbox{yellow}{\parbox[l][-2mm][t]{20mm}{\vspace{-4mm}$\dfrac{+8 \,273.1}{\underset{5 \text{ copies of }x}{\underbrace{x\cdot x \cdot x \cdot x \cdot x}}}$}}
\end{align*}

while size(p) says how many copies of x are to be used:

\begin{align*}
x \xrightarrow{\hspace{2mm} FLIP\hspace{2mm}} FLIP(x)
&=(-13.44) x^{+\colorbox{yellow}{\hspace{-0.8mm}$\mathsmaller{6}$
\hspace{-0.8mm}}}
\\
&= (-13.44) \cdot  \underset{\colorbox{yellow}{\hspace{-0.8mm}$\mathsmaller{6}$\hspace{-0.8mm}} \text{ copies of }x}{\underbrace{x
\cdot x \cdot x \cdot x \cdot x \cdot x}}
\\
\intertext{versus}
x \xrightarrow{\hspace{2mm} FLOP\hspace{2mm}} FLOP(x)
&= (+8\,273.1) \cdot x^{-\colorbox{yellow}{\hspace{-0.8mm}$\mathsmaller{5}$\hspace{-0.8mm}}}
\\
&= \dfrac{+8\,273.1}{\underset{\colorbox{yellow}{\hspace{-0.8mm}$\mathsmaller{5}$\hspace{-0.8mm}} \text{ copies of }x}{\underbrace{x
\cdot x \cdot x \cdot x \cdot x}}}
\end{align*}

Best regards
--schremmer