issue193:latex
Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
issue193:latex [2023/05/29 07:48] – créée d52fr | issue193:latex [2023/06/10 15:49] (Version actuelle) – andre_domenech | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | I was motivated to write this issue' | + | **I was motivated to write this issue' |
- | If you are interested or required | + | J’ai été motivé pour écrire la chronique de ce numéro par le dernier tome de Harold McGee « Nose Dive: A field guide to the world’s smells » (New York. Penguin Press : 2020. ISBN 978-0-14-311089-7). Ce livre a 653 pages pleines d’informations fascinantes et enthousiastes sur les parfums, les arômes, les odeurs. Tous ceux d’entre vous qui sont cuisiniers ou chefs connaissent probablement les autres ouvrages de McGee sur la cuisine. Ce guide de terrain du monde des odeurs contient une énorme quantité de chimie organique, y compris de nombreux diagrammes structurels. Ces diagrammes sont de petits dessins de lignes de molécules organiques. Il y a probablement plus de détails nécessaires pour satisfaire un lecteur ordinaire, mais pas assez pour quelqu’un ayant une connaissance plus approfondie de ces molécules. Je pensais découvrir comment LaTeX gère les formules chimiques. |
- | This column is not an introduction | + | **If you are interested or required |
- | Let's start with a simple organic compound we are all familiar with: ethanol, | + | This column is not an introduction to organic chemistry. I am using a personal interest to show off more of the capabilities |
- | In order to show the complexities of molecules in a word processor, one has to use chemistry software to draw a compound, then export the drawing as an image (bmp, gif, jpeg, etc). Then import the image into the word processing document. In Latex, one simply uses the chemfig package and then uses the macros | + | Si vous êtes intéressé ou tenu d’utiliser LaTeX pour faire des diagrammes chimiques, veuillez télécharger le manuel chemfig disponible à ctan.org. Il suffit de chercher chemfig et vous le trouverez. Comme chemfig fait partie d’une installation LaTeX standard sur Linux, vous n’avez pas besoin de l’installer. Le manuel sera très utile au fur et à mesure que vous vous habituerez aux commandes de ce puissant ensemble de macros |
- | C2H5OH becomes: | + | Cet article n’est pas une introduction à la chimie organique. J’utilise un intérêt personnel pour en montrer plus des capacités de TeX/LaTeX. Si vous avez un intérêt personnel à avoir besoin ou utiliser des fichiers PDF imprimés ou électroniques, |
+ | |||
+ | **Let' | ||
+ | |||
+ | In order to show the complexities of molecules in a word processor, one has to use chemistry software to draw a compound, then export the drawing as an image (bmp, gif, jpeg, etc). Then import the image into the word processing document. In Latex, one simply uses the chemfig package and then uses the macros - syntax built into that package. (Note: There are other packages which are available for building chemical structures.)** | ||
+ | |||
+ | Commençons par un simple composé organique que nous connaissons tous, l’éthanol, | ||
+ | |||
+ | Afin de montrer les complexités des molécules dans un traitement de texte, on doit utiliser un logiciel de chimie pour dessiner un composé, puis exporter le dessin comme une image (bmp, gif, jpeg, etc), enfin importer l’image dans le document de traitement de texte. Dans LaTeX, on utilise simplement le paquet chemfig et ensuite les macros - syntaxe intégrée dans ce paquet. (Note : Il y a d’autres paquets qui sont disponibles pour construire des structures chimiques.) | ||
+ | |||
+ | **C2H5OH becomes: | ||
\chemfig{C_2H_5OH} | \chemfig{C_2H_5OH} | ||
Ligne 29: | Ligne 39: | ||
Every empty end point or where two lines meet indicates a carbon atom. | Every empty end point or where two lines meet indicates a carbon atom. | ||
- | Carbon always has four bonds so any " | + | Carbon always has four bonds so any " |
- | With these two conventions, | + | C2H5OH devient : |
+ | |||
+ | \chemfig{C_2H_5OH} | ||
+ | |||
+ | Le code LaTeX utilisant chemfig est beaucoup plus simple que le code LaTeX utilisant des commandes de texte régulières. Dans le PDF généré, vous ne verrez aucune différence. | ||
+ | |||
+ | Maintenant je vais utiliser chemfig pour dessiner la structure qui révèle les liaisons. | ||
+ | |||
+ | \chemfig{H_3C-[: | ||
+ | |||
+ | Note : Les [:30] et [:-30] indiquent les degrés auxquels l’angle de la liaison suivante déviera de la liaison précédente. Sans cela, l’image serait une ligne droite avec -OH collé à la fin. Ce ne serait pas instructif. | ||
+ | |||
+ | Maintenant un schéma structurel de chimie organique classique pour l’éthanol : | ||
+ | |||
+ | \chemfig{-[: | ||
+ | |||
+ | Pour ceux qui ne connaissent pas ces diagrammes, voici une explication : | ||
+ | |||
+ | Chaque point d’extrémité vide, où deux lignes se rencontrent, | ||
+ | |||
+ | Le carbone a toujours quatre liaisons, donc toute liaison « invisible » (ou « manquante ») est toujours avec l’hydrogène. | ||
+ | |||
+ | **With these two conventions, | ||
Chemical formulae which have only superscripts, | Chemical formulae which have only superscripts, | ||
- | Let's take a look at another simple organic compound we are all familiar with: acetic acid, which is the active component in vinegar. Its formula is CH3COOH which does not tell you much about its structure unless you are familiar with organic acids. The -OH bonded to an end carbon is the distinguishing mark of the family of alcohols. Organic acids also have the -OH group on one end. Next to it, on the same carbon, is an oxygen atom with two bonds to that same carbon. The left-hand carbon is bonded to 3 hydrogen atoms. Its last bond links it to the second carbon. The second carbon has one bond to the first carbon, two bonds to one oxygen, and one bond to another oxygen. The second bond on the second oxygen is linked to a hydrogen. (Clear? If not, look at the acetic acid molecule in figure 1) | + | Let's take a look at another simple organic compound we are all familiar with: acetic acid, which is the active component in vinegar. Its formula is CH3COOH which does not tell you much about its structure unless you are familiar with organic acids. The -OH bonded to an end carbon is the distinguishing mark of the family of alcohols. Organic acids also have the -OH group on one end. Next to it, on the same carbon, is an oxygen atom with two bonds to that same carbon. The left-hand carbon is bonded to 3 hydrogen atoms. Its last bond links it to the second carbon. The second carbon has one bond to the first carbon, two bonds to one oxygen, and one bond to another oxygen. The second bond on the second oxygen is linked to a hydrogen. (Clear? If not, look at the acetic acid molecule in figure 1)** |
- | \chemfig{H_3C-[: | + | Avec ces deux conventions, |
+ | |||
+ | Les formules chimiques qui n’ont que des exposants, des indices et des symboles de base (égaux, flèches, etc.) peuvent généralement être écrites en utilisant les outils d’un traitement de texte. Écrire quelque chose de plus complexe nécessite un traitement de texte et un logiciel spécialisé, | ||
+ | |||
+ | Examinons un autre composé organique simple que nous connaissons tous : l’acide acétique, qui est le composant actif du vinaigre. Sa formule est CH3COOH qui ne vous dit pas beaucoup sur sa structure, sauf si vous êtes familier avec les acides organiques. Le -OH lié à un carbone d’extrémité est la marque distinctive de la famille des alcools. Les acides organiques ont également le groupe -OH à une extrémité. À côté de lui, sur le même carbone, est un atome d’oxygène avec deux liaisons à ce même carbone. Le carbone de gauche est lié à 3 atomes d’hydrogène. Sa dernière liaison la relie au second carbone. Le deuxième carbone a une liaison au premier carbone, deux liaisons à un oxygène, et une liaison à un autre oxygène. La deuxième liaison sur le deuxième oxygène est liée à un hydrogène. (Clair ? Sinon, regardez la molécule d’acide acétique sur la figure de la page précédente.) | ||
+ | |||
+ | **\chemfig{H_3C-[: | ||
This could be simplified as I did with ethanol. I leave that up to you. | This could be simplified as I did with ethanol. I leave that up to you. | ||
Ligne 49: | Ligne 87: | ||
\chemfig{-[: | \chemfig{-[: | ||
- | Even to me this article is starting to sound like a lecture in organic chemistry. So only one more brief example. Phenol is a chemical used in many disinfectants and cleaners. It is also part of the formula for a famous brand of mouthwash. If you had dental work done during COVID, your dentist or hygienist probably asked you to rinse your mouth carefully with something that had phenol in it. Phenol is a six-carbon ring, a benzene ring, with an OH group attached to one carbon. It is not easy to draw quickly or accurately - except in Latex. | + | Even to me this article is starting to sound like a lecture in organic chemistry. So only one more brief example. Phenol is a chemical used in many disinfectants and cleaners. It is also part of the formula for a famous brand of mouthwash. If you had dental work done during COVID, your dentist or hygienist probably asked you to rinse your mouth carefully with something that had phenol in it. Phenol is a six-carbon ring, a benzene ring, with an OH group attached to one carbon. It is not easy to draw quickly or accurately - except in Latex.** |
- | \chemfig{HO-[: | + | \chemfig{H_3C-[: |
+ | |||
+ | Cela pourrait être simplifié comme je l’ai fait pour l’éthanol. Je vous laisse le soin de le faire. | ||
+ | |||
+ | Un acide légèrement plus grand est l’acide butanoïque avec quatre carbones. Il est commun dans certains fromages. Son odeur peut rappeller également celle de la sueur. | ||
+ | |||
+ | \chemfig{H_3C-[: | ||
+ | |||
+ | Ou dans la forme structurelle classique : | ||
+ | |||
+ | \chemfig{-[: | ||
+ | |||
+ | Même pour moi, cet article commence à ressembler à une conférence en chimie organique. Donc, je vous donne un seul et bref exemple de plus. Le phénol est un produit chimique utilisé dans de nombreux désinfectants et nettoyants. Il fait également partie de la formule pour une célèbre marque de rince-bouche. Si vous avez subi des soins dentaires pendant la pandémie de COVID-19, votre dentiste ou votre hygiéniste vous a probablement demandé de vous rincer la bouche soigneusement avec un produit contenant du phénol. Le phénol est un anneau de six carbones, un anneau de benzène, avec un groupe de OH attaché à un carbone. Il n’est pas facile de le dessiner rapidement ou avec précision - sauf avec LaTeX. | ||
+ | |||
+ | **< | ||
I hope this article has convinced you of the flexibility and adaptability of Latex. To call it a typesetting system implies it was designed for text. It is very useful for many other kinds of information than just text. I think of Latex as document production software. Granted it does not have the fancy, cluttered GUI that word processors have. However Latex is far more flexible and uses far fewer computer resources than word processors. | I hope this article has convinced you of the flexibility and adaptability of Latex. To call it a typesetting system implies it was designed for text. It is very useful for many other kinds of information than just text. I think of Latex as document production software. Granted it does not have the fancy, cluttered GUI that word processors have. However Latex is far more flexible and uses far fewer computer resources than word processors. | ||
Ligne 57: | Ligne 109: | ||
The chemfig package relies on the tikz package for drawing. The tikz package is automatically called whenever chemfig is used. There is no need to set up a usepackage for tikz, you can if you wish, but it is not necessary. Both chemfig and tikz are part of a standard Latex install in Linux. | The chemfig package relies on the tikz package for drawing. The tikz package is automatically called whenever chemfig is used. There is no need to set up a usepackage for tikz, you can if you wish, but it is not necessary. Both chemfig and tikz are part of a standard Latex install in Linux. | ||
- | Next time, I will return to processing text and start a project to make a cookbook. Now I have to figure out how to get all these chemical structures into LibreOffice so I can submit this article to the FCM editing team. | + | Next time, I will return to processing text and start a project to make a cookbook. Now I have to figure out how to get all these chemical structures into LibreOffice so I can submit this article to the FCM editing team.** |
+ | |||
+ | < | ||
+ | |||
+ | J’espère que cet article vous a convaincu de la flexibilité et de l’adaptabilité de LaTeX. L’appeler un système de composition implique qu’il a été conçu pour le texte. Il est très utile pour beaucoup d’autres types d’informations que du texte. Je pense à LaTeX comme logiciel de production de documents. Certes, il n’a pas l' | ||
+ | |||
+ | Le paquet chemfig s’appuie sur le paquet tikz pour le dessin. Le paquet tikz est automatiquement appelé chaque fois que chemfig est utilisé. Il n’est pas nécessaire de configurer un usepackage pour tikz ; vous le pouvez si vous le souhaitez, mais ce n’est pas nécessaire. Chemfig et tikz font partie d’une installation standard de LaTeX sous Linux. | ||
+ | |||
+ | La prochaine fois, je reprendrai le traitement du texte et commencerai un projet pour faire un livre de recettes culinaires. Maintenant, je dois trouver comment mettre toutes ces structures chimiques dans LibreOffice afin que je puisse soumettre cet article à l’équipe d’édition du FCM. |
issue193/latex.1685339290.txt.gz · Dernière modification : 2023/05/29 07:48 de d52fr