我需要插入一支带有破折号的鱼叉箭,它可以位于箭的开头或结尾。
我发现此方法但它只允许我插入普通箭头。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\makeatletter
\newcommand\@erelb@r[1]{%
\mathrel{\tikz[baseline=-.5ex]\draw[#1] (0,0)--(0.3,0);}
}
% 0 is for nothing
% 1 is for arrowhead
% 2 is for bar
% 3 is for both
\newcommand{\erelbar}[1]{\@erelbar#1}
\def\@erelbar#1#2{%
\ifcase\numexpr#1*4+#2\relax
\@erelb@r{-}\or % 00
\@erelb@r{->}\or % 01
\@erelb@r{-|}\or % 02
\@erelb@r{->|}\or % 03
\@erelb@r{<-}\or % 10
\@erelb@r{<->}\or % 11
\@erelb@r{<-|}\or % 12
\@erelb@r{<->}\or % 13
\@erelb@r{|-}\or % 20
\@erelb@r{|->}\or % 21
\@erelb@r{|-|}\or % 22
\@erelb@r{|<->|}\or % 23
\@erelb@r{|<-}\or % 30
\@erelb@r{|<->}\or % 31
\@erelb@r{|<-|}\or % 32
\@erelb@r{|<->|} % 33
\else
\@wrong
\fi
}
\makeatother
\begin{document}
$a\erelbar{11}b$
$\begin{array}{cccc}
\erelbar{00} & \erelbar{10} & \erelbar{20} & \erelbar{30} \\
\erelbar{01} & \erelbar{11} & \erelbar{21} & \erelbar{31} \\
\erelbar{02} & \erelbar{12} & \erelbar{22} & \erelbar{32} \\
\erelbar{03} & \erelbar{13} & \erelbar{23} & \erelbar{33} \\
\end{array}$
\end{document}
我试过用
\@erelb@r{|\righthaproonup} % 33
但输出只是这样的:-
答案1
将代码改为
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\makeatletter
\newcommand\@erelb@r[1]{%
\mathrel{\tikz[baseline=-.5ex,>={Classical TikZ Rightarrow[harpoon]}]\draw[#1] (0,0)--(0.3,0);}
}
% 0 is for nothing
% 1 is for arrowhead
% 2 is for bar
% 3 is for both
\newcommand{\erelbar}[1]{\@erelbar#1}
\def\@erelbar#1#2{%
\ifcase\numexpr#1*4+#2\relax
\@erelb@r{-}\or % 00
\@erelb@r{->}\or % 01
\@erelb@r{-|}\or % 02
\@erelb@r{->|}\or % 03
\@erelb@r{<-}\or % 10
\@erelb@r{<->}\or % 11
\@erelb@r{<-|}\or % 12
\@erelb@r{<->}\or % 13
\@erelb@r{|-}\or % 20
\@erelb@r{|->}\or % 21
\@erelb@r{|-|}\or % 22
\@erelb@r{|<->|}\or % 23
\@erelb@r{|<-}\or % 30
\@erelb@r{|<->}\or % 31
\@erelb@r{|<-|}\or % 32
\@erelb@r{|<->|} % 33
\else
\@wrong
\fi
}
\makeatother
\begin{document}
$a\erelbar{11}b$
$\begin{array}{cccc}
\erelbar{00} & \erelbar{10} & \erelbar{20} & \erelbar{30} \\
\erelbar{01} & \erelbar{11} & \erelbar{21} & \erelbar{31} \\
\erelbar{02} & \erelbar{12} & \erelbar{22} & \erelbar{32} \\
\erelbar{03} & \erelbar{13} & \erelbar{23} & \erelbar{33} \\
\end{array}$
\end{document}