更新

更新

例如,我想\arrow{->}(还有\arrow{<->}…… \arrow{<=>})画一个带有“隐形”风格笔尖的箭头。我该怎么做?

答案1

更新

作为克莱门斯提及a comment,从 v1.2 2015-10-08 开始 \setarrowdefault{,,,<arrow tip>}是可能的:

\documentclass{article}
\usepackage{chemfig}
\usetikzlibrary{arrows.meta}

\begin{document}

\setarrowdefault{,,,-Stealth}
\schemestart 
A\arrow B\arrow{<-} C\arrow{<->}[,,red] D\arrow{-/>}[45,2,thick] E
\schemestop

\setarrowdefault{,,,-{Bar[length=10pt]}}
\schemestart 
A\arrow B\arrow{<-} C\arrow{<->}[,,red] D\arrow{-/>}[45,2,thick] E
\schemestop

\setarrowdefault{,,,-{Circle[red]}}
\schemestart 
A\arrow B\arrow{<-} C\arrow{<->}[,,red] D\arrow{-/>}[45,2,thick] E
\schemestop

\end{document}

在此处输入图片描述

旧版本

这些箭头的箭头尖定义为chemfigCF@full原始定义是(参见chemfig.tex):

\pgfarrowsdeclare{CF@full}{CF@full}%
    {\CF@arrow@size\dimexpr2.5pt+2.5\pgflinewidth\relax
    \pgfarrowsleftextend{-\CF@arrow@size}\pgfarrowsrightextend{.5\pgflinewidth}}%
    {\CF@arrow@size\dimexpr2.5pt+2.5\pgflinewidth\relax
    \pgfsetdash{}\z@\pgfsetroundjoin\pgfsetroundcap
    \pgfpathmoveto{\pgfpoint\z@\z@}%
    \pgfpathlineto{\pgfpoint{-\CF@arrow@size}{.5\CF@arrow@size}}%
    \pgfpathlineto{\pgfpoint{-.5\CF@arrow@size}\z@}%
    \pgfpathlineto{\pgfpoint{-\CF@arrow@size}{-.5\CF@arrow@size}}%
    \pgfpathlineto{\pgfpoint\z@\z@}%
    \pgfusepathqfillstroke}

不幸的是,我没有找到任何可以改变箭头尖端的快捷机制。我在下面介绍了可能的解决方案。

一种选择是用 的定义替换箭头定义Stealth(可以在 中找到pfgcorearrows.code.tex);这将更改所有使用 的箭头提示CF@full(特别是问题中提到的箭头提示):

\documentclass{article}
\usepackage{chemfig}
\usetikzlibrary{arrows.meta}

\makeatletter
\pgfarrowsdeclare{CF@full}{CF@full}%
{
  \pgfutil@tempdima=0.28pt%
  \pgfutil@tempdimb=\pgflinewidth%
  \ifdim\pgfinnerlinewidth>0pt%
    \pgfmathsetlength\pgfutil@tempdimb{.6\pgflinewidth-.4*\pgfinnerlinewidth}%
  \fi%
  \advance\pgfutil@tempdima by.3\pgfutil@tempdimb%
  \pgfarrowsleftextend{+-3\pgfutil@tempdima}
  \pgfarrowsrightextend{+5\pgfutil@tempdima}
}
{
  \pgfutil@tempdima=0.28pt%
  \pgfutil@tempdimb=\pgflinewidth%
  \ifdim\pgfinnerlinewidth>0pt%
    \pgfmathsetlength\pgfutil@tempdimb{.6\pgflinewidth-.4*\pgfinnerlinewidth}%
  \fi%
  \advance\pgfutil@tempdima by.3\pgfutil@tempdimb%
  \pgfpathmoveto{\pgfqpoint{5\pgfutil@tempdima}{0pt}}
  \pgfpathlineto{\pgfqpoint{-3\pgfutil@tempdima}{4\pgfutil@tempdima}}
  \pgfpathlineto{\pgfpointorigin}
  \pgfpathlineto{\pgfqpoint{-3\pgfutil@tempdima}{-4\pgfutil@tempdima}}
  \pgfusepathqfill
}
\makeatother

\begin{document}

\schemestart 
A\arrow B\arrow{<-} C\arrow{<->}[,,red] D\arrow{-/>}[45,2,thick] E
\schemestop
\end{document}

结果:

在此处输入图片描述

另一个选择是直接重新定义-><-<->(以及所有其他所需的箭头)以替换CF@fullStealth通过命令执行此操作允许您轻松更改为任何所需的提示:

\documentclass{article}
\usepackage{chemfig}
\usetikzlibrary{arrows.meta}

\newcommand\MyArrowTip{Stealth}

\makeatletter
\definearrow3{->}{%
    \CF@arrow@shift@nodes{#3}%
    \expandafter\draw\expandafter[\CF@arrow@current@style,-\MyArrowTip](\CF@arrow@start@node)--(\CF@arrow@end@node);%
    \CF@arrow@display@label{#1}{0.5}+\CF@arrow@start@node{#2}{0.5}-\CF@arrow@end@node
}

\definearrow3{<-}{%
    \CF@arrow@shift@nodes{#3}%
    \expandafter\draw\expandafter[\CF@arrow@current@style,\MyArrowTip-](\CF@arrow@start@node)--(\CF@arrow@end@node);%
    \CF@arrow@display@label{#1}{0.5}+\CF@arrow@start@node{#2}{0.5}-\CF@arrow@end@node
}

\definearrow5{-/>}{%
    \CF@arrow@shift@nodes{#3}%
    \expandafter\draw\expandafter[\CF@arrow@current@style,-\MyArrowTip](\CF@arrow@start@node)--(\CF@arrow@end@node)%
        coordinate[midway,shift=(\CF@arrow@current@angle:-1pt)](midway@i)%
        coordinate[midway,shift=(\CF@arrow@current@angle:1pt)](midway@ii)%
        coordinate[at=(midway@i),shift=(\ifx\@empty#4\@empty225\else#4+180\fi+\CF@arrow@current@angle:\ifx\@empty#5\@empty5pt\else#5\fi)](line@start)%
        coordinate[at=(midway@i),shift=(\ifx\@empty#4\@empty45\else#4\fi+\CF@arrow@current@angle:\ifx\@empty#5\@empty5pt\else#5\fi)](line@end)%
        coordinate[at=(midway@ii),shift=(\ifx\@empty#4\@empty225\else#4+180\fi+\CF@arrow@current@angle:\ifx\@empty#5\@empty5pt\else#5\fi)](line@start@i)%
        coordinate[at=(midway@ii),shift=(\ifx\@empty#4\@empty45\else#4\fi+\CF@arrow@current@angle:\ifx\@empty#5\@empty5pt\else#5\fi)](line@end@i);
    \draw(line@start)--(line@end);%
    \draw(line@start@i)--(line@end@i);%
    \CF@arrow@display@label{#1}{0.5}+\CF@arrow@start@node{#2}{0.5}-\CF@arrow@end@node
}

\definearrow3{<->}{%
    \CF@arrow@shift@nodes{#3}%
    \expandafter\draw\expandafter[\CF@arrow@current@style,\MyArrowTip-\MyArrowTip](\CF@arrow@start@node)--(\CF@arrow@end@node);%
    \CF@arrow@display@label{#1}{0.5}+\CF@arrow@start@node{#2}{0.5}-\CF@arrow@end@node
}
\makeatother

\begin{document}

\schemestart 
A\arrow B\arrow{<-} C\arrow{<->}[,,red] D\arrow{-/>}[45,2,thick] E
\schemestop

\renewcommand\MyArrowTip{Bar[length=10pt]}
\schemestart 
A\arrow B\arrow{<-} C\arrow{<->}[,,red] D\arrow{-/>}[45,2,thick] E
\schemestop

\renewcommand\MyArrowTip{Circle[red]}
\schemestart 
A\arrow B\arrow{<-} C\arrow{<->}[,,red] D\arrow{-/>}[45,2,thick] E
\schemestop

\end{document}

在此处输入图片描述

但是请注意,所有其他箭头类型都未被重新定义,因此这可能会导致图表中的箭头尖不一致。

相关内容