4
\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:

enter image description here

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.

Sandy G
  • 42,558

2 Answers2

5

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.

enter image description here

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:

enter image description here

\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
Sandy G
  • 42,558
4

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

enter image description here

\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}
Sebastiano
  • 54,118