答案1
我认为这并不容易mhchem
(但我可能错了……)
以下尝试使用chemformula
包代替mhchem
并使用 TikZ/pgf 和杰克的complete sines
装饰表示波浪线。chemformula
允许定义用于化学反应的新箭头。由于语法在细节上与 有很大不同,因此mhchem
这对您来说可能是也可能不是一个可行的解决方案。
作为使用的快捷方式,我定义了一种样式
\tikzset{
wave/.style={
decorate,decoration={
complete sines,
segment length=3pt,
amplitude=2pt
}
}
}
现在我加载chemformula
封装并定义一个新箭头:
\NewChemArrow{w>}{
\path (cf_arrow_end) -- +(-5pt,0) coordinate (xxx) ;
\draw[chemarrow,wave] (cf_arrow_start) -- (xxx) ;
\draw[chemarrow,-cf] (xxx) -- (cf_arrow_end);
}
chemformula
现在它可以像任何其他的箭头一样使用:
\ch{P w>[$\gamma$-radiation] P^*}
完整代码:
\documentclass{article}
\usepackage{chemformula,tikz}
% https://tex.stackexchange.com/a/25689
\usetikzlibrary{decorations.pathmorphing}
\pgfdeclaredecoration{complete sines}{initial}{
\state{initial}[
width = +0pt ,
next state = sine,
persistent precomputation = {
\pgfmathsetmacro\matchinglength{
\pgfdecoratedinputsegmentlength /
int(\pgfdecoratedinputsegmentlength/\pgfdecorationsegmentlength)
}
\setlength{\pgfdecorationsegmentlength}{\matchinglength pt}
}
]{}
\state{sine}[width=\pgfdecorationsegmentlength]{
\pgfpathsine{
\pgfpoint
{0.25\pgfdecorationsegmentlength}
{0.5\pgfdecorationsegmentamplitude}
}
\pgfpathcosine{
\pgfpoint
{0.25\pgfdecorationsegmentlength}
{-0.5\pgfdecorationsegmentamplitude}
}
\pgfpathsine{
\pgfpoint
{0.25\pgfdecorationsegmentlength}
{-0.5\pgfdecorationsegmentamplitude}
}
\pgfpathcosine{
\pgfpoint
{0.25\pgfdecorationsegmentlength}
{0.5\pgfdecorationsegmentamplitude}
}
}
\state{final}{}
}
% a shortcut to use the new decoration:
\tikzset{
wave/.style={
decorate,decoration={
complete sines,
segment length=3pt,
amplitude=2pt
}
}
}
% a new arrow:
\NewChemArrow{w>}{
\path (cf_arrow_end) -- +(-5pt,0) coordinate (xxx) ;
\draw[chemarrow,wave] (cf_arrow_start) -- (xxx) ;
\draw[chemarrow,-cf] (xxx) -- (cf_arrow_end);
}
\begin{document}
\ch{P w> P^*}
\ch{P w>[$\gamma$-radiation] P^*}
\end{document}