# Chemistry Lewis Dot Diagram: Moving Square Bracket

\documentclass{article}
\usepackage{chemfig}
\begin{document}

\schemestart
\chemfig{\lewis{2.4.6.,C}-\lewis{2.6.0.,N}}
\arrow
\chemleft[ \chemfig{\lewis{4:,C}~\lewis{0:,N}}\chemright ]
\chemmove{\node[] at (0pt,7pt) {\footnotesize $-$};}
\schemestop

\end{document}


The following produces this image:

As you can see, the square bracket on the rhs is to close to the Lewis dots, I've tried using hspace and just pressing space bar to no avail.

This is a feature of \lewis; measurements are taken from the symbol (C or N in your example) instead of from the dots. As a result, brackets appear right next to the Lewis dots if no space is added. The \Lewis command adjusts for this (see below) and also fixes the too-close spacing left of the arrow. Thanks to @unbonpetit for pointing this out.

The first line uses the code

\chemleft[\chemfig{\lewis{4:,C}~\lewis{0:,N}}\chemright]


The second line adds a \thinmuskip by placing \, after the left bracket and before the right:

\chemleft[\,\chemfig{\lewis{4:,C}~\lewis{0:,N}\,}\chemright]


The third line adds a "control space" using \␣ after the left bracket (with a trailing space after \, though the slash is optional in chemfig), and \ {} before the right bracket, since the space disappears if you omit the {}:

\chemleft[\ \chemfig{\lewis{4:,C}~\lewis{0:,N}\ {}}\chemright]


You can also add your own amount of space using \hspace. More information on horizontal spacing can be found here.

If you want automatic spacing for brackets and arrows with Lewis dots, use the \Lewis command:

\schemestart
\chemfig{\Lewis{2.4.6.,C}-\Lewis{2.6.0.,N}}
\arrow
\chemleft[\chemfig{\Lewis{4:,C}~\Lewis{0:,N}}\chemright]
\chemmove{\node[] at (0pt,7pt) {\footnotesize $-$};}
\schemestop

• Very good and a detailed justification. :-) – Sebastiano Mar 15 at 20:11
• There is no issue with \lewis, this behaviour is a feature. If you want to draw decoration in the bounding box, you must use \Lewis instead of \lewis. – unbonpetit Mar 15 at 21:15
• @unbonpetit: My mistake. I'll edit my response. – Sandy G Mar 15 at 21:18

I'm using a temporary solution and only adding the spaces.

\documentclass[a4paper,12pt]{article}
\usepackage{chemfig}
\begin{document}
\schemestart
\chemfig{\lewis{2.4.6.,C}-\lewis{2.6.0.,N}}
\arrow
\chemleft[\,\,\chemfig{\lewis{4:,C}~\lewis{0:,N}}\,\,\chemright]
\chemmove{\node[] at (0pt,7pt) {\footnotesize $-$};}
\schemestop
\end{document}