1

I have defined a submol for TEDA so that it can be inserted via !{TEDA} into a parent structure (Hexamethylbenzene).

\definesubmol{TEDA}{-[::60]*6(\chemabove{\textcolor{blue}{N}}{\scriptstyle{+}}?---\textcolor{blue}{N}(-[::150,.7]-[::-30,.7]?)--?)

This works perfectly fine as long as I do it once, but leads to undesired bonds with a vertex when I insert more than one.

  1. TEDA : \chemfig[][scale=.5]{!{TEDA}}
  2. TEDA+Parent : \chemfig[][scale=.5]{*6((-!{TEDA})-(-)=(-)-(-)=(-)-(-)=)}
  3. 2*TEDA+Parent : \chemfig[][scale=.5]{*6((-!{TEDA})-(-)=(-!{TEDA})-(-)=(-)-(-)=)}

I already know that this must be caused by my TEDA definition, which contains hooks "?", which end up connecting among themselves, if I add more than one TEDA unit.

Is there a way to specify unique hooks for a single !{TEDA} instance? Do I need to tackle the problem in a different way entirely?

The various results of 1., 2. and 3.

  • 3
    Welcome to TeX.SE! May I suggest to change the title? I can't see how "overleaf" is important here, you may just scare away some of those who could answer this question. More importantly, could you provide us with a minimal compilable document that starts with \documentclass, ends with \end{document} and illustrates the issue? – user121799 Nov 7 '18 at 15:09
1

From v1.33, you can define submols with argument:

\documentclass{article}
\usepackage{chemfig}
\begin{document}
\definesubmol{TEDA}1{-[::60]\chemabove{\textcolor{blue}{N}}{\rlap{\kern0.2em$\scriptstyle{+}$}}?[#1]*6(---\textcolor{blue}{N}(-[::150,.7]-[::-30,.7]?[#1])--?[#1])}
\chemfig{*6((-!{TEDA}{a})-(-)=(-!{TEDA}{b})-(-)=(-)-(-)=)}
\end{document}

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.