# Resonance hybrids in chemfig

How would I best create the dotted/solid paired bond line for a resonance structure? For example, I have

$\chemfig{ C(=[:90]\lewis{1:3:, O}) (-[:210]\lewis{3:5:7:, O}) (-[:330]\lewis{1:5:7:, O}) } \longleftrightarrow \chemfig{ C(-[:90]\lewis{2:4:0:, O}) (=[:210]\lewis{4:6:, O}) (-[:330]\lewis{1:5:7:, O}) } \longleftrightarrow \chemfig{ C(-[:90]\lewis{2:4:0:, O}) (-[:210]\lewis{3:5:7:, O}) (=[:330]\lewis{6:0:, O}) }$


which creates the three part hybrid diagram for carbonate. I also know that I can use -[:210,,,,dash pattern=on 2pt off 2pt] to create a single, dashed line. Is there a relatively straightforward way to add a dashed line next to a solid line? From example above, I'd like to also be able to draw one molecule in which each of the C-O bonds would be a solid/dashed pair.

Section 6 “Delocalized double bonds” from chemfig documentation. I also suggest to use \schemestart ... \schemestop to draw reaction scheme.

\documentclass{article}
\usepackage{chemfig}
\usetikzlibrary{decorations}
\pgfdeclaredecoration{ddbond}{initial}
{
\state{initial}[width=4pt]
{
\pgfpathlineto{\pgfpoint{4pt}{0pt}}
\pgfpathmoveto{\pgfpoint{2pt}{2pt}}
\pgfpathlineto{\pgfpoint{4pt}{2pt}}
\pgfpathmoveto{\pgfpoint{4pt}{0pt}}
}
\state{final}
{
\pgfpathlineto{\pgfpointdecoratedpathlast}
}
}
\tikzset{lddbond/.style={decorate,decoration=ddbond}}
\tikzset{rddbond/.style={decorate,decoration={ddbond,mirror}}}
\begin{document}
\schemestart
\chemfig{
C(=[:90]\lewis{1:3:, O}) (-[:210]\lewis{3:5:7:, O}) (-[:330]\lewis{1:5:7:, O})
} \arrow{<->} \chemfig{
C(-[:90]\lewis{2:4:0:, O}) (=[:210]\lewis{4:6:, O}) (-[:330]\lewis{1:5:7:, O})
} \arrow{<->} \chemfig{
C(-[:90]\lewis{2:4:0:, O}) (-[:210]\lewis{3:5:7:, O}) (=[:330]\lewis{6:0:, O})
}
\arrow{<->}
\chemfig{
C(-[:90,,,,lddbond]\lewis{1:3:, O}) (-[:210,,,,lddbond]\lewis{4:6:, O}) (-[:330,,,,lddbond]\lewis{6:0:, O})
}
\schemestop
\end{document}