# si units in chemfig

How can write si units in chemfig?

I need to put angstrom symbol instead of "A".

Here is my mwe:

\documentclass[preview,border=10pt]{standalone}
\usepackage{chemfig}
\usepackage{tikz}
\begin{document}
\schemestart
\chemfig{
(-[:25]O-[:-25,1.3]
(-[@{e1}:20]X-[:-50,,,,draw=none]@{e2}1,781A)
-[:45,1.3])
-[:45,1.3]-[:-25,1.3]O-[@{a2}:25]
(-[@{a1}:90]
X-[:-20,1.3,,,draw=none]@{a2}1.819A)
}
\schemestop
\chemmove{
\draw(a2) -- (a1);
\draw(e2) -- (e1);
}
\end{document}


p.s. I have another problem: that ugly arrow starting from the top of the 1, I prefer the other arrow style.

• How about siunitx package? \SI{1.819}{\angstrom} instead of 1.819 A – mirkom Apr 23 '16 at 13:58
• it works, but gives me lots of errors – Viridjan Apr 23 '16 at 14:13
• I don't know why but it gives me no error now – Viridjan Apr 23 '16 at 14:16
• Good news then! :) – mirkom Apr 23 '16 at 14:18

The package siunitx works very well, so I would use it: \SI{1.819}{\angstrom}. To change what you call the arrow style you can just make the line to start from one of the several anchors that TikZ automatically defines when you draw a node. To access them use the syntax <node_name>.anchor where anchor can be south, east, west, north and center (in this case west is the most appropriate).

\documentclass[preview,border=10pt]{standalone}
\usepackage{chemfig}
%\usepackage{tikz}
\usepackage{siunitx}
\begin{document}
\schemestart
\chemfig{
(-[:25]O-[:-25,1.3]
(-[@{e1}:20]X-[:-50,,,,draw=none]@{e2}\SI{1,781}{\angstrom})
-[:45,1.3])
-[:45,1.3]-[:-25,1.3]O-[@{a2}:25]
(-[@{a1}:90]
X-[:-20,1.3,,,draw=none]@{a2}\SI{1.819}{\angstrom})
}
\schemestop
\chemmove{
\draw[-stealth](a2) -- (a1);
\draw[-stealth](e2.west) -- (e1);
}
\end{document}


• Works like a charme! I don't know what happened, but it works. – Viridjan Apr 23 '16 at 14:17
• what about that convert option in documentclass? – Viridjan Apr 23 '16 at 14:18
• My bad, I used it to attach the png image to this answer. It is absolutely unnecessary and now I've removed it. – mirkom Apr 23 '16 at 14:20
• Also, bear in mind that chemfig would load tikz, which is why I commented that line. – mirkom Apr 23 '16 at 14:23
• I am interested in images from standalone documentclass, I will search for some documentation about it – Viridjan Apr 23 '16 at 14:24

To print angstrom symbol use \AA in math mode instead of A

So it will be something like

(-[@{e1}:20]X-[:-50,,,,draw=none]@{e2}1,781$\AA$)


(-[@{e1}:20]X-[:-50,,,,draw=none]@{e2}1,781A)

• Sorry to be blunt, but a solution which throws errors is a bad solution. The macro \AA (which translates to \r{A}) works only in text mode. The arguments of \chemfig are already in math mode, so adding $...$ makes things only worse. If you don't want to use siunitx or amsmath, at least replace your $\AA$ by \mbox{\AA}. – campa Apr 23 '16 at 14:18
• No offense taken. Honestly, that is some interesting tidbit of information. Can confirm that using \mbox{\AA} instead $\AA$ will compile the document properly without error. – Cerilla Apr 23 '16 at 14:24