TeX - LaTeX Asked by Croos on January 22, 2021
I would like to place a text next to an arrow. The figure below shows how I would like it to look. I tried to use the commands ^
and _
and also hspace
and vspace
, but it is not getting the way you want. Maybe there is a command like overbrace
or underbrace
that helps me, but I don’t know it.
My code:
documentclass{beamer}
usepackage{tikz}
usetikzlibrary{arrows.meta}
newcommandmyarrow{%
tikzdraw[red,dashed,thick,-Triangle] (0,0) -- ++(0,-1.1);
}
begin{document}
begin{frame}
$begin{array}{cccccc}
& f(x) & = & sqrt{x^2 + 500^2} cdot 640,00 & + & (2000 - x) cdot 312,00
& & & & &
& & & myarrow_{color{red}(sqrt{x})' = frac{1}{2sqrt{x}}} & & myarrow
& & & & &
Rightarrow & f'(x) & = & 640,00frac{1}{2sqrt{x^2 + 500^2}}2x & + & 312,00(-1)
end{array} $
end{frame}
end{document}
The result is:
I need this derivative to be higher. Another way I tried was to put it to the side as text, but the tiny
and small
commands are not working.
PS: I have already asked some questions about how to do some commands for a presentation, I am trying to look for the answers, but I believe that they are not trivial things and are difficult to find on the net.
It's better (in my opinion) to use a tikz matrix, since you need tikz. Then you can use matrix nodes and the result it's very simple. For the big size my solution is to put displaymath
inside the math and you have it.
I'll give you an example with a couple of changes (I personally like it better how it looks like this, but change it to your liking).
documentclass {beamer}
usepackage {cancel}
usepackage {siunitx} % Better look for decimal numbers
usepackage {tikz}
sisetup {group-minimum-digits=3,output-decimal-marker={,}}
usetikzlibrary{calc}
usetikzlibrary{arrows.meta}
usetikzlibrary{matrix}
begin{document}
begin{frame}
begin{tikzpicture}[line cap=round,line join=round]
% It's necessary for tikz matrix and beamer to change the ampersands
matrix(D)[matrix of nodes,row sep=2cm,column sep=0cm,ampersand replacement=&]
{
& $f(x)$ & $=$ & $underbrace{num{640,00}cdotsqrt{x^2+500^2}}$ & $+$
& $underbrace{num{312,00}cdot(num{2000}-x)}$
$Rightarrow$ & $f'(x)$ & $=$ & $displaystyleoverbrace{num{640,00}cdotfrac{cancel{2}x}{cancel{2}sqrt{x^2+500}}}$ & $+$
& $overbrace{num{312,00}cdot(-1)}$
};
draw[thick,red,dashed,-Triangle] (D-1-4) -- (D-2-4);
draw[thick,red,dashed,-Triangle] (D-1-6) -- (D-2-6);
node[red] at ($(D-1-4)!0.5!(D-2-4)$) [right] {$displaystyle(sqrt{x})'=frac{1}{2sqrt{x}}$};
end{tikzpicture}
end{frame}
end{document}
EDIT: My firs attempt was a standalone instead of a beamer. Putting the tikz matrix inside a frame produces an error. There is a conflict with beamer an tikz. The solution was to change the ampersand &
for another thing, in my case &
. There is more information in: "Single ampersand used with wrong catcode" error using tikz matrix in beamer
Correct answer by Juan Castaño on January 22, 2021
I propose this other solution, which doesn't require TiKZ – just an alignat* environment and the
eqparbox` package.
documentclass{beamer}
usepackage{eqparbox}
newcommand{eqmathbox}[2][M]{eqmakebox[#1]{$displaystyle#2$}}
begin{document}
begin{frame}
begin{alignat*}{2}
f(x) & = eqmathbox[L]{sqrt{x^2 + 500^2} cdot 640,00} & & + eqmathbox[R]{(2000 - x) cdot 312,00}
&phantom{ = } eqmathbox[L]{scriptstylecolor{red}biggldownarrow(sqrt{u})' = tfrac{u'}{2sqrt{u}}} & & phantom{ + } eqmathbox[L]{scriptstylecolor{red}biggldownarrow}%& & myarrow
Rightarrow f'(x) & = eqmathbox[L]{640,00frac{2x}{2sqrt{x^2 + 500^2}}} & & + eqmathbox[R]{312,00(-1)}
end{alignat*}
end{frame}
end{document}
Answered by Bernard on January 22, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP