2

In relation to this question How to create cram bonds with anchors, I wanted to put the segment in the background and the black triangle hiding it in the foreground.

enter image description here

How is this possible with chemfig?

Here there is my answer

\documentclass{article}
\usepackage{chemfig}
\begin{document}
\chemfig{
                   % 7
      -[:270,0.963]% 4
    -[:328.2,1.019]% 3
            -[:270]% 2
            -[:210]% 1
                      (
                -[:150]% 6
                 -[:90]% 5
         -[:31.8,1.019]% -> 4
                      )
    -[:267.9,1.001]% 8
                      (
                -[:210]% 10
                      )
                      (
                -[:330]% 11
                      )
    <[:102.9,1.696]O% 9
                      (
         >[:73.3,1.445]% -> 4
                      )
}
\end{document}

enter image description here

Reading the chemfig manual I have not found nothing.

Edit: Considering the output after the very nice comments, I have a white space below probably why I have not a straight line?

\documentclass{article}
\usepackage{chemfig}
\begin{document}
\chemfig{
                   % 7
      -[:270,0.963]% 4
    -[:328.2,1.019]% 3
            -[:270]% 2
            -[:210]% 1
                      (
                -[:150]% 6
                 -[:90]% 5
         -[:31.8,1.019]% -> 4
                      )
    -[:267.9,1.001]% 8
                      (
                -[:210]% 10
                      )
                      (
                -[:330]% 11
                      )
    <[:102.9,1.696,,,,{preaction={draw=white,-,line width=2pt}}]O% 9
                      (
         >[:73.3,1.445]% -> 4
                      )
}
\end{document}

enter image description here

Sebastiano
  • 54,118
  • 2
  • @leandriis Thank you very much for your precious comment....but there is always tikz? :-( I wanted use only chemfig and just the moment I am not able to solve my question. – Sebastiano Apr 30 '20 at 20:36
  • 1
    What about https://tex.stackexchange.com/a/40164/134144? Probably you will have to adjust the width to prevent the white line covering part of the oxygen atom. – leandriis Apr 30 '20 at 20:37
  • 2
    chemfig uses tikz so without tikz is not a good idea. In @leandriis link there are two answers, and if you use <[:102.9,1.696,,,,{preaction={draw=white, -,line width=2pt}}] for the < path it gets already close. –  Apr 30 '20 at 20:39
  • @leandriis Can you add an answer, please? I am not expert in chemistry..I am only 5 votes to vote up :-) – Sebastiano Apr 30 '20 at 20:39
  • @Schrödinger'scat I hope the cat didn't get mad and scratch me. :) ahahah. However you can put also your answer. – Sebastiano Apr 30 '20 at 20:40
  • This is not an answer since it also overpaints something in the lower right where it should not. –  Apr 30 '20 at 20:41
  • Into my home are welcome also the cats :-) I am not able to put this code: <[:102.9,1.696,,,,{preaction={draw=white, -,line width=2pt}}] – Sebastiano Apr 30 '20 at 20:42
  • Grazie! I am not an expert on chemfig but are you sure this is the optimal way to draw this diagram? (I am assuming that these quantities with the peculiar values are angles and distances, but as I said I have no clue so you can just ignore this comment.) –  Apr 30 '20 at 20:45
  • @Schrödinger'scat I have adjust manually the angles and distances with differents compilations. – Sebastiano Apr 30 '20 at 20:47

1 Answers1

2

Try this (with the construction to help the understanding):

\documentclass{article}
\usepackage{chemfig}
\begin{document}
\chemfig{*6(-
    ([::150,0.75,,,draw=purple]-
    O?[Oxy]-
    [::162,0.75,,,preaction={draw=green,line width=8pt}])
    (-?[Oxy,{>},{red}]([::60]-)([::-60]-))---
    (?[Oxy,{>},{blue}])(-)--)}\qquad
\chemfig{*6(-([::150,0.75,,,draw=none]-
    O?[Oxy]-
    [::162,0.75,,,preaction={draw=white,line width=8pt}])
    (-?[Oxy,{>}]([::60]-)([::-60]-))---
    (?[Oxy,{>}])(-)--)}
\end{document}

The output: Molecule