你能帮我把箭头放在“a”的正上方吗?
\documentclass[12pt,oneside]{book}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning}
\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}
\begin{document}
\[
y = a\tikzmark{a}x + b
\tikz[overlay,remember picture]{
\node[above right=of a] (text) {\scriptsize slope};
\draw[->,thin] (a.north) |- (text.west);
}
\]
\end{document}
答案1
\tikzmark
该示例根本不需要:
\documentclass[12pt,oneside]{book}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning}
\begin{document}
\[
y = \tikz[baseline=(a.base)]{
\node[inner sep=0pt] (a) {$a$};
\node[overlay,above right=of a] (text) {\scriptsize slope};
\draw[overlay,->,thin,shorten <=2pt] (a.north) |- (text.west);
}
x + b
\]
\end{document}
答案2
一个可能的解决方案:
\documentclass[12pt,oneside]{book}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning}
\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}
\begin{document}
\[
y = a\tikzmark{a}x + b
\tikz[overlay,remember picture]{
\node[above right=of a] (text) {\scriptsize slope};
\draw[->,thin] ([xshift=-2.5pt, yshift=3pt] a.north) |- (text.west);
}
\]
\end{document}
答案3
可能需要一些空间调整,但下一个代码可以起作用。
\documentclass[12pt,oneside]{book}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning}
\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node[anchor=base] (#1) {$#1$};}
\begin{document}
\[
y = \tikzmark{a}\ x + b
\tikz[overlay,remember picture]{
\node[above right=of a] (text) {\scriptsize slope};
\draw[->,thin] (a.north) |- (text.west);
}
\]
\end{document}
答案4
和一行
\documentclass[12pt,oneside]{book}
\begin{document}
\[
y = a\put(-2,10){\line(0,1){30}}\put(-2,40){\vector(1,0){30} \raisebox{-0.5ex}{slope}}x+b
\]
\end{document}