I am learning to use the chemfig package and get the structures to match certain templates. One of the parameters that is important, is the font size and font family of the atoms. So far, to create a typical structure in a figure I got:

double bond sep=\bondspacing pt, %space between multiple bonds lines
atom sep=\bondlength pt, %distance between atoms (bond length)
cram width=2 pt, %width of wedged and hashed bonds (bold width)
cram dash width=0.5 pt, %thickness of lines in hashed bonds
cram dash sep =2.5pt, % distance between lines in hashed bonds (hash spacing)
bond offset=1.6 pt, %space between bond and atom (margin width)
compound sep=10 em,%separation between compounds
arrow coeff=1, %default length of the arrow
arrow offset=0.75em, %distance between arrow ends and compounds
arrow label sep=3pt, %distance between arrow and label
scheme debug=false, %show the anchors 
%atom style=red, %color atoms
%bond style=red, %color bonds
bond style={line width=0.6pt}, %bond line width - can be combined with color as bond style={line width=1pt,red}
%compound style={draw,line width=0.5pt,semitransparent,text opacity=1,inner sep=8pt,rounded corners=1mm}, %draws a box around each compound - needs the argument A\arrow([fill=red]--[fill=blue]) to work
\caption{This is the compound (\cmpd{ethylcompound}).}

(pardon the comments).

But changing the \sffamily doesn't seem to change the output font.

The current output is:

enter image description here

  • 4
    That looks quite right, doesn't it? The S is sans-serif. Note that the \sffamily isn't doing anything meaningful, as you use \mathsf anyway.
    – campa
    Nov 4, 2020 at 11:59
  • I was hoping I could swap families to roman, bold, or whatever the required format is (e.g. for different journals).
    – Dim
    Nov 4, 2020 at 12:12
  • Wait, are you changing \sffamily but leaving \mathsf?
    – campa
    Nov 4, 2020 at 12:14
  • 1
    \mathsf uses the math sans-serif font. Once you have that, everything else you put outside of \ensuremath is rather useless (except size commands).
    – campa
    Nov 4, 2020 at 12:18
  • 1
    Sorry but I still do not exactly understand what you are trying to achieve. \renewcommand*\printatom[1]{\ensuremath{\mathsf{#1}}} is everything you need, and does not force you to use \ce in the argument. But apart from eliminating \normalsize\sffamily (which do nothing in this case) you already had this in your question. So: what is the question?
    – campa
    Nov 4, 2020 at 12:51

1 Answer 1


Since chemfig uses math fonts to print letters, you can use the mathastext package with the subdued option, like so

\Mathastext[chem] % create a math version for chemfig
\let\chmf\chemfig % copy the chemfig command
\renewcommand*{\chemfig}[1]{{\MTVersion{chem}\chmf{#1}}} % set the math version before printing

This way, the maths in the document remain the same, but your atoms will be printed with your text font.

You must log in to answer this question.

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