artisticat1 / obsidian-tikzjax

Render LaTeX and TikZ diagrams in your notes
MIT License
356 stars 18 forks source link

Chemfig scheme causes the bond lines to disappear #25

Open TroubleClef128 opened 1 year ago

TroubleClef128 commented 1 year ago

In chemfig \schemestart and \schemestop are used to define a scheme which is important to add arrows and to align elements.

The following is a document I made for my notes in Obsidian:

\usepackage{chemfig}
\begin{document}

\schemestart
\chemfig{[:-60]*6(---(*6(------))(-[:-90]Cl)---)}
\arrow
\chemname{\chemfig{[:-60]*6(---(*6(-----=))---)}}{major}
and
\chemname{\chemfig{[:-60]*6(---(*6(=-----))---)}}{minor}
\schemestop

\end{document}

This results in the following in TikZJax: scheme-TikZJax

The same code produces the following when compiled using LaTeX: scheme-LaTeX

I've been getting by by only using the \schemestart and \schemestop markers around the \arrow commands:

\usepackage{chemfig}
\begin{document}

\chemfig{[:-60]*6(---(*6(------))(-[:-90]Cl)---)}
\schemestart
\arrow
\schemestop
\chemname{\chemfig{[:-60]*6(---(*6(-----=))---)}}{major}
and
\chemname{\chemfig{[:-60]*6(---(*6(=-----))---)}}{minor}

\end{document}

This produces the following in TikZJax: scheme-arrow

So the bond lines do render correctly, but because not all parts of the figure are part of the scheme, the arrow doesn't center appropriately. In this example the scheme is used on a small scale, but this is a necessary feature in creating more complex reaction figures.

deindoenermann commented 3 months ago

Still encountering the same problem :( Has anyone found a workaround, aside from rendering the formula externally and inserting the final image?

thecodechemist99 commented 1 month ago

Same issue here, I’d highly appreciate if someone could resolve this issue. Or if someone knew a feasible workaround, too. This really is a deal breaker for basically any sort of organic chemistry notes in Obsidian.

thecodechemist99 commented 6 days ago

This might be related to #9. I’m not sure, but it seems very likely that schemes would need multiple passes to render correctly and apparently that’s currently not supported. Edit: Actually probably not, as #54 suggests it has something to do with missing bond settings and cram bonds are actually rendered correctly.