Math & Sciencehow to draw in chemfig

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
audreyk
Posts: 23
Joined: Fri Nov 14, 2008 5:57 am

how to draw in chemfig

Post by audreyk »

Can someone show me how to draw the attached structure in chemfig? Thanks.
Attachments
chemstructure.png
chemstructure.png (5.36 KiB) Viewed 8916 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

how to draw in chemfig

Post by Johannes_B »

This surely isn't a »can you do that for me« forum.
Please have a look at the chemfig documentation, try it yourself and come back with a compilable minimal example to show your efforts.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
audreyk
Posts: 23
Joined: Fri Nov 14, 2008 5:57 am

how to draw in chemfig

Post by audreyk »

Sorry for offending with my direct request, Johannes ... I was merely trying to get a lead on understanding where to begin and where to end with drawing the structure as a base for my future configurations. Yesterday was only my second time using chemfig (with documentation at hand) and I spent hours trying to figure out how to draw this bicyclic figure, namely by building the structure in pieces and then make my attempt on figuring how to merge it all together. It seems simple, but just can't yet wrap my head around the bond angles ... I know I'll get there soon, though. Any leads on how to start with it would be most appreciated.

My pieced attempts so far included this:

Code: Select all

\documentclass{book}
\usepackage{chemfig}
\begin{document}
\chemfig{-[::-30]O-(=[::45]O)-[::-30]}
\chemfig{Cl-[::-30]-[::60]Cl}
\chemfig{-[::90]-[::-45]-[::-135]-[::-50]}
\chemfig{-[::30]O-(=[::-45]O)-[::30]}
\end{document}
Best regards,
A
Last edited by cgnieder on Thu Jun 05, 2014 10:15 pm, edited 1 time in total.
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

how to draw in chemfig

Post by cgnieder »

I'll show you how I would proceed if I had to draw it. You need to build it in several steps. Start with the hexagon:

Code: Select all

\chemfig{
  ?-[:-150,1.5]
  -[:-100]
  -[:30,1.5]
  -[:-30,1.5]
  =^[:80]?
}
Play with angles and lengths until it looks about right. Then start on the bridge. Use the possibility to give the ? hooks names:

Code: Select all

\chemfig{
  ?[a](-[:90]?[b])
  -[:-150,1.5]
  -[:-100]
  -[:30,1.5](-[:90]?[b])
  -[:-30,1.5]
  =^[:80]?[a]
}
Again play with bond lengths if necessary. Now add the missing pieces. First the chlorine:

Code: Select all

\chemfig{
  ?[a](-[:90]?[b](-[:30,.7]Cl)-[:150,.7]Cl)
  -[:-150,1.5]
  -[:-100]
  -[:30,1.5](-[:90]?[b])
  -[:-30,1.5]
  =^[:80]?[a]
}
And finally the esters:

Code: Select all

\chemfig{
  ?[a](-[:90]?[b](-[:30,.7]Cl)-[:150,.7]Cl)
  -[:-150,1.5](-[:135](=[::-60]O)-[::60]O-[::-60])
  -[:-100](-[:-135](=[::60]O)-[::-60]O-[::60])
  -[:30,1.5](-[:90]?[b])
  -[:-30,1.5]
  =^[:80]?[a]
}
Hope this helps so you'll be able to draw similar molecules yourself next time :)

Regards
site moderator & package author
audreyk
Posts: 23
Joined: Fri Nov 14, 2008 5:57 am

Re: how to draw in chemfig

Post by audreyk »

Yes, this is exactly the start I needed. It gives me a good base for doing more of these kind. It appears that because of its diverse flexibility, one can take several approaches on how to build a molecule in chemfig (albeit some use longer methods, like me :? ), so thanks for taking the time to get me on the right track. chemfig is an awesome package!

All the best,
Audrey
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: how to draw in chemfig

Post by Johannes_B »

Thanks for helping out here Clemens.

Audrey, Clemens described his thought process. You can see, that he thought about the structure before coding. One molecule is put in one chemfig.

Maybe starting with some simple molecules and structures is better.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
audreyk
Posts: 23
Joined: Fri Nov 14, 2008 5:57 am

Re: how to draw in chemfig

Post by audreyk »

Yes, thanks, Johannes. I now understand the thought process much better in piecing the structure together and I appreciate the valuable feedback. :)

Best regards,
Audrey
Post Reply