5

I really need to have all arrows set as the TikZ stealth arrow, or similar, by default for the whole document. The arrow style must be consistent, the length and spacing aren't a real problem. Most of my reactions are coded with mhchem, while few others are coded with chemfig. I can't simply replace one with the other at this point.

I've already tried setting arrows options for both package but can't seem to match them.

Difference in arrows

\documentclass{article}
\usepackage[T1]{fontenc}        
\usepackage[utf8]{inputenc}

\usepackage{chemfig}            
%\setarrowdefault{,,,stealth}

\usepackage[version=4,arrows=pgf-filled]{mhchem}

\begin{document}


\ce{Nb(OH)5 + Nb(OR)5 -> Nb2O5 + 5HOR}
\bigskip

\chemfig{Nb{(}OH{)}_{5} \chemsign{+} Nb{{(}}OR{)}_{5} \chemrel{->} Nb_{2}O_{5} \chemsign{+} 5HOR}

\bigskip

\schemestart
\setatomsep{2em}\chemfig{Nb(-[:45]Cl)(-[:-45]Cl)(-[:135])(-[:180])(-[:225])} \chemsign{+} \chemfig{C_{2}H_{6}O_{2}} \arrow \setatomsep{2em}\chemfig{Nb(-[:45]O)(-[:-45]O)(-[:135])(-[:180])(-[:225])} 
\schemestop


\end{document}

Edit: I manage to get an approximate result based on this answer:

\newcommand\MyArrowTip{Stealth[scale=0.77,round]}
\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}+\CF@arrow@start@node{#2}{0}-\CF@arrow@end@node
}
\makeatother

The two arrows still look different, I'm not an expert with pgf so maybe I'm missing something.

  • If you don't mind switching packages: it is possible to do this with chemformula instead of mhchem, see page 27 of the current documentation – clemens Sep 30 '15 at 9:17
  • At first it looks promising, but the syntax is different. Things like "5H2O" in chemformula must be "5 H2O", that would require me to rewrite a lot of things. On the other hand making chemfig look like mhchem arrow is better since i got less chemfig to edit, but i can't make both arrows exactly the same atm. – G. Bay Sep 30 '15 at 16:13
  • 2
    Looking at the code of mhchem there's not much luck, it seems: if I interpret the code correctly mhchem doesn't use pgf's arrows at all but draws the arrow tips by drawing arcs at the end of the arow lines… – clemens Sep 30 '15 at 19:43
  • 2
    Reworking mhchem's arrow is on my todo list anyway. October is quite packed. I think I could do something in November. Don't know if this fits your timeline. Please tell me. (Oh, pgf has its own arrows? I didn't know that when I implemented mhchem's pgf arrows, back in ... 2006. How time flies!) – mhchem Oct 2 '15 at 15:12
  • It's an honor to have your comment. Sure November is great for me, I'm actually ahead of schedule for my Masters. Changing everything for chemfig would require me a lot of rewriting, mhchem keep simple things simple and thats perfect. – G. Bay Oct 4 '15 at 3:40
3

I just uploaded mhchem 4.03 (2015-11-29) which will make its way to the CTAN servers during the next couple of days. With that, you will be able to use any PGF arrow tip (as long as it is reasonably sized). For instance:

\usepackage[version=4,arrows=pgf{Kite[length=0pt 4,width'=0pt 1]}{0.15ex}]{mhchem}
  • I've found that using \setarrowdefault{,,,-stealth} \usepackage[version=4,arrows=pgf{stealth}{0.085ex}]{mhchem} Make both arrows visually identical, since this update, thanks. – G. Bay Feb 25 '16 at 19:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.