Hot answers tagged

18

The following examples uses that the tikz code for the arc uses a center node named arccenter. The tikz option argument for the \draw command of the arc can be used with option late options to put a label in the center: \documentclass{article} \usepackage{chemfig} \begin{document} \chemfig{ N**[0,-144,dash pattern=on 2pt off 2pt, late options={...


16

Here are the fish you wanted, that I caught with texdoc chemfig. \documentclass{article} \usepackage{chemfig} \begin{document} \setatomsep{2em} \setdoublesep{.3em} \renewcommand*\printatom[1]{\ensuremath{\mathsf{#1}}} \chemfig[line width=1pt] { HO-*6(-=-(-(-[::90]CH_3)(-[::-90]CH_3)-*6(-=-(-OH)=-=))=-=) } \end{document} Now your turn to fetch the cane....


13

This answer was provided to me by Christian Tellechea in private correspondence; I post it here for the benefit of other people who may be interested. \documentclass{minimal} \usepackage{chemfig,xstring} \makeatletter % "\derivesubmol" defines the new #1 submol, obtained by replacing all the % occurrences of "#3" by "#4" in the code of #2 submol % ...


13

This is not fully automatic (you need to specify the rotation for the molecule and the corresponding \chemmove command) and the TikZ code can most likely be improved but it may be a start. It places two invisible bonds where I've marked the respective ends with chemfigs @{<node name>} syntax. They are used to draw the rectangle later. \...


12

Pershaps, the chemfig package may help you though it relies on tikz? Here is the first reaction: \documentclass{minimal} \usepackage{chemfig} \begin{document} text before \schemestart \setlewis{4pt}{}{red}\Lewis{0:,\chemfig{@{a}\textcolor{red}{A}}}\hskip4pt\chemfig{@{b}\textcolor{black!40!green}{B}}% \arrow \Lewis{0.,A}% \+\Lewis{4.,B}% \...


12

Yes chemifg is a great tool. But as well as almost every code to picture system the syntax is not trival. Please consider the following example. You can easily see, that chemfig syntax follows a logical and human readable syntax, but will become extremely complex for larger structures. And so far as i can see chemfig is the easiest system for chemical ...


12

I introduce \lewis with 7 arguments, and I apologize that I don't know the precise naming conventions for chemistry. (EDITED to specify valence in only one place). Arguments: #1 Core atom #2 Top electrons #3 Right electrons #4 bottom electrons #5 left electrons #6 valence #7 inner electron shells \documentclass{article} \usepackage{stackengine} \...


12

Here are a different versions using different chemistry packages. Which one you want to use is up to you... chemfig, provides \startscheme, \stopscheme, \chemfig, \lewis, \Lewis, \chemname ... ; mhchem, provides \ce{}; chemformula, provides \ch{} with the !(<below>)(<formula>) syntax and \chlewis; elements, provides \elconf and \writeelconf. ...


11

I would propose to insert a small invisible bond: \documentclass{article} \usepackage{chemfig} \begin{document} \chemfig{*6(-(-[,.1,,,draw=none\Lewis{0.,})=-=-=)} \end{document} If you need it more often it is probably a good thing to define a suitable submol: \documentclass{article} \usepackage{chemfig} \definesubmol{e}{-[,.1,,,draw=none]} \begin{...


10

An example for this is given in the documentation of chemfig (part III section 12.5 Draw polymer element). There a macro \makebraces(<dim up>,<dim down>){<subscript>}{<opening node name>}{<closing node name>} is defined that exploits chemfig's @{<node name>,<pos>} syntax inside formulas to position delimiters on a ...


10

Something like this? MWE: \documentclass{article} \usepackage{chemfig} \begin{document} \chemfig{P(=[2,0.7]O)(-[:-30,0.8]C_{5}H_{11})(-[:150,0.8]C_{5}H_{11}O)(-[:210,0.8]C_{5}H_{11}O)} \end{document} To specify an angle you have to use the notation [:<angle>], while to specify a custom length for the bonds you have to use [,<length>], so ...


9

I've never written anything with chemfig before so had to just guess at the syntax. This is basically my comment above made into an example and expanded a little. There are two ways to achieve the effect of one line going over another. One way is for the under line to "know" that it is the under line and break itself at the crossing point (this is what I ...


9

\centerline{ isn't really a latex command (it is in the latex format but just escaped from plain TeX). It makes a box \hsize wide but does not know about latex list structures and the indentation they introduce. So you line is too wide by 25pt which will be the left margin of the list item. Just remove \centerline and replace it with a \begin{center}...\end{...


8

I'm guessing the \circleatom is a copy of what I used here. I vaguely remembered having defined something like it before. The middle of an -U> arrow is a node named Uarrow@arctangent. If you have only one such arrow you can use that fact to write something beneath it with \chemmove: \documentclass{article} \usepackage{chemfig} \newcommand*\circleatom[1]{...


8

The chemmacros package offers s,p and sp-hybrid orbitals (based on TikZ), d orbitals are missing (for now). These are examples from the documentation: \documentclass{article} \usepackage{chemfig,chemmacros} \begin{document} \setbondoffset{0pt} \chemsetup[orbital]{ overlay , opacity = .75 , p/scale = 1.6 , s/color = blue!50 , s/scale = 1.6 ...


8

I would write this: \chemfig{A -[:-45]B -[:180,0.75]C -[:45,,,,preaction={draw=white, -,line width=6pt}]D }


8

chemfig allows to add explizit node names to either bonds or atoms in its formulae by using the @{<name>} syntax. These names can be used in a tikzpicture with the options remember picture, overlay to draw the curved arrows. chemfig provides the wrapper \chemmove for this. So a combination of chemfig and TikZ can be used to draw the schemes. (BTW: the ...


7

The \chemname command takes an optional argument for vertical spacing: \chemname[<dim>]{\chemfig{<code of the molecule>}}{<name>} However, since your problem is a common one chemfig gives you the possibility to initialize the space. Quoting the manual: In fact, to draw the <name> the command \chemname inserts 1.5ex + the ...


7

To avoid breaking the lines, create an empty bond and attach it To raise or lower an argument of \chemabove or \chembelow, use the optional argument The chemfig manual recommends \definesubmol\nobond{[,0.2,,,draw=none]} in 12.2 Add a superscript without modifying a bond and using this: \documentclass{minimal} \usepackage{chemfig} \definesubmol\nobond{[,...


7

I'm not aware of a truly general approach. I solve these kinds of bonds by using invisible bonds -[,,,,draw=none] for placing atoms or determining access points for other bonds. Ferrocene and similar compounds are not quite easy with chemfig and my approach is even less general. So far the only way I know is to draw them from scratch (but then I do not need ...


7

\chemabove and \chembelow may help : \documentclass{article} \usepackage{chemfig} \newcommand*\circleatom[1]{\tikz\node[circle,draw,fill=green!30]{\printatom{#1}};} \begin{document} \setlewisdist{4pt} \schemestart \chemname{% \chemfig{% H_{2} -[:-90]\lewis{0:,N} -[:225]H_{2}C -[:-45]C(=[:-90]O) -[:13]\lewis{3:1:7:,...


7

Chemfig's bonds have an optional argument that takes several parameters one of them being a factor to scale the bond length: <bond>[<angle spec>,<length factor>,<other parameters>] So you can just add that option to the bonds you want shorter: \documentclass[a4paper,11pt]{scrartcl} \usepackage[utf8]{inputenc} \usepackage[T1]{...


7

The \chemfig command has two optional arguments. The manual says this: The \chemfig command takes two optional arguments; their syntax is as follows: \chemfig[<opt1>][<opt2>]{<molecule code>} The first optional argument <opt1> contains tikz instructions which will be passed to the tikzpicture environment in which the ...


7

I'd use an invisible bond pointing to the center of the ring (with a relative angle) to place the plus. Something like (-[::126,,,,draw=none]\oplus), possibly scaled a bit. On the other hand I do like Heiko's answer better than mine :) \documentclass{article} \usepackage{chemfig} \begin{document} \chemfig{ R-[:36]N **[216,360,dash pattern=on 2pt off ...


7

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}


7

I've contacted Christian Tellechea, the maintainer of the chemfig package. Hi Christian, there is currently a discussion about bound joints in chemfig on tex.stackexchange: Ugly bond joints in chemfig Are you aware of that problem? Is it a chemfig-problem or a TikZ problem? I would really appreciate it if you could participate in the ...


7

I actually figured this issue out by digging through the 83 pages of the chemfig manual. Here's the code I've changed and the following result: \chemleft[\chemfig{\lewis{,H}\pol{+}-\lewis{2:,O}\pol{-}(-[6]\lewis{,H}\pol{+})-\lewis{,H}\pol{+}}\ind\ind\chemright]^{+}


7

You had a syntax error with a final } bracket missing on the last compound. Apart from that to put a label on an arrow use the general form \arrow{->[up][down]} To colour atoms, use {\color{red}H}. However, in a number of situations, such as ends of bonds, you need to write {}|{\color{red}H} instead. \documentclass[12pt,letterpaper]{report} \...


6

ChemFig is a great package but I don't believe that you'll gain much in time if you create your schemes with it rather than with ChemDraw. Once you know you're way around ChemFig you're just as fast or slow with it than with ChemDraw (supposing you know your way around that, too), at least that's my experience. There are other points you should consider: ...


6

It is not possible to draw such schemes with mhchem but as Twig has already noticed chemfig can be used. To expand a bit on Twig's answer and chemfig's possibilities: the \arrow command is the important macro here which is only valid between \schemestart and \schemestop. It has lots of arguments so here is a quick overview: draw an arrow and call the ...



Only top voted, non community-wiki answers of a minimum length are eligible