2022 Developer Survey is open! Take survey.

Hot answers tagged

20 votes
Accepted

How can I draw a Lewis structure?

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 "...
user avatar
17 votes
Accepted

Simpler way to create chemical graphs using chemfig

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 ...
user avatar
  • 6,050
15 votes
Accepted

TeXstudio chemfig commands marked as unrecognized

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: ...
user avatar
  • 13.2k
12 votes
Accepted

Chemfig: length and angle of bonds

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}...
user avatar
12 votes
Accepted

How to get Anki working with TikZ-based packages?

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 ...
user avatar
  • 443
10 votes

How can I remove the space around chemfig figures?

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]-[:-...
user avatar
  • 73k
10 votes
Accepted

Connect a 5-Ring to two 6-Rings in chemfig

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: \...
user avatar
9 votes
Accepted

Color functional groups in chemfig syntax

Relate to this post. \documentclass{article} \usepackage{chemfig} \begin{document} \def\RED{\gdef\printatom##1{\color{red}\ensuremath{\mathrm{##1}}}} \def\BLACK{\gdef\printatom##1{\color{...
user avatar
  • 35.4k
8 votes
Accepted

How to annotate chemfig drawing with circles and lines?

I was able to draw using \chemmove, remember picture and @{} syntax for naming atoms and links. \documentclass[varwidth,border=50]{standalone} \usepackage{tikz} \usepackage{chemfig} \begin{document} ...
user avatar
  • 22.3k
8 votes

Issue with cram bonds in chemfig

Disclaimer: I did not know how to solve this myself when I asked the question, but managed to figure it out almost immediately after asking it. The author of chemfig said he did not speak English ...
user avatar
  • 131
8 votes
Accepted

How do you draw a dative bond with chemfig?

Use the TikZ parameter of the corresponding bond, i.e., the fifth parameter in the optional argument and specify an arrow according to TikZ syntax: \documentclass{article} \usepackage{chemfig} \...
user avatar
  • 64.2k
8 votes
Accepted

Move shaded polygon behind chemfig schemes

You could put it on a background layer, but why bother? Does it matter if it is behind? Or only that it looks as if it is behind? If the latter, what about the following? \documentclass{article} \...
user avatar
  • 183k
8 votes

Resonance structure of acetate

Probably something like this? \documentclass[ crop, border=5, tikz=true, multi={page}, 12pt ]{standalone} \usepackage{amsmath} \usepackage{amssymb} \usepackage{amsfonts} \...
user avatar
  • 2,535
8 votes
Accepted

Chemfig: set points at ends of bonds

You can set the distance between the dots in \lewis with the macro \setlewisdist. Note that this also affects the distance between the electrons above and below the O, but that is probably good in ...
user avatar
  • 29.6k
7 votes
Accepted

How I can write polymeric reaction in latex

I propose the following solution. I've made a number of changes: First of all I find your use of enumerate a bit strange. It looks like you want equation numbers for your reactions. If that's it then ...
user avatar
  • 64.2k
7 votes
Accepted

Problem with mesomeric effect in chemfig

Here is how to draw the 2 first arrows: \documentclass{article} \usepackage{chemfig} \begin{document} \chemfig{*6((-[@{a1}]H_2@{a2}\Lewis{26,N})=[@{r1}]-[@{r2}]=(-N=N-*6(=-=(-OH)-=-))-=-=)} \chemmove[...
user avatar
  • 6,050
7 votes

Easy way to write below arrow (\arrow{-U>}) in chemfig?

Here's an update on @runiq's extension to @clemens' code above (and partially an extension of my answer here), that is compatible with current versions of chemfig (as of 2017, v1.2e), for an all-...
user avatar
  • 13.2k
7 votes
Accepted

How to use chemfig for chemical reaction with skeletal forms

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}...
user avatar
  • 91.7k
7 votes

Using the mhchem and chemfig packages in conjunction

Bundling my comments into an answer: I wrote »There is no way to make chemfigs bonds all the same length. Quoting part II section 4 Length of a bond of chemfig's manual:« Rather than speaking of ...
user avatar
  • 64.2k
7 votes
Accepted

chemfig, how to do these wavy markings?

You might want to use the decoration complete sines from Nicer wavy line with TikZ as I've used in a blog post of mine a while ago: \documentclass{article} \usepackage{tikz} \usepackage{chemfig} \...
user avatar
  • 64.2k
7 votes
Accepted

Wall, molecules and drawing with tikz/chemfig

Here is a “chemfig only” idea: \documentclass{article} \usepackage{chemfig} \definesubmol{wallpart}{-[:-90,.5](-[:110,.5])} \definesubmol{wall}{!{wallpart}!{wallpart}!{wallpart}} \begin{document} \...
user avatar
  • 64.2k
7 votes
Accepted

How to align all the molecules, the + sign and arrow at the same level?

chemfig always places the first atom of the molecule on the baseline, so if you write \chemfig{O=[:-90](-[:-150]H)-[:-30]OH} the oxygen will be on the baseline. To put the carbon on the baseline it ...
user avatar
  • 1,437
7 votes
Accepted

How to draw an arenium ion with chemfig?

Here's an idea: \documentclass{article} \usepackage{chemfig} \begin{document} \chemfig{**[60,-240]6(-(-[:90,,,,draw=none]+)---(-[:60]R)(-[:120]H)--)} \end{document} Have a look at section Rings > ...
user avatar
  • 64.2k
7 votes

Orbital shift when i use atoms near it

I am quite certain that this issue arises due to the vertical placement mechanism of the chemfig package. Specifically, the chemfig manual (v1.2d, December 1, 2015, currently latest) specifically ...
user avatar
  • 588

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