Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is there a nice way to define a ring submolecule and then reuse it in a bigger molecule (maybe something similar to “chemfig and lego-style molecule construction”? (append one ring after another)

I would like to draw for example this:

\documentclass{article}
\usepackage{chemfig,xstring}

\begin{document}

\chemfig{-*6(-=-(-*6(-=-(-*6(-=-(-)=-=))=-=))=-=)}

\end{document}

but such that the ring would be defined as a submolecule (name e.g. ring) and then append one ring after another (\chemfig{-!{ring}-!{ring}-!{ring}}). Is there a way to do it?

Desired result:

(image of desired result)

share|improve this question
add comment

1 Answer

up vote 7 down vote accepted

Here are two ideas:

\documentclass{article}
\usepackage{chemfig}

\definesubmol{ring}{(-[::-60]=^[::60]-[::60])=_[::60]-[::-60]=_[::-60]}
\definesubmol{ring2}{(**6(------))-[,,,,draw=none]-[,,,,draw=none]}

\begin{document}

\chemfig{-!{ring}-!{ring}-!{ring}}

\chemfig{-!{ring2}-!{ring2}-!{ring2}}

\end{document}

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.