How can I add an explanation under an equal sign in Lyx (/Tex)?
Using an underbrace or the like might do what you want. To prevent the text in the underbrace from affecting the spacing of your equation, you could use \mathclap
, which is not currently supported in LyX 2.0.x. It will be supported in LyX 2.1 though and instructions are below. If you use Ubuntu, there is a PPA for LyX 2.1 that makes it very easy to install. Ask if you would like instructions.
Add the underbrace:
Press the right arrow once so that you are just to the right of the underbrace.
- Enter a subscript (in cua binding it is the underscore).
- Enter "\mathclap" and press space or "{" after the p. You will see an empty red box show up with two arrows pointing at each other.
- Press "ctrl+m" to make a text box.
- Enter your text.
If you want, select the other math inset and go to Insert > Preview. If you have preview turned on in the preferences, you will get:
For very short things (without arrow) you could use the \underset
(or \stackrel
) command. For more fancy annotations you could mix equations with tikz, as shown here: http://www.texample.net/tikz/examples/beamer-arrows/ see also https://sites.google.com/site/kaarebmikkelsen/in-the-news/fancyequationsinlatexbeamerwithtikz
To provide a minimal example:
\documentclass{article} %
\usepackage{tikz}
\usepackage{amsmath}
\usetikzlibrary{arrows,shapes,calc}
\begin{document}
\tikzstyle{every picture}+=[remember picture]
\everymath{\displaystyle}
Using tikz:
\begin{equation*}
x
\tikz[baseline=-1pt]{
\node (eq)
{$=$};
}
y
\end{equation*}
\begin{tikzpicture}[overlay]
\node (t) at ($(eq) + (-0.5,-0.5)$) {\footnotesize Explanation};
\path[->,shorten >= 6pt] (eq.base) edge [bend left=10] (t.mid) ;
\end{tikzpicture}
Using underset:
\begin{equation*}
x \underset{\mathrm{def}}{=} y
\end{equation*}
\end{document}
Output
This is rather an improvement of students answer. You can combine underset or overset with TikZ and lapping. Look at this:
\documentclass{article}
\usepackage{tikz,mathtools}
\begin{document}
\begin{equation*}
x
% with tikzpicture environment
\underset{\mathllap{
\begin{tikzpicture}
\draw[->] (-0.3, 0) to[bend right=20] ++(0.3,2ex);
\node[below left] at (0,0) {because $x = y$};
\end{tikzpicture}
}}{=}
y + x - x
% with tikz command
\overset{\mathclap{\tikz \node {$\downarrow$} node [above=1ex] {trivial};}}{=}
y + y - y
\end{equation*}
\end{document}
Output: