6

I am writing a lab report for my Chemistry class, and I would like to write a chemical reaction for the following reaction that looks like this.

enter image description here

I have tried the following command to make this reaction.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{chemfig}
\usepackage[version=3]{mhchem}

\begin{document}
\begin{center}
\scalebox{0.6}{\ce{\chemfig{O=[:15]-[:69](-[:123,,,2]HO)=_[:357](-[:51,,,1]OH)-[:285](<[:213]O-[:141])-[:339](<[:39,,,1]OH)-[:279]-[:339,,,1]OH} + \chemfig{O=[:19]-[:73]-[:1]-[:289](=[:343]O)-[:217]N(-[:145])-[:271]Br} -> \chemfig{O=[:231]-[:285](-[:339](<[:39,,,1]OH)-[:279]-[:339,,,1]OH)<[:213]O-[:141](=[:195]O)-[:69](-[:357])=[:123]O} + \chemfig{O=[:18]-[:72]--[:288](=[:342]O)-[:216]\mcfbelow{N}{H}(-[:144])} + \chemfig{Br-Br}}}
\end{center}
\end{document}

However, the result is not what I expected. The compounds are not properly lined up.

enter image description here

Can anyone be able to help me with this? Thanks for helping.

2 Answers2

3

Probably the following is closer to the desired output:

enter image description here

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{chemfig}
\usepackage{mol2chemfig}

\begin{document}
\scalebox{.47}{
\schemestart
\chemfig{O=[:15]-[:69](-[:123,,,2]HO)=_[:357](-[:51,,,1]OH)-[:285](<[:213]O-[:141])-[:339](<[:39,,,1]OH)-[:279]-[:339,,,1]OH} 
+ 
\chemfig{O=[:19]-[:73]-[:1]-[:289](=[:343]O)-[:217]N(-[:145])-[:271]Br} 
\arrow{->} 
\chemfig{O=[:15]-[:69](=[:123,,,1]O)-[:357](=[:51,,,1]O)-[:285](<[:213]O-[:141])-[:339](<[:39,,,1]OH)-[:279]-[:339,,,1]OH} 
+ 
\chemfig{O=[:18]-[:72]--[:288](=[:342]O)-[:216]\mcfbelow{N}{H}(-[:144])} 
+ 
\chemfig{Br-Br}
\schemestop
}
\end{document}

Wha I changed in comparison to the original:

  • removed the \ce{} command
  • placed the whole scheme between \startscheme and \stopscheme
  • replaced the mhchem-like arrow -> by the chemfig equivalent \arrow{->}
  • replaced the code of the furan-trione derivate. For this I copied the code of the dihydroxyfuranone derivate and adjusted the bonds accordingly
  • changed the factor of the scalebox to make sure the scheme fits into the textwidth of a standard article class
leandriis
  • 62,593
  • I am currently using Overleaf and for some reason, Overleaf tells me that file 'mol2chemfig.sty' not found. I can't produce that image. – An Trinh Sep 25 '19 at 19:00
  • @AnTrinh: But you aparently already used mol2chemfig in the example code in your question, right? At least the use of \mcfbelow seems to hint on that. – leandriis Sep 25 '19 at 19:02
  • I go online to mol2chemfig to have it produce the code for each individual molecule. In my original code, I just hope that adding all the codes of the molecules might have produce the reaction. – An Trinh Sep 25 '19 at 19:04
  • @AnTrinh: Did you recieve any error message when you compile the example document in your question? If I try, I get an error message about the command \mcfbelow being undefined. This can be solved by adding the mol2chemfig package to the preamble, as I did in my answer. Aparently, the mol2chemfig package is not available on Overleaf. – leandriis Sep 25 '19 at 19:07
  • This is my first time that I use mol2chemfig so I don't really have a mol2chemfig.sty file ready to use yet. – An Trinh Sep 25 '19 at 19:12
  • @AnTrinh: mol2chemfig.sty is a latex package that you need. You can for example find it here: chimpsky.uwaterloo.ca/m2cf_static/mol2chemfig.sty See also: https://ctan.org/pkg/mol2chemfig – leandriis Sep 25 '19 at 19:15
  • 1
    "[...] contains the LaTeX macros required to compile the code generated by mol2chemfig. If you plan on using only the web interface, you still need these macros. [...]" (From the mol2chemfig homepage http://chimpsky.uwaterloo.ca/mol2chemfig/download) – leandriis Sep 25 '19 at 19:16
  • @AnTrinh off-topic advice: tex distribution on overleaf is outdated. So, you better go offline :) – Diaa Sep 25 '19 at 20:51
2

I think the code below works with your original code (with slight modifications).

The relevant changes are: as suggested by @leandriis

  • You can remove \ce
  • You can place the "\chemfig"s within \schemestart and \schemestop.
  • You can use an arrow defined by the chemfig package \arrow(.mid east--.mid west)

  • One suggestion made in the \chemfig package is to separate "plusses" and molecules using an invisible zero-length arrow (\arrow{0}[,0]). This causes the molecules and plusses to be treated separately and they end up aligning in a nicer way.

  • Quoting the chemfig package: 'Therefore, one must stop the compound right after the first molecule with a \arrow{0}[,0] that will draw an invisible, zero-length arrow. In order to vertically center the whole scheme, one must also set the the anchor of the first compound as "west" ... with the second optional argument of the \schemestart command'

    • edit: chemfig doc says you need to anchor the first compound to the "west" if you want vertical centering of the scheme. I removed the [west] argument shown below and I don't see a change in vertical alignment, so it does not seem necessary in this case.
  • You can also get rid of \mhchem and \mol2chemfig (this website is awesome, by the way: https://py-chemist.com/mol_2_chemfig/home it has saved me countless hours)

Here is a screenshot: enter image description here

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{chemfig}
\setchemfig{+ sep left=1em, + sep right=1em, arrow offset=1em} % adjusts spacing around + symbols and the arrow
\begin{document}
    \begin{center}
        \scalebox{0.6}{
            \schemestart[][west] % "west" may be removable here
                \chemfig{O=[:15]-[:69](-[:123,,,2]HO)=_[:357](-[:51,,,1]OH)-[:285](<[:213]O-[:141])-[:339](<[:39,,,1]OH)-[:279]-[:339,,,1]OH} \arrow{0}[,0] \+ \arrow{0}[,0]
                 \chemfig{O=[:19]-[:73]-[:1]-[:289](=[:343]O)-[:217]N(-[:145])-[:271]Br}  \arrow(.mid east--.mid west) \arrow{0}[,0]
                 \chemfig{O=[:231]-[:285](-[:339](<[:39,,,1]OH)-[:279]-[:339,,,1]OH)<[:213]O-[:141](=[:195]O)-[:69](-[:357])=[:123]O} \arrow{0}[,0] \+ \arrow{0}[,0]
                 \chemfig{O=[:18]-[:72]--[:288](=[:342]O)-[:216]{N}{H}(-[:144])} \arrow{0}[,0]  \+ 
                 \chemfig{Br-Br}
             \schemestop
        }
    \end{center}
\end{document}
pdanese
  • 365