我想在表格中的两个值之间绘制一个弯曲的箭头,箭头位于曲线中间,标签位于曲线下方。我能做的最好的就是:
\documentclass[a4paper]{article} % use larger type; default would be 10pt
\usepackage[margin=1in]{geometry}
\renewcommand{\baselinestretch}{1.6}
\usepackage{pst-node,amsmath}
\usepackage{array}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\psset{nodesep=7pt,linearc=19pt,arrows=->,linecolor=black,arrowinset=0}
\def\lbl#1{\ncput*{\text{#1}}}
\begin{document}
\begin{center}
\begin{tabular}{P{2cm} | *{4}{P{2cm}}}
$x$ &0 & 1& 2 &3\\
\hline
$f(x)$ &\rnode{A}{$b$} & \rnode{B}{$b \cdot a$} & \rnode{C}{$b \cdot a^2$} & \rnode{D}{$b\cdot a^3$}\\
\ncbar[angle=-90,offsetB=1pt,arm=20pt]{A}{B}\lbl{$\cdot b$}
\ncbar[angle=-90,offsetA=1pt,offsetB=1pt,arm=20pt]{B}{C}\lbl{$\cdot b$}
\ncbar[angle=-90,offsetA=1pt,arm=20pt]{C}{D}\lbl{$\cdot b$}
\end{tabular}
\end{center}
\end{document}
所以问题是:
- 是否有可能降低 $ \cdot b$ 标签
- 是否可以在曲线中间放置一个箭头
答案1
幸运的是,嵌套是可以的pspicture
。
\documentclass[a4paper]{article} % use larger type; default would be 10pt
\usepackage[margin=1in]{geometry}
\renewcommand{\baselinestretch}{1.6}
\usepackage{pst-node,amsmath}
\usepackage{array}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\psset{nodesep=7pt,linearc=19pt,linecolor=black,arrowinset=0}
\def\lbl#1{\bput*{:U}{\text{#1}}\ncput{\begin{pspicture}(-0.2,-0.1)(0.2,0.1)
\psline{->}(-0.2,0)(0.2,0)\end{pspicture}}}
\begin{document}
答案2
\documentclass[a4paper]{article} % use larger type; default would be 10pt
\usepackage[margin=1in]{geometry}
\usepackage{pstricks-add,ragged2e,array}
\newcolumntype{P}[1]{>{\Centering}p{#1}}
\psset{nodesep=5pt,linearc=19pt,arrowinset=0}
\def\Line#1#2{%
\ncbar[angle=-90,offset=1pt,arm=20pt,arrows=->]{#1}{#2}\bput*{:U}{$\cdot b$}%
\psline[ArrowInside=->,linestyle=none]%
(!\psGetNodeCenter{#1}#1.x #1.y 0.89 sub)(!\psGetNodeCenter{#2}#2.x #2.y 0.89 sub)}
\begin{document}
\begin{center}
\renewcommand{\arraystretch}{1.6}
\begin{tabular}{>{$}P{2cm}<{$} | *4{P{2cm}}}
x &0 & 1& 2 &3\\\hline
f(x) &\rnode[b]{A}{$b$} & \rnode[b]{B}{$b \cdot a$}
&\rnode[b]{C}{$b \cdot a^2$} & \rnode[b]{D}{$b\cdot a^3$}\\
& \rule{0pt}{30pt} \Line{A}{B}\Line{B}{C}\Line{C}{D}
\end{tabular}
\end{center}
\end{document}