Debian Codegraph @

texmf-dist/doc/latex/carbohydrates/carbohydrates_en.tex

raw
1 % arara: pdflatex
2 % arara: biber
3 % arara: pdflatex
4 % arara: pdflatex
5 \documentclass[load-preamble+]{cnltx-doc}
6 \usepackage[utf8]{inputenc}
7 \usepackage{carbohydrates}
8
9 \setcnltx{
10 package = {carbohydrates} ,
11 authors = Clemens Niederberger ,
12 email = [email protected] ,
13 info = {carbohydrate molecules with \pkg*{chemfig}} ,
14 url = https://github.com/cgnieder/carbohydrates/ ,
15 abstract = {%
16 \carbohydrates\ offers macros for making exercise sheets when teaching
17 carbohydrate chemistry a lot less tedious. It uses \pkg{chemfig} for
18 drawing the formulas.
19 } ,
20 add-cmds = {
21 allose , altrose , arabinose ,
22 carbohydrate ,
23 desoxyribose ,
24 erythrose ,
25 galactose , glucose , glycerinaldehyde , gulose ,
26 idose ,
27 lyxose ,
28 mannose ,
29 newaldose ,
30 ribose ,
31 setcarbohydrates , setcarbohydratedefaults ,
32 talose , threose ,
33 xylose
34 } ,
35 add-silent-cmds = {
36 arrow ,
37 bondboldwidth , bondhashlength , bondwidth ,
38 D ,
39 chemfig , chemname , chemnameinit ,
40 definesubmol ,
41 iupac ,
42 printatom ,
43 schemestart , schemestop , setatomsep , setbondoffset , setbondstyle ,
44 setcrambond , setdoublesep
45 } ,
46 index-setup = { othercode = \footnotesize , level = \addsec } ,
47 makeindex-setup = { columns = 3 , columnsep = 1em }
48 }
49
50 \defbibheading{bibliography}[References]{\addsec{#1}}
51 \addbibresource{\jobname.bib}
52
53 \usepackage{filecontents}
54 \begin{filecontents*}{\jobname.bib}
55 @online{texdev,
56 url = {http://www.texdev.net/} ,
57 urldate = {2014-04-25} ,
58 author = {Joseph Wright}
59 }
60 \end{filecontents*}
61
62 \usepackage{varioref}
63
64 \usepackage{chemmacros}
65 \chemsetup{greek=newtx}
66 \newcommand*{\bondwidth}{0.06642 em}
67 \newcommand*{\bondboldwidth}{0.22832 em}
68 \newcommand*{\bondhashlength}{0.25737 em}
69 \setdoublesep{0.35700 em}
70 \setatomsep{1.78500 em}
71 \setbondoffset{0.18265 em}
72 \setbondstyle{line width = \bondwidth}
73 \setcrambond
74 {\dimexpr\bondwidth*2 + \bondboldwidth\relax}
75 {\bondwidth}
76 {\bondhashlength}
77 \renewcommand*\printatom[1]{{\small\ensuremath{\mathsf{#1}}}}
78
79 \usepackage{rotating,array,tabu,booktabs}
80
81 \defabbr\vs{\cnltxlatin{vs}}
82
83 \begin{document}
84
85 \section{Licence and Requirements}
86 \license
87
88 \carbohydrates\ loads the packages \pkg{chemfig}~\cite{pkg:chemfig},
89 \pkg{etoolbox}~\cite{pkg:etoolbox} and \pkg{xcolor}~\cite{pkg:xcolor}.
90
91 \section{The Idea}
92 When teaching chemistry -- and in the case of this package: carbohydrate
93 chemistry -- you have to show many examples of the basic aldoses and you have
94 to explain the Fischer and the Haworth representation as well. This means you
95 may have nearly the same \pkg{chemfig}~\cite{pkg:chemfig} formulas over and
96 over in your documents. \carbohydrates\ aims to ease this task.
97
98 The following example will give a short impression of what the package does:
99 \begin{example}
100 \glucose
101 \glucose[model={fischer=skeleton}]
102 \setatomsep{2.5em}
103 \glucose[model=haworth,ring]
104 \glucose[model=haworth,ring=furanose]
105 \end{example}
106
107 \section{Usage}
108 \subsection{The Base Macro}
109 \begin{commands}
110 \command{carbohydrate}[\oarg{options}\marg{spec}]
111 A generic macro for typesetting carbohydrates.
112 \end{commands}
113 We will talk about the options in a bit. First lets see what \meta{spec}
114 means. This argument is a series of the tokens \code{r}, \code{l} and
115 \code{0} denoting an hydroxy group placed to the right or the left in the
116 Fischer projection of the carbohydrate. A \code{0} means that the hydroxy
117 group is to be left out. The series of tokens is meant to describe the
118 hydroxy groups at the chiral centers. The aldehyde group\footnote{Also the
119 keto group once ketoses will be implemented.} and the hydroxy group at the
120 end of the chain will be set automatically. Unless specified otherwise the
121 command expects a hexose which means a series of \emph{four} tokens.
122
123 \begin{example}
124 \chemname{\carbohydrate{llrr}}{\iupac{\D-Mannose}}
125 \chemname{\carbohydrate[model={fischer=skeleton}]{llrr}}{\iupac{\D-Mannose}}
126 \setatomsep{2.5em}\chemnameinit{}
127 \chemname{\carbohydrate[model=chair]{llrr}}{\iupac{\D-Mannose}}
128 \chemname{\carbohydrate[model=haworth]{llrr}}{\iupac{\D-Mannose}}
129 \end{example}
130
131 Adding the option \option{pentose} means that now only \emph{three} tokens
132 need to be specified.
133
134 \begin{example}
135 \chemname{\carbohydrate[pentose]{rlr}}{\iupac{\D-Xylose}}
136 \chemname{\carbohydrate[pentose,model={fischer=skeleton}]{rlr}}{\iupac{\D-Xylose}}
137 \setatomsep{2.5em}\chemnameinit{}
138 \chemname{\carbohydrate[pentose,model=haworth,ring]{rlr}}{\iupac{\D-Xylose}}
139 \chemname{\carbohydrate[pentose,model=haworth,ring=pyranose]{rlr}}{\iupac{\D-Xylose}}
140 \end{example}
141
142 \subsection{Available Options}
143 As you have already seen in the pevious examples \cs{carbohydrate} has an
144 optional argument that takes different options. Here is a complete list:
145 \begin{options}
146 % model/fischer/skeleton/.code = \def\cbhdr@model{fischer@skeleton} ,
147 % model/fischer/full/.code = \def\cbhdr@model{fischer} ,
148 \keychoice{model}{fischer,haworth,chair}\Default{fischer}
149 The model to be used to draw the molecule. The choice \option{fischer}
150 is itself an option with two choices: \keyis{fischer}{skeleton} and
151 \keyis{fischer}{full}. Leaving the choice out will use \code{full} as
152 default choice.
153 \opt{chain}
154 Draw the open chain isomer.
155 \keychoice{ring}{\default{true},pyranose,furanose}
156 Draw a ring isomer. If you don't specify what ring type should be drawn
157 (\ie, if you choose \code{true}) the default depends on the length of the
158 carbohydrate. For example for hexoses the default ring type is
159 \code{pyranose}.
160 \keychoice{anomer}{alpha,beta,undetermined}\Default{alpha}
161 The ring anomer.
162 \keychoice{length}{6,5,4,3}\Default{6}
163 The length of the carbohydrate. \keyis{length}{6} draws a hexose,
164 \keyis{length}{3} draws a triose.
165 \opt{hexose}
166 An alias for \keyis{length}{6}.
167 \opt{pentose}
168 An alias for \keyis{length}{5}.
169 \opt{tetrose}
170 An alias for \keyis{length}{4}.
171 \opt{triose}
172 An alias for \keyis{length}{3}.
173 \keybool{3d}\Default{false}
174 Draw some of the bonds of the rings in the \code{haworth} and \code{chair}
175 models in a way that indicates the three dimensional structure of the
176 molecules.
177 \keylit-{color}{\marg{name}\marg{color}}
178 This option takes two arguments: \meta{name} specifies which part of the
179 molecule is to be colored, \meta{color} specifies the color to be used,
180 also see table~\vref{tab:color} and section~\ref{sec:colors}.
181 \end{options}
182
183 \begin{table}[htb]
184 \centering
185 \caption{Available names for the \option*{color} option.}\label{tab:color}
186 \begin{tabular}{>{\ttfamily}ll}
187 \toprule
188 \rmfamily\bfseries Name & \bfseries Function \\
189 \midrule
190 C1 & carbon 1 \\
191 C2 & carbon 2 \\
192 O-C2 & oxygen of the hydroxy group at carbon 2 \\
193 H-C2 & hydrogen of the hydroxy group at carbon 2 \\
194 C3 & carbon 3 \\
195 O-C3 & oxygen of the hydroxy group at carbon 3 \\
196 H-C3 & hydrogen of the hydroxy group at carbon 3 \\
197 C4 & carbon 4 \\
198 O-C4 & oxygen of the hydroxy group at carbon 4 \\
199 H-C4 & hydrogen of the hydroxy group at carbon 4 \\
200 C5 & carbon 5 \\
201 O-C5 & oxygen of the hydroxy group at carbon 5 \\
202 H-C5 & hydrogen of the hydroxy group at carbon 5 \\
203 C6 & carbon 6 \\
204 O-C6 & oxygen of the hydroxy group at carbon 6 \\
205 H-C6 & hydrogen of the hydroxy group at carbon 6 \\
206 anomerO & oxygen of the anomeric hydroxy group\slash aldehyde oxygen \\
207 anomerH & hydrogen of the anomeric hydroxy group \\
208 ringO & oxygen in the ring \\
209 \bottomrule
210 \end{tabular}
211 \end{table}
212
213 \subsection{Defining Shortcuts}\label{sec:defining-shortcuts}
214
215 \carbohydrates\ allows to define shortcuts for aldoses:
216
217 \begin{commands}
218 \command{newaldose}[\marg{cs}\oarg{options}\marg{spec}]
219 This defines the macro \meta{cs} with preset options \meta{options}.
220 \meta{spec} has the same meaning as for \cs{carbohydrate}.
221 \command{renewaldose}[\marg{cs}\oarg{options}\marg{spec}]
222 The same command but redefines an existing macro.
223 \end{commands}
224
225 In fact, \carbohydrates\ already defines macros for the common aldoses. They
226 are listed in table~\ref{tab:predefined-aldoses} on
227 page~\pageref{tab:predefined-aldoses}. They don't have any predefined options
228 (except for \option{hexose}, \option{pentose} \etc).
229
230 \begin{sidewaystable}
231 \setcarbohydrates{model={fischer=skeleton}}
232 \caption{Overview over the predefined aldoses.}
233 \label{tab:predefined-aldoses}
234 \begin{tabu}{*{8}{X[c]<{\strut}}}
235 \toprule
236 \allose & \altrose & \glucose & \mannose &
237 \gulose & \idose & \galactose & \talose \\
238 \cs{allose} & \cs{altrose} & \cs{glucose} & \cs{mannose} &
239 \cs{gulose} & \cs{idose} & \cs{galactose} & \cs{talose} \\
240 \iupac{\D-Allose} & \iupac{\D-Altrose} &
241 \iupac{\D-Glucose} & \iupac{\D-Mannose} &
242 \iupac{\D-Gulose} & \iupac{\D-Idose} &
243 \iupac{\D-Galactose} & \iupac{\D-Talose} \\
244 \midrule
245 \ribose & \arabinose & \xylose & \lyxose & \desoxyribose \\
246 \cs{ribose} & \cs{arabinose} & \cs{xylose} & \cs{lyxose} &
247 \multicolumn{2}{l}{\cs{desoxyribose}} \\
248 \iupac{\D-Ribose} & \iupac{\D-Arabinose} &
249 \iupac{\D-Xylose} & \iupac{\D-Lyxose} &
250 \iupac{\D-Desoxy|ribose} \\
251 \midrule
252 \erythrose & \threose & \glycerinaldehyde \\
253 \cs{erythrose} & \cs{threose} & \multicolumn{2}{l}{\cs{glycerinaldehyde}} \\
254 \iupac{\D-Erythrose} & \iupac{\D-Threose} &
255 \iupac{\D-Glycerin|aldehyde} \\
256 \bottomrule
257 \end{tabu}
258 \end{sidewaystable}
259
260 \subsection{Available Models}\label{sec:available-models}
261
262 \carbohydrates\ implements different models for drawing carbohydrates:
263 \begin{itemize}
264 \item Fischer -- skeleton: the Fischer representation with only a skeleton
265 formula.
266 \item Fischer -- full: the Fischer representation including all C and H
267 atoms.
268 \item Haworth: the Haworth representation.
269 \item Chair: the chair conformation.
270 \end{itemize}
271
272 While the Fischer model is implemented for all carbohydrates both Haworth and
273 chair are not. The chair model is only implemented for aldohexoses, Haworth
274 is implemented for aldotetroses, -pentoses and -hexoses.
275
276 \begin{example}
277 \glucose[model={fischer=skeleton}]
278 \glucose[model={fischer=full}]
279 \setatomsep{2.5em}
280 \glucose[model=haworth]
281 \glucose[model=chair]
282 \end{example}
283
284 \subsection{Chain \vs\ Ring Forms}
285
286 While the chain forms are available in all models the ring forms obviously
287 aren't. There are two ring forms for hexoses and pentoses: pyranoses and
288 furanoses. For tetroses only the furanose rings are available as there don't
289 exist pyranose ring forms (for obvious reasons). It is also clear that
290 neither pyranose nor furanose forms of trioses exist.
291
292 \begin{example}
293 \setatomsep{2.5em}
294 \glucose[model=haworth,ring]
295 \ribose[model=haworth,ring]
296 \threose[model=haworth,ring]
297 \end{example}
298
299 \textbf{Actually the above is not true: the chain forms are not available in all
300 models for all aldoses. As said in section~\ref{sec:available-models} the
301 chair model is only implemented for aldohexoses. Also chains are not
302 implemented for tetroses and trioses in the Haworth model.}
303
304 \subsection{Default Settings}
305 \begin{commands}
306 \command{setcarbohydrate}[\marg{options}]
307 Set package options for all carbohydrates within the current scope.
308 \command{setcarbohydratedefaults}[\marg{csname}\marg{options}]
309 Set options for a predefined carbohydrate within the current scope. The
310 first argument \meta{csname} is the macro name of the shortcut (see
311 section~\ref{sec:defining-shortcuts}).
312 \end{commands}
313
314 \begin{example}
315 \setatomsep{2.5em}
316 \setcarbohydratedefaults\glucose{ring,model=haworth,anomer=undetermined}
317 \glucose\
318 \mannose
319 \end{example}
320
321 \subsection{Colors}\label{sec:colors}
322 For educating purposes it may be useful to be able to color certain atoms. The
323 \option{color} option allows this.
324 \begin{example}
325 \setcarbohydrates{model=chair}
326 \setatomsep{2.5em}
327 \schemestart
328 \glucose[color={anomerO}{red},color={O-C5}{green},color={H-C5}{blue}]
329 \arrow{<=>}
330 \glucose[ring,color={anomerO}{red},color={ringO}{green},color={anomerH}{blue}]
331 \schemestop
332 \end{example}
333
334 \section{\texorpdfstring{\textsc{todo}}{TODO}s}
335 There are still quite a number of missing features that I'd like to implement
336 some day such as
337 \begin{itemize}
338 \item ring forms for \laevus-carbohydrates,
339 \item support for both chair conformations and the boat conformation,
340 \item support for ketoses,
341 \item support for oxidized and reduzed forms, and
342 \item disaccharides.
343 \end{itemize}
344 There is \emph{no} time table, though -- wether these features will be implemented
345 any time soon or at all is undecided.
346
347 \section{About the Examples in this Manual}
348 All macros used in the examples either belong to \carbohydrates\ and are
349 described in this manual or they belong to either
350 \pkg{chemfig}~\cite{pkg:chemfig}, \pkg{chemmacros}~\cite{pkg:chemmacros},
351 \pkg{chemformula}~\cite{pkg:chemformula}, or are standard \LaTeX\ macros. I
352 encourage you to take a look at the packages for typesetting chemistry
353 documents.
354
355 The \pkg{chemfig} settings have been adjusted for the examples in this
356 manual. Specifically the preamble of this document makes these settings:
357
358 \begin{sourcecode}
359 \newcommand*{\bondwidth}{0.06642 em}
360 \newcommand*{\bondboldwidth}{0.22832 em}
361 \newcommand*{\bondhashlength}{0.25737 em}
362 \setdoublesep{0.35700 em}
363 \setatomsep{1.78500 em}
364 \setbondoffset{0.18265 em}
365 \setbondstyle{line width = \bondwidth}
366 \setcrambond
367 {\dimexpr\bondwidth*2 + \bondboldwidth\relax}
368 {\bondwidth}
369 {\bondhashlength}
370 \renewcommand*\printatom[1]{{\small\ensuremath{\mathsf{#1}}}}
371 \end{sourcecode}
372 These settings are taken from~\cite{texdev}. Search the page for
373 \code{chemfig} and you should be able to find them there.
374
375 \end{document}