How does one put a box around a group of atoms?

For example, I'm looking to put a box around the hydroxyl group with its bond (--OH) in the following molecule and can't seem to get any luck with the documentation or fbox. Any ideas?


TikZ masters surely can do this better but a basic idea is this: use chemfig's @{node name} syntax for marking nodes and draw the rectangle afterwards using the specified nodes:


    (b1) -- ++(0,.25) -| (H.east)
    (b1) -- ++(0,-.25) -| (H.east) ;


enter image description here

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.