![绘制梯度向量和导数之间的关系](https://linux22.com/image/446610/%E7%BB%98%E5%88%B6%E6%A2%AF%E5%BA%A6%E5%90%91%E9%87%8F%E5%92%8C%E5%AF%BC%E6%95%B0%E4%B9%8B%E9%97%B4%E7%9A%84%E5%85%B3%E7%B3%BB.png)
我尝试过,但是没有用,因为我需要虚线,并且需要点 $a, \nabla f(a)$
\documentclass{article}
\usepackage[utf8]{inputenc} % accents
\usepackage{verbatim} % \comment
\usepackage{amsmath,amssymb}
\usepackage{bm} % bold math
\usepackage{multirow,tabularx}
\usepackage{array} % \newcolumntype
\newcolumntype{x}[1]{ >{} m{#1} <{} }
\newcolumntype{X}[1]{ >{\[} m{#1} <{\]} }
%\newcolumntype{A}{>{$\begin{aligned}}c{\end{aligned}$}}
\usepackage{tikz}
\usetikzlibrary{angles,quotes}
\tikzstyle{ciangle}=[
every pic quotes/.append style={text=cyan},
draw=cyan,
angle radius=1cm,
]
\tikzstyle{sqangle}=[
every pic quotes/.append style={text=cyan},
draw=cyan,
angle radius=1cm,
]
\newcommand{\DrawTriangle}[4]{%
\begin{tikzpicture}
\coordinate (A) at (-1.5,-1);
\coordinate (C) at (1.5,-1);
\coordinate (B) at (1.5,1);
\draw (C) -- node[right] {#1} (B) -- node[above] {#3} (A) -- node[below] {#2} (C);
\pic [ciangle, "#4"] {angle=C--A--B};
% \pic [ciangle, "#5"] {angle=A--B--C};
\draw [sqangle](C) rectangle ++(-0.5,0.5);
\end{tikzpicture}
}
\begin{document}
\begin{tabular}{x{3cm} X{1cm}}
\DrawTriangle{$a$}{$b$}{$c$}{$\alpha$} & \textit{sen}(\alpha)=\frac{a}{c} \\
& \textit{cos}(\alpha)=\frac{b}{c} \\
& \textit{tan}(\alpha)=\frac{a}{b}=\frac{\textit{sin}(\alpha)}{\textit{cos}(\alpha)} \\
\end{tabular}
\end{document}
答案1
\documentclass[a4paper,10pt]{article}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}
\tkzDefPoints{0/0/a,3/1/y,4/4/B}
\tkzDefPointBy[projection=onto a--y](B)\tkzGetPoint{C}
\tkzDrawSegment(a,C)
\tkzDrawSegment[dashed](B,C)
\tkzDrawSegments[->,thick](a,B a,y)
\begin{scope}[/pgf/decoration/raise=5pt]
\draw [decorate,decoration={brace,mirror,
amplitude=10pt},xshift=0pt,yshift=-4pt]
(a) -- (C) node [black,midway,yshift=-20pt]
{\footnotesize $f'(a:y)$};
\end{scope}
\tkzLabelPoints[above left](a,y)
\tkzLabelPoint[right](B){$\nabla f(a)$}
\end{tikzpicture}
\end{document}