When trying to use chemfig I get two errors.First there is a "two documentclass" error and second a "undefined control sequence \chemfig".What can be done about this? Uninstall/reinstall doesn't help.

  • 1
    Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. Apr 22, 2014 at 4:22
  • 1
    Maybe you have put \documentclass{chemfig} instead of \usepackage{chemfig} to your header.
    – LaRiFaRi
    Apr 22, 2014 at 6:16
  • Found out whatwas wrong. Turns out that chemfig DOES NOT load tikz.So after inclusion of \usepackage{tikz} in my preamble it worked. Sorry for wasting your time.
    – numicius
    Apr 22, 2014 at 7:38
  • @numicius that's strange because ususally chemfig does load TikZ!
    – cgnieder
    Apr 22, 2014 at 7:50

1 Answer 1


I would guess that your main document is called chemfig.tex which is a bad idea as \chemfig.sty is a thin wrapper which inputs the plain tex macros chemfig.tex via

\input chemfig.tex

so since the current directory of the main document (not of the current file) is usually at the front of the search path, this just re-inputs your main document and you get an error about two \documentclass commands.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .