Rev 6770 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
10 | reyssat | 1 | ------------------------------------------- |
7222 | georgesk | 2 | chemeq V2.12-1 |
10 | reyssat | 3 | ------------------------------------------- |
7222 | georgesk | 4 | (c)2000-2013 G. Khaznadar |
5 | <georgesk@debian.org> |
||
10 | reyssat | 6 | ------------------------------------------- |
7 | |||
8 | chemeq is a basic standalone filter written in C language, |
||
9 | flex and bison. It inputs strings like: |
||
10 | 2H2 + O2 ---> 2 H2O |
||
11 | and can outputs LaTeX code and messages about the equilibrium of a |
||
12 | chemical reaction. |
||
13 | |||
14 | example:~/src$ echo "2H2 + O2 ---> 2 H2O" | chemeq -lc |
||
15 | 2\,H_{2}\,+\,O_{2}\,\rightarrow\,2\,H_{2}O |
||
16 | OK |
||
17 | example:~/src$ |
||
18 | |||
19 | which means : 2 molecules of dihydrogen react with one molecule of |
||
20 | dioxygen, yelding two water molecules. |
||
21 | The first line, "2\,H_{2}\,+\,O_{2}\,\rightarrow\,2\,H_{2}O" is a translation |
||
22 | of the equation in LaTeX language. |
||
23 | The second line "OK" means that the equation is well equilibrated. |
||
24 | |||
25 | When the input is not successfully parsed, the filter fails with |
||
26 | the exit code 1. |
||
27 | |||
28 | example:~/src$ echo "2H^2 + O2 ---> 2 H2O" | chemeq -lc |
||
29 | ERROR parse error at 4 |
||
30 | example:~/src$ |
||
31 | |||
32 | NOTE : syntax of ions. |
||
33 | allthough in some cases, shorter expressions are sucessfully parsed, |
||
34 | it is safer to consider that an "up arrow" (^) must be put before the |
||
35 | charge symbols of an ion. |
||
36 | Examples : H3O^+, Fe(CN)6^4-, OH^- |
||
37 | |||
38 | NOTE : square brackets |
||
39 | Square brackets are allowed outside of a simple chemical notation, as in |
||
40 | [Fe(CN)6]4-, and only there. |
||
41 | |||
42 | NOTE : Chemical equilibrium constants. |
||
43 | For chemical equilibriums, the constant for the Gulder-Waage equation or |
||
44 | the potential for the Nernst equation can be written at the end of the |
||
45 | equation, surrounded by parentheses. See some examples in src/test.1, and |
||
46 | get them rendered by LaTeX with the command src/chemreport |
||
47 | |||
48 | This filter can be embedded in educational test systems, in order to |
||
49 | analyze a student's answer to a problem of physics or chemistry. |
||
50 | |||
51 | This software snippet is GPL, see the file COPYING. |
||
52 | |||
53 | Feedback is welcome. |
||
54 | |||
55 | -- |
||
56 | Georges. |
||
57 | |||
58 | ----------------------------------------------------------- |
||
59 | Chemeq options |
||
60 | ----------------------------------------------------------- |
||
61 | |||
62 | You can choose chemeq's output by specifying some options. |
||
63 | Valid options are the following : |
||
64 | |||
65 | -h outputs a *H*elp message. |
||
66 | -m outputs a *M*inimal output. It allows chemeq to be idempotent, |
||
67 | i.e. the command 'chemeq | chemeq' is equivalent to 'chemeq'. |
||
68 | -l outputs a *L*aTeX string representing the chemical equation. |
||
69 | -c outputs a message giving informations about the *C*onservation of |
||
70 | elements and charges in the equation. 'OK' means that both elements |
||
71 | and electric charges are balanced. |
||
72 | -w outputs the LaTeX string representing the Gulder-*W*aage equation |
||
73 | related to the input chemical equation, or the Nernst equation, |
||
74 | if the input equation is a redox semi-equation. |
||
75 | -n outputs a *N*ormalized string accounting for the input equation. |
||
76 | Two chemical equations having the same normalized string are chemically |
||
77 | equivalent, even if the molecules are scrambled around and the |
||
78 | coefficient are not equal but proportionnal. |
||
79 | |||
80 | 'chemeq' defaults to 'chemeq -mlcwn'. |
||
81 | |||
82 | ----------------------------------------------------------- |
||
83 | INSTALLATION |
||
84 | ----------------------------------------------------------- |
||
85 | To build chemeq, run 'make' in the main chemeq directory, to install it |
||
86 | with its man page, run 'make install' in the main directory. |
||
87 | |||
88 | |||
89 | ----------------------------------------------------------- |
||
90 | TEST MODE and DEMO |
||
91 | ----------------------------------------------------------- |
||
92 | |||
93 | If you modifiy the source code, it is possible to test its conformance |
||
94 | to previous versions by running 'make test' in the main directory. |
||
95 | |||
96 | If 'make test' replies 'OK' for all items, and if you have latex and |
||
97 | xdvi installed, you can run 'make demo' to see some examples of typesetting. |