# Tag Info

## Hot answers tagged chemfig

22

For the purpose of rational comparison, more and updated information on XyMTeX would be desirable, because the example shown in the preceding answer has been drawn by the plain mode of XyMTeX (providing slightly poor printing quality within the picture enviroment of LaTeX) and because the comment on the availability of XyMTeX would provide readers with ...

21

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={...

19

The length of the arm is set by a number after the angle of the arm: :angle,length. I used 0.6 for you. The style of the dots can be changed with the fourth argument of \setlewis. I didn't find a "pretty" way of changing the font color, so I just used \textcolor :P The font size can be changed by changing the \printatom macro, inserting the font size ...

18

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. \...

17

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.

16

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} \...

14

Short answer: It's not in the .cwl file for some reason, you're gonna have to add it in manually. (I think(!) that's the only alternative. I'm happy to be proven wrong..) Long answer: The Why: Autocompletion and recognition of commands by TeXstudio is controlled by the .cwl file, which can be found in your local directory. For Windows, it's in: .\AppData\...

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. \documentclass[...

13

You can use any software able to export in smiles format or MDL molfile format. That done, you can use the mol2chemfig package to convert it to a chemfig command. I also want to point the excellent moltochemfig site in which you can draw a molecule whith your mouse, convert it to mol format and then to chemfig command. For example, in a few seconds, I draw ...

11

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]{...

10

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 ...

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

\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{...

10

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 ...

10

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]^{+}

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 for ...

10

tl dr; Putting it all together Little background first Anki uses latex compiler to create .dvi intermediate documents from the input LaTeX code, which are then converted to .png bitmap image using dvipng converter. Anki is only able to work with .png picture format! Now, TikZ is (in vast majority of cases) only able to be compiled with pdflatex compiler, ...

10

The angles differ in case of rings with five and six corners. Therefore, the angles need to be specified manually. Trigonometric calculations using the regular/symmetric structure give the angles: \documentclass{article} \usepackage{chemfig} \begin{document} \pgfmathsetmacro\angleA{-acos((sqrt(3)-1)/2)+30} \pgfmathsetmacro\angleB{-\angleA + 30} \chemfig{*6(-...

9

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 ...

9

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 largest ...

9

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 ...

9

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 ...

9

I have tried to "fix" the problem. It is not really a "bugfix" (since there is no bug) but a dirty workaround. It seems to work : The beta version needs more testing. If you can't wait (or want to test it), you can download it here. The zip file contains the package source itself (chemfig.tex), a small test file (test.tex) and the pdf manual, compiled with ...

9

You do not need at all the math mode for this: \documentclass{article} \usepackage{chemfig} \begin{document} \schemestart \chemleft[\subscheme{ \chemfig[][scale=.7]{-[:-30]=^[:30]-[2]=^[: 150]-[:-150]=^[6]}\arrow{<->} \chemfig[][scale=.7]{=^[:-30]-[:30]=^[2]-[: 150]=^[:-150]-[6]}} \chemright] \schemestop \end{document}

8

You should use chemfig's \definesubmol instead of \newcommand: \documentclass{article} \usepackage{chemfig} \definesubmol{\lmethyl}{C(-[2]H)(-[4]H)(-[6]H)} \definesubmol{\rmethyl}{C(-[2]H)(-[6]H)-H} \definesubmol{\tmethyl}{C(-[2]H)(-[4]H)-H} \definesubmol{\bmethyl}{C(-[4]H)(-[6]H)-H} \begin{document} \chemfig{!\lmethyl-!\rmethyl} \end{document}

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