• Home
  • Readings
  • Github
  • MIES
  • TmVal
  • About
Gene Dan's Blog

No. 117: Amino Acid Structural Formulas with Chemfig (Nonpolar Side Chains)

28 March, 2017 7:46 PM / 1 Comment / Gene Dan

\LaTeX can do some pretty neat things. While it’s mostly known for typesetting mathematical notation, it can also be used to render structural formulas via the chemfig package, which makes it useful in the electronic communication of chemistry concepts – for example, it would allow two chemists located in different countries to chat over a message board, easing collaboration.

I’ll demonstrate some of the capabilities of chemfig by rendering the structural formulas of amino acids – 20 distinct molecules that serve as the building blocks of proteins – that is, the basis of cellular activity. Below are structural formulas for 9 of these, the ones with nonpolar side chains (this means that the side chains are hydrophobic, and do not have an affinity for water).

Amino Acid Structure
The basic structure of an amino acid consists of an asymmetric carbon bonded to four components – a hydrogen atom, an amino group, a carboxyl group, and an R-group. The amino group can act as a base, accepting a hydrogen ion. The carboxyl group can act as an acid (hence the name, amino acid), donating a hydrogen ion. The R-group is what gives a particular amino acid its identity (that is, whether a particular amino acid is glycine, tryptophan, etc.). It is unique for each type of amino acid and dictates its behavior. The amino group of one amino acid can bond with the carboxyl group of another amino acid, forming a peptide bond. When several amino acids are linked in a chain, they form a polypeptide – and one or more polypeptides together form a protein molecule.

Rendered by QuickLaTeX.com

This basic structure serves as a template for each of the amino acids below. The amino and carboxyl groups, together with the asymetric carbon and lower hydrogen atom, form the amino acid’s contribution to the polypeptide backbone. These are highlighted in blue. The R-group, distinct for each amino acid, is highlighted in red.

Notice that each of the code samples below contains a repeating pattern – \chemfig renders the structural formula of the amino acid. \chemmove draws the boxes that highlight the backbone and R-groups.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
\chemfig{
C(-[:180]@{AR}N(-[:135]H)(-[:225]@{AL}H))(-[:0]@{CL}C(=[:45]@{CR}O)(-[:315]OH))(-[:90]@{R}R)(-[:270]H)
}
 
\chemmove{
  \draw[
    fill=purple,
    draw=purple,
    fill opacity=.2,
    rounded corners=2pt
  ]
    ([xshift=-3pt,yshift=-3pt]R.south west)
    rectangle
    ([xshift=4pt,yshift=3pt]R.north east)   node[xshift=0pt,yshift=5pt,above,opacity=1,orientation]{R Group (Side Chain)};
}
 
\chemmove{
  \draw[
    fill=cyan,
    draw=cyan,
    fill opacity=.1,
    rounded corners=2pt
  ]
    ([xshift=-6pt,yshift=-15pt]AL.south west) node[xshift=15pt,yshift=-6pt,below,opacity=1,orientation]{Amino Group}
    rectangle
    ([xshift=3pt,yshift=35pt]AR.north east)
;
}
 
\chemmove{
  \draw[
    fill=cyan,
    draw=cyan,
    fill opacity=.1,
    rounded corners=2pt
  ]
    ([xshift=-3pt,yshift=-39pt]CL.south west) node[xshift=24pt,yshift=-6pt,below,opacity=1,orientation]{Carboxyl Group}
    rectangle
    ([xshift=12pt,yshift=12pt]CR.north east)
;
}

Glycine

For glycine, the R-group is a single hydrogen atom.

Rendered by QuickLaTeX.com

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
\chemfig{
C(-[:0]C(-[:0]@{C}O^{-})(=[:270]O))
(-[:270]H)(-[:180]H_3N^{+}(-[:270,1,,,draw=none]@{A}))
(-[:90]@{R}H)
}
 
\chemmove{
  \draw[
    fill=purple,
    draw=purple,
    fill opacity=.2,
    rounded corners=2pt
  ]
    ([xshift=-3pt,yshift=-3pt]R.south west)
    rectangle
    ([xshift=4pt,yshift=3pt]R.north east) ;
}
 
\chemmove{
  \draw[
    fill=cyan,
    draw=cyan,
    fill opacity=.1,
    rounded corners=2pt
  ]
    ([xshift=-9pt,yshift=-7pt]A.south west)
    rectangle
    ([xshift=3pt,yshift=5pt]C.north east)
;
}

Alanine

The R-group for alanine is a little more complex than that of glycine, consisting of a methyl group instead of a hydrogen atom.

Rendered by QuickLaTeX.com

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
\chemfig{
C(-[:0]C(-[:0]@{C}O^{-})(=[:270]O))
(-[:270]H)(-[:180]H_3N^{+}(-[:270,1,,,draw=none]@{A}))
(-[:90]@{RL}CH_{3})
}
 
\chemmove{
  \draw[
    fill=purple,
    draw=purple,
    fill opacity=.2,
    rounded corners=2pt
  ]
    ([xshift=-3pt,yshift=-5pt]RL.south west)
    rectangle
    ([xshift=16pt,yshift=3pt]RL.north east) ;
}
 
\chemmove{
  \draw[
    fill=cyan,
    draw=cyan,
    fill opacity=.1,
    rounded corners=2pt
  ]
    ([xshift=-9pt,yshift=-7pt]A.south west)
    rectangle
    ([xshift=3pt,yshift=5pt]C.north east)
;
}

Valine

Rendered by QuickLaTeX.com

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
\chemfig{
C(-[:0]C(-[:0]@{C}O^{-})(=[:270]O))
(-[:270]H)(-[:180]H_3N^{+}(-[:270,1,,,draw=none]@{A}))
(-[:90]CH(-[:135]CH_{3})(-[:45]@{RR}CH_{3})(-[:180,1,,,draw=none]@{RL}))
}
 
\chemmove{
  \draw[
    fill=purple,
    draw=purple,
    fill opacity=.2,
    rounded corners=2pt
  ]
    ([xshift=-9pt,yshift=-9pt]RL.south west)
    rectangle
    ([xshift=15pt,yshift=6pt]RR.north east) ;
}
 
\chemmove{
  \draw[
    fill=cyan,
    draw=cyan,
    fill opacity=.1,
    rounded corners=2pt
  ]
    ([xshift=-9pt,yshift=-7pt]A.south west)
    rectangle
    ([xshift=3pt,yshift=5pt]C.north east)
;
}

Leucine

Rendered by QuickLaTeX.com

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
\chemfig{
C(-[:0]C(-[:0]@{C}O^{-})(=[:270]O))
(-[:270]H)(-[:180]H_3N^{+}(-[:270,1,,,draw=none]@{A}))
(-[:90]CH_{2}((-[:90]CH(-[:135]CH_{3})(-[:45]@{RR}CH_{3})))(-[:180,1,,,draw=none]@{RL}))
}
 
\chemmove{
  \draw[
    fill=purple,
    draw=purple,
    fill opacity=.2,
    rounded corners=2pt
  ]
    ([xshift=-9pt,yshift=-9pt]RL.south west)
    rectangle
    ([xshift=15pt,yshift=9pt]RR.north east) ;
}
 
\chemmove{
  \draw[
    fill=cyan,
    draw=cyan,
    fill opacity=.1,
    rounded corners=2pt
  ]
    ([xshift=-9pt,yshift=-7pt]A.south west)
    rectangle
    ([xshift=3pt,yshift=5pt]C.north east)
;
}

Isoleucine

Rendered by QuickLaTeX.com

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
\chemfig{
C(-[:0]C(-[:0]@{C}O^{-})(=[:270]O))
(-[:270]H)(-[:180]H_3N^{+}(-[:270,1,,,draw=none]@{A}))
(-[:90]CH(-[:180]@{RL}H_3C)(-[:90]CH_{2}(-[:90]@{RR}CH_{3})))
}
 
\chemmove{
  \draw[
    fill=purple,
    draw=purple,
    fill opacity=.2,
    rounded corners=2pt
  ]
    ([xshift=-6pt,yshift=-9pt]RL.south west)
    rectangle
    ([xshift=18pt,yshift=9pt]RR.north east) ;
}
 
\chemmove{
  \draw[
    fill=cyan,
    draw=cyan,
    fill opacity=.1,
    rounded corners=2pt
  ]
    ([xshift=-9pt,yshift=-7pt]A.south west)
    rectangle
    ([xshift=3pt,yshift=5pt]C.north east)
;
}

Methionine

Rendered by QuickLaTeX.com

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
\chemfig{
C(-[:0]C(-[:0]@{C}O^{-})(=[:270]O))
(-[:270]H)(-[:180]H_3N^{+}(-[:270,1,,,draw=none]@{A}))
(-[:90]@{RL}CH_{2}(-[:90]CH_{2}(-[:90]S(-[:90]@{RR}CH_{3}))))
}
 
\chemmove{
  \draw[
    fill=purple,
    draw=purple,
    fill opacity=.2,
    rounded corners=2pt
  ]
    ([xshift=-6pt,yshift=-9pt]RL.south west)
    rectangle
    ([xshift=18pt,yshift=9pt]RR.north east) ;
}
 
\chemmove{
  \draw[
    fill=cyan,
    draw=cyan,
    fill opacity=.1,
    rounded corners=2pt
  ]
    ([xshift=-9pt,yshift=-7pt]A.south west)
    rectangle
    ([xshift=3pt,yshift=5pt]C.north east)
;
}

Phenylalanine

Rendered by QuickLaTeX.com

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
\chemfig{
C(-[:0]C(-[:0]@{C}O^{-})(=[:270]O))
(-[:270]H)(-[:180]H_3N^{+}(-[:270,1,,,draw=none]@{A}))
(-[:90]@{RL}CH_{2}(-[:90]*6(-=-@{RR}=-=)))
}
 
\chemmove{
  \draw[
    fill=purple,
    draw=purple,
    fill opacity=.2,
    rounded corners=2pt
  ]
    ([xshift=-33pt,yshift=-9pt]RL.south west)
    rectangle
    ([xshift=36pt,yshift=6pt]RR.north east) ;
}
 
\chemmove{
  \draw[
    fill=cyan,
    draw=cyan,
    fill opacity=.1,
    rounded corners=2pt
  ]
    ([xshift=-9pt,yshift=-7pt]A.south west)
    rectangle
    ([xshift=3pt,yshift=5pt]C.north east)
;
}

Tryptophan

This was definitely the hardest of the amino acids to draw so far. It took multiple attempts to get the ring structure correct. I also had a problem rendering the full image (the top was being cropped off). I actually have an invisible structure embedded in the page code that serves as a workaround to getting the full image rendered.

Rendered by QuickLaTeX.com

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
\chemfig{
C(-[:0]C(-[:0]@{C}O^{-})(=[:270]O))
(-[:270]H)(-[:180]H_3N^{+}(-[:270,1,,,draw=none]@{A}))
(-[:90]@{RL}CH_{2}(-[:90]?(*6([::-30]=-NH-(*6(--@{RR}----))=?))))
}
 
\chemmove{
  \draw[
    fill=purple,
    draw=purple,
    fill opacity=.2,
    rounded corners=2pt
  ]
    ([xshift=-33pt,yshift=-9pt]RL.south west)
    rectangle
    ([xshift=36pt,yshift=6pt]RR.north east) ;
}
 
\chemmove{
  \draw[
    fill=cyan,
    draw=cyan,
    fill opacity=.1,
    rounded corners=2pt
  ]
    ([xshift=-9pt,yshift=-7pt]A.south west)
    rectangle
    ([xshift=3pt,yshift=5pt]C.north east)
;
}
\chemfig{
-[:90,1,,,draw=none](-[:90,1,,,draw=none])
}

Proline

Rendered by QuickLaTeX.com

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
\chemfig{
C(-[:0]C(-[:0]@{C}O^{-})(=[:270]O))
(-[:270]H)(-[:180]H_3N^{+}(-[:270,1,,,draw=none]@{A})(-[:90]@{RL}H_{2}C?))
(-[:90]CH_{2}(-[:120]@{RR}CH_{2}?))
}
 
\chemmove{
  \draw[
    fill=purple,
    draw=purple,
    fill opacity=.2,
    rounded corners=2pt
  ]
    ([xshift=-3pt,yshift=-9pt]RL.south west)
    rectangle
    ([xshift=42pt,yshift=9pt]RR.north east) ;
}
 
\chemmove{
  \draw[
    fill=cyan,
    draw=cyan,
    fill opacity=.1,
    rounded corners=2pt
  ]
    ([xshift=-9pt,yshift=-7pt]A.south west)
    rectangle
    ([xshift=3pt,yshift=5pt]C.north east)
;
}

Posted in: Uncategorized / Tagged: acid, amino, chemfig, LaTeX, structural formula

One Thought on “No. 117: Amino Acid Structural Formulas with Chemfig (Nonpolar Side Chains)”

  1. Regan on 17 April, 2018 at 11:09 PM said:

    This article was helpful, thanks. I did tryptophan like this though:

    %TRYPTOPHAN
    \chemfig{
    C %alpha carbon
    (-[:0]C(-[:0]O^{-})(=[:270]O)) %carboxyl group
    (-[:270]H) %hydrogen
    (-[:180]H_3N^+) %amino group
    (-[2]CH_2(-[3]
    C*5(-C*6(-C(-H)=C(-H)-C(-H)=C?(-H))=C?-N(-H)=C(-H)-)))
    }

    Reply↓

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Post Navigation

← Previous Post
Next Post →

Archives

  • September 2023
  • February 2023
  • January 2023
  • October 2022
  • March 2022
  • February 2022
  • December 2021
  • July 2020
  • June 2020
  • May 2020
  • May 2019
  • April 2019
  • November 2018
  • September 2018
  • August 2018
  • December 2017
  • July 2017
  • March 2017
  • November 2016
  • December 2014
  • November 2014
  • October 2014
  • August 2014
  • July 2014
  • June 2014
  • February 2014
  • December 2013
  • October 2013
  • August 2013
  • July 2013
  • June 2013
  • March 2013
  • January 2013
  • November 2012
  • October 2012
  • September 2012
  • August 2012
  • July 2012
  • June 2012
  • May 2012
  • April 2012
  • March 2012
  • February 2012
  • January 2012
  • December 2011
  • September 2011
  • August 2011
  • July 2011
  • June 2011
  • January 2011
  • December 2010
  • October 2010
  • September 2010
  • August 2010
  • June 2010
  • May 2010
  • April 2010
  • March 2010
  • September 2009
  • August 2009
  • May 2009
  • December 2008

Categories

  • Actuarial
  • Cycling
  • Logs
  • Mathematics
  • MIES
  • Music
  • Uncategorized

Links

Cyclingnews
Jason Lee
Knitted Together
Megan Turley
Shama Cycles
Shama Cycles Blog
South Central Collegiate Cycling Conference
Texas Bicycle Racing Association
Texbiker.net
Tiffany Chan
USA Cycling
VeloNews

Texas Cycling

Cameron Lindsay
Jacob Dodson
Ken Day
Texas Cycling
Texas Cycling Blog
Whitney Schultz
© Copyright 2025 - Gene Dan's Blog
Infinity Theme by DesignCoral / WordPress