Book Image

LaTeX Cookbook

By : Stefan Kottwitz
Book Image

LaTeX Cookbook

By: Stefan Kottwitz

Overview of this book

LaTeX is a high-quality typesetting software and is very popular, especially among scientists. Its programming language gives you full control over every aspect of your documents, no matter how complex they are. LaTeX's huge amount of customizable templates and supporting packages cover most aspects of writing with embedded typographic expertise. With this book you will learn to leverage the capabilities of the latest document classes and explore the functionalities of the newest packages. The book starts with examples of common document types. It provides you with samples for tuning text design, using fonts, embedding images, and creating legible tables. Common document parts such as the bibliography, glossary, and index are covered, with LaTeX's modern approach.You will learn how to create excellent graphics directly within LaTeX, including diagrams and plots quickly and easily. Finally, you will discover how to use the new engines XeTeX and LuaTeX for advanced programming and calculating with LaTeX. The example-driven approach of this book is sure to increase your productivity.
Table of Contents (19 chapters)
LaTeX Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Representing atoms


Now that we can draw molecules, how about digging deeper? Can we draw atoms? Sure!

How to do it...

We will use a package named after the famous physicist Niels Bohr. That's bohr.

  1. Start with a document class.

    \documentclass{article}
  2. Load the bohr package:

    \usepackage{bohr}
  3. Start the document:

    \begin{document}
  4. Use the command \bohr{number of electrons}{element name}, for Fluorine:

    \bohr{10}{F}
  5. We can modify the nucleus radius this way:

    \setbohr{nucleus-radius=1.5em}
  6. Now we have more space in the center for an ion symbol. This time we use the command with an optional argument for the number of electron shells since we need an empty one. We need to do that in square brackets. We will display a Sodium ion:

    \bohr[3]{10}{$\mathrm{Na^+}$}
  7. That's all for now! End the document:

    \end{document}
  8. Compile to see the result:

How it works...

It was quite simple. Nevertheless, I wanted to show you how easy it can be to write about science today.

After loading the package, we just needed this command:

\bohr...