2

Using chemfig package, for drawing the salicylic acid I obtain this crop image:

\documentclass[a4paper,12pt]{article}
\usepackage{chemfig}
\begin{document}
\chemfig{
            % 1
     -[:300]% 2
          =_% 3
               (
          -[:60]% 13
                   (
         -[:120,,,2]HO% 15
                   )
               =O% 14
               )
     -[:300]% 4
               (
         -[,,,1]OH% 12
               )
    =_[:240]% 5
               (
         -[:300]% 8
                   (
             -[:240]% 10
                   )
                   (
             -[:300]% 11
                   )
               -% 9
               )
     -[:180]% 6
    =_[:120]% 7
               (
          -[:60]% -> 2
               )
}
\end{document}

enter image description here

Why the line are more closer with the edges of the hexagon? To switch to have more distance and the font (peraphs is Arial), little segments (see the picture - for example below -) do I must use another package for chemistry and to use fontspec, unicode... Arial?

enter image description here

EDIT:

In this web site https://www.texdev.net/2012/08/25/exploring-chemfig-customising-appearance/ there is a macro to get a little internal segment with a more distance:

enter image description here

How is it must be used?

\setdoublesep{0.35700 em}  % 'Bond Spacing'
\setatomsep{1.78500 em}    % 'Fixed Length'
\setbondoffset{0.18265 em} % 'Margin Width'
\newcommand{\bondwidth}{0.06642 em} % 'Line Width'
\setbondstyle{line width = \bondwidth}

I have improved a bit the code, for the font helvet, of the user @muzimuzhi Z that I give to him my thank you very much for the work. But I have the internal segment more long.

\documentclass[a4paper,12pt]{article}
\usepackage[T1]{fontenc}
\renewcommand*\familydefault{\sfdefault}
\usepackage[scaled=1]{helvet}
\usepackage{chemfig}
%\renewcommand*\printatom[1]{\ensuremath{\mathsf{#1}}}
\renewcommand*\printatom[1]{\sffamily{#1}}%%% only text in helvet clone of Arial
\setchemfig{
  atom sep=1.5em,
  bond style={
    line width=.8pt, line cap=round, line join=round
  }
}



\begin{document}


\chemfig{
            % 1
     -[:300]% 2
          =_% 3
               (
          -[:60]% 13
                   (
         -[:120,,,2]HO% 15
                   )
               =O% 14
               )
     -[:300]% 4
               (
         -[,,,1]OH% 12
               )
    =_[:240]% 5
               (
         -[:300]% 8
                   (
             -[:240]% 10
                   )
                   (
             -[:300]% 11
                   )
               -% 9
               )
     -[:180]% 6
    =_[:120]% 7
               (
          -[:60]% -> 2
               )
}
\end{document}

enter image description here

1 Answer 1

2

chemfig is configurable. In the following example,

  • \printatom is redefined to use sans serif font,
  • length of bond is shorten by option atom sep, and
  • line width of bond is made thicker with option line width.

Chemfig will auto shorten the inner bond line of a double bond in cycle, but in your example the bonds are drawn without using the cycle syntax. Question How to alter the bond length of a double bond in chemfig? contains some workarounds, but neither of them is automatic.

\documentclass[a4paper,12pt]{article}
\usepackage{chemfig}

\renewcommand*\printatom[1]{\ensuremath{\mathsf{#1}}}
\setchemfig{
  atom sep=1.5em,
  bond style={
    line width=.8pt, line cap=round, line join=round
  }
}

\begin{document}
\chemfig{
            % 1
     -[:300]% 2
          =_% 3
               (
          -[:60]% 13
                   (
         -[:120,,,2]HO% 15
                   )
               =O% 14
               )
     -[:300]% 4
               (
         -[,,,1]OH% 12
               )
    =_[:240]% 5
               (
         -[:300]% 8
                   (
             -[:240]% 10
                   )
                   (
             -[:300]% 11
                   )
               -% 9
               )
     -[:180]% 6
    =_[:120]% 7
               (
          -[:60]% -> 2
               )
}
\end{document}

enter image description here

3
  • But the segment into the hexagon seem more closer to the lateral edges. There is few distance. But have you tried using Arial font?
    – Sebastiano
    Commented Jul 31, 2020 at 18:51
  • 1
    @Sebastiano I edited the answer to use a longer atom sep. Does this look better? Commented Jul 31, 2020 at 19:43
  • Surely better :-)...I have upvoted before, I'm sorry. The font it is helvet.
    – Sebastiano
    Commented Jul 31, 2020 at 22:05

You must log in to answer this question.

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