1

In this chemfig document page 44 http://tug.ctan.org/macros/generic/chemfig/chemfig-en.pdf it says that I can move charges by \rlap (for right) and \llap (for left).

\documentclass{article}
\usepackage{chemfig}
\begin{document}
    \chemfig{O\rlap{${}^+$}-[2]B}

    \chemfig{O\llap{${}^+$}-[2]B}
\end{document}

enter image description here

As you can see it works with the \rlap, but not with the \llap. Am I missing something? Thanks.

2

The documentation is a bit unclear, but the \llap would come before the atom, not after it:

\chemfig{\llap{${}^+$}O-[2]B} % DOESN'T QUITE WORK

but trying this, the positioning is messed up a bit, likely because of how Chemfig is parsing the arguments to the \chemfig command. Wrapping both the \llap and the atom in braces fixes it:

\chemfig{{\llap{${}^+$}O}-[2]B} % THIS ONE GIVE THE DESIRED RESULT

(be sure to count the braces carefully to see how everything is distributed).

Edited to add a brief note about \llap and \rlap: These two macros take their contents and overlap them to the left and the right respectively from the place that they're inserted. If you look closely at the original output, you'll see that the ⁺ is printed overlapping the O which, once you think about what \llap means is exactly what you would expect it to do.

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.