I am trying to use this but change the text to be down and to be not divided but I did not know how to alter the code. Any help?
Asked
Active
Viewed 707 times
1
-
Depending on how loosely you define "highlight", there is this: https://tex.stackexchange.com/questions/140529/graphics-equations-put-text-on-equations – Steven B. Segletes Nov 06 '18 at 19:50
1 Answers
2
There are zillions of possibilities. It will all depend on what you precisely want, what you want to have customizable, and so on. Here is one proposal which may give you a start. This code has some amount of customizability, which is illustrated by the MWE
\documentclass{article}
\usepackage{mathtools}
\usepackage{tikz}
\usetikzlibrary{tikzmark,shapes}
\tikzset{upper node/.style={fill=red!20},
lower node/.style={ellipse,fill=red!20},
ul line/.style={thick,red!20},
upper/.code={\tikzset{upper node/.append style={#1}}},
lower/.code={\tikzset{lower node/.append style={#1}}},
line/.code={\tikzset{ul line/.append style={#1}}},
}
\newcounter{HighLight}
\newcommand{\highlight}[3][]{%
\stepcounter{HighLight}
\tikzset{#1}
\underset{\underset{\displaystyle\makebox[0pt]{\text{\tikzmarknode[lower node]{below-\theHighLight}{%
#3}}}}{\phantom{!}}}{\tikzmarknode[upper node]{above-\theHighLight}{#2}}
\tikz[overlay,remember picture]{\draw[ul line] (above-\theHighLight) --
(below-\theHighLight);}
}
\begin{document}
\begin{align}
Y_{ij}& = \highlight{\beta_{0}}{explain} + \beta_1x_1 + \ldots +
\highlight[upper=ellipse]{\beta_n}{whatever}x_n +
\dots\\
Y_{ij}'& = \highlight{\beta_{0}'}{explain} + \beta_1'x_1 + \ldots +
\highlight[upper={fill=blue!30},line={thick,black,latex-}]{\beta_n'}{whatever}x_n +
\dots
\end{align}
\end{document}
Notice that you have to have the newest version of tikzmark for it and need to compile it twice or three times.
