# Fractions and Equivalent Fractions

How can I turn the yellow shaded area into an opaque shaded 1 to demonstrate the idea of an equivalent fraction?

\documentclass{article}
\usepackage{tikz,amsmath,xcolor}

\begin{document}
$\begin{tikzpicture} \node at (0,0) {\dfrac{a \cdot c}{b \cdot c}=\color{blue}\underbrace{\color{black}{}\dfrac{a}{b} \cdot \colorbox{yellow}{\dfrac{c} {c}}}}\color{black}{}=\dfrac{a}{b}}; \draw[->,blue] (.2,-.5)--(.2,-.7)--(1.2,-.7)--(1.2,-.3); \node at (.2,-.7) [below right] {\scriptsize \color{blue}{\text{Since}\ \dfrac{a}{b} \cdot 1 =\dfrac{a}{b}}}; \end{tikzpicture}$

\end{document} To look like this : And eventually being able to look like this: I was confused by the various versions of the question. This made my answer look very complicated. However, this is because the answer (which I kept below) would clip the formula against the contour of 1 or whatever. Now that I see that the accepted answer does not have any of these features, I also provide a stripped down version, which has the big advantage (IMHO) that you do not have to adjust tons of dimensions.

\documentclass{article}
\usepackage{tikz,amsmath,pifont}
\usetikzlibrary{backgrounds}
\newcommand{\PlaceCharOverSomething}[xscale=11,yscale=5]{%
\tikz[baseline=(X.base)]{
\node[opacity=0] (tmpX){#3};
\begin{scope}[on background layer]
\clip (tmpX.south west) rectangle  (tmpX.north east);
\node[overlay,outer sep=0pt,text=blue!,opacity=0.3,#1]
{\bfseries\sffamily #2};
\end{scope}
\node [inner sep=0pt](X){#3};}%
}
\begin{document}
$\dfrac{a \cdot c}{b \cdot c}= \textcolor{blue}{\underbrace{\textcolor{black}{\dfrac{a}{b} \cdot} \PlaceCharOverSomething{\ding{192}}{\dfrac{c}{c}} }_{\tikz[remember picture]{\coordinate(b);}}} =\tikz[remember picture,baseline=(Y.base)]{\node (Y) {\dfrac{a}{b}};}$
\tikz[remember picture,overlay]{\draw[->,blue] ([yshift=1mm]b)--++(0,-0.2)
-|(Y) node[pos=0.25,below]{since $\frac{a}{b}\cdot1=\frac{a}{b}$};}
\end{document} Also the wide shape is no problem.

\documentclass{article}
\usepackage{tikz,amsmath,pifont}
\usetikzlibrary{backgrounds}
\newcommand{\PlaceCharOverSomething}[xscale=51,yscale=6]{%
\tikz[baseline=(X.base)]{
\node[opacity=0] (tmpX){#3};
\begin{scope}[on background layer,overlay]
\clip ([xshift=-1mm]tmpX.south west) rectangle  (tmpX.north east);
\node[overlay,outer sep=0pt,text=cyan,opacity=0.3,#1]
{\bfseries\sffamily #2};
\end{scope}
\node [inner sep=0pt](X){#3};}%
}
\begin{document}
$\dfrac{a \cdot c}{b \cdot c}= \textcolor{blue}{\underbrace{\textcolor{black}{\dfrac{a}{b} \cdot} \PlaceCharOverSomething{\ding{192}}{\textcolor{black}{\dfrac{x-3}{x-3}}} }_{\tikz[remember picture]{\coordinate(b);}}} =\tikz[remember picture,baseline=(Y.base)]{\node (Y) {\dfrac{a}{b}};}$
\tikz[remember picture,overlay]{\draw[->,blue] ([yshift=1mm]b)--++(0,-0.2)
-|(Y) node[pos=0.25,below]{since $\frac{a}{b}\cdot1=\frac{a}{b}$};}
\end{document} Now comes a proposal based on this answer and that answer, which allows you to clip a formula against a shape. You may play with xscale, yscale etc. If you make the fraction a node, all tikz options are available. BTW, do not use \color, use \textcolor instead. And very soon there will be an upgrade of the tikzmark library available, which will simplify such things quite a bit.

\documentclass{article}
\usepackage{tikz,amsmath,pifont}
\usepackage{contour}
\newcommand{\PlaceCharOverSomething}[xscale=11,yscale=5]{%
\renewcommand*\sfdefault{ugq}
\node[transparent!0,#1]
{\contour{black}{\bfseries\sffamily\textcolor{white}{#2}}};
\tikz[baseline=(X.base)]{
\node[opacity=0] (tmpX){#3};
\begin{scope}[on background layer]
\clip (tmpX.south west) rectangle  (tmpX.north east);
\node[overlay,outer sep=0pt,text=blue!,opacity=0.3,#1]
{\bfseries\sffamily #2};
\end{scope}
\path (X.west) -- (X.east);
\path (X.north) -- (X.south);}%
}
\begin{document}
$\dfrac{a \cdot c}{b \cdot c}= \textcolor{blue}{\underbrace{\textcolor{black}{\dfrac{a}{b} \cdot} \PlaceCharOverSomething{\ding{192}}{\dfrac{c}{c}} }_{\tikz[remember picture]{\coordinate(b);}}} =\tikz[remember picture,baseline=(Y.base)]{\node (Y) {\dfrac{a}{b}};}$
\tikz[remember picture,overlay]{\draw[->,blue] ([yshift=1mm]b)--++(0,-0.2)
-|(Y) node[pos=0.25,below]{since $\frac{a}{b}\cdot1=\frac{a}{b}$};}
\end{document} Note that, because I am using TikZ, there are certain things that come for free.

• I do not have manually adjust any dimensions. In particular, the fraction sits precisely where it would sit without this brimborium. However, if you want, you can make the node wider, e.g. by replacing \path (X.west) -- (X.east); by \path ([xshift=-1pt]X.west) -- (X.east[xshift=1pt]);. I consider the fact that I do not have to finetune the dimensions a big advantage.
• Similarly, the arrow is fully fixed by the elements of the formula. All the dimensions of \draw[->,blue] (.2,-.5)--(.2,-.7)--(1.2,-.7)--(1.2,-.3); get redundant, the only thing I specify in \draw[->,blue] ([yshift=1mm]b)--++(0,-0.2) -|(Y); is an yshift which makes the arrow start a bit higher up (I actually merely added this to show you how to adjust these things if you really want to) and -0.2 which just says that the arrow needs to go down by 0.2cm before connecting to the fraction on the right. If you add something before the fraction on the right, the arrow will auto-adjust.
• This path fading is extremely powerful since it allows you to cut things off that run out of the character. Although not needed here, this is something that may me used in future applications of these tricks.
• Needless to say that, if you decide that the fraction c/c should also come with a certain opaqueness or color, this would only require a simple switch.
• I have been using tikzmarknode more frequently now. How can I make that area( node ) you posted a 1 instead of an opaque yellow rectangle. What you posted is much cleaner for sure. This is the heart of my question. – MathScholar Oct 1 '18 at 22:40
• @MathScholar I do not understand your question. If you want a 1 instead of an opaque rectangle with a fraction in it, replace \tikz[baseline=(X.base)]{\node[fill=yellow,opacity=0.5](X){$\dfrac{c}{c}$};} by 1. And yes, \tikzmarknode will make this easier. Note, however, the opaque stuff does not really get referenced later here, so for this thingy you do not need a \tikzmarknode, but for the other two thingies \tikzmark and \tikzmarknode will be more elegant. – user121799 Oct 1 '18 at 22:45
• How can I make that opaque area have the shape of a 1, the number one, while leaving the $\dfrac{c}{c}$ as is ? I am not sure how to post an image in the comment section. – MathScholar Oct 1 '18 at 22:50
• I added an image of what I am trying to replicate. Thanks for your efforts – MathScholar Oct 1 '18 at 23:07
• I noticed that the character 1 is pushing out the product while compiling your solution. – MathScholar Oct 1 '18 at 23:48

With stackengine.

\documentclass{article}
\usepackage{tikz,amsmath,xcolor,stackengine}

\begin{document}
$\begin{tikzpicture} \node at (0,0) {\dfrac{a \cdot c}{b \cdot c}=\color{blue}% \underbrace{\color{black}{}\dfrac{a}{b} \cdot \stackengine{0pt}{\makebox[0pt]{\raisebox{-10pt}{\scalebox{10}{% \color{blue!20}\sffamily\tiny 1}}}}{\dfrac{c}{c}}{O}{c}{F}{F}{L}}% \color{black}{}=\dfrac{a}{b}}; \draw[->,blue] (.2,-.5)--(.2,-.7)--(1.2,-.7)--(1.2,-.3); \node at (.2,-.7) [below right] {\scriptsize \color{blue}{% \text{Since}\ \dfrac{a}{b} \cdot 1 =\dfrac{a}{b}}}; \end{tikzpicture}$

\end{document} • I guess if you could get rid of the feet on that 1 we have a perfect match. Thanks for your post I am using yours and Marmot's tikzmarknode. Never heard of stackengine – MathScholar Oct 2 '18 at 0:10
• @MathScholar I tried to find an appropriate font for the "1", but was not immediately successful. Once the font is done, just put the \fontfamily...\selectfont into that argument of stackengine. – Steven B. Segletes Oct 2 '18 at 0:12
• Another concern I have is the "fatness" of '1' for example if c is 100/100 then the 1 is not fat enough. Looks like it is not an easy question. Thank you Steven – MathScholar Oct 2 '18 at 0:23
• @MathScholar The \scalebox{10}{...} gives a horizontal scale of 10 and a vertical scale of 8, so some games can be played. However, with enough digits, like 100/100, even that has its limits. – Steven B. Segletes Oct 2 '18 at 0:30