Chemistry Add-In For Word User Guide
Chemistry Add-In For Word User Guide
User’s Guide
Version 1.0 – January 28, 2011
Abstract
This document describes how to use the Chemistry Add-in for Word, an add-in for
Microsoft Word that provides a simple and flexible way to include chemical
information in a Word document.
Note:
Most resources discussed in this paper are provided with the Chemistry Add-
in package. For a complete list of documents and software discussed, see
“Resources” at the end of this document.
For Chemistry Add-in updates and software availability news, see
http://chem4word.codeplex.com or
http://research.microsoft.com/chem4word/
For general news and discussion about the Chemistry Add-in for Word, please
join our FaceBook page at
http://www.facebook.com/home.php?sk=group_186300551397797
Disclaimer: This document is provided “as-is”. Information and views expressed in this document, including
URL and other Internet Web site references, may change without notice. You bear the risk of using it.
This document does not provide you with any legal rights to any intellectual property in any Microsoft
product. You may copy and use this document for your internal, reference purposes.
Microsoft and Windows are trademarks of the Microsoft group of companies. All other trademarks are
property of their respective owners.
Chemistry Add-in for Word
User’s Guide - 2
Contents
Introduction...................................................................................................................3
Getting Started..............................................................................................................4
Prerequisites.............................................................................................................4
System Requirements...............................................................................................4
Installation.................................................................................................................4
UI Overview...................................................................................................................5
How to Create and Manage Chemistry Zones...............................................................6
Specify a Chemistry Zone’s Representation..............................................................7
Change a Zone’s Labels.............................................................................................8
Insert a Zone from the Chemistry Gallery.................................................................9
Insert a Chemistry Zone from the Web...................................................................10
Manage the Zones in the Chemistry Gallery............................................................11
How to Manage Chemistry Zones with the Chemistry Navigator................................11
How to Edit 2-D Structures..........................................................................................13
The Controls of the 2-D Editor.................................................................................14
Select Atoms for Editing..........................................................................................15
Edit Individual Atoms..............................................................................................16
Delete Selection..................................................................................................17
Change Atom Type..............................................................................................17
Set Label/Remove Label......................................................................................19
+e/-e....................................................................................................................19
Undo/Redo..........................................................................................................19
+H+/-H+................................................................................................................19
+H●/-H●................................................................................................................19
Set Isotope/Remove Isotope...............................................................................19
Change the Bonding................................................................................................19
Modify the Diagram’s Structure..............................................................................20
Flip the Diagram..................................................................................................20
Move Atoms or Groups.......................................................................................20
Rotate Atoms or Groups.....................................................................................21
Delete Atoms or Groups......................................................................................22
Resources....................................................................................................................23
Appendix 1: CML Basics...............................................................................................24
CML Data Storage....................................................................................................24
Appemdix 2: How CML Data is Stored in a Document.................................................25
Introduction
The Chemistry Add-in provides a simple and flexible way to include chemical
information in a Word document.
With the Chemistry Add-in, you can:
Create inline "chemistry zones" to represent chemical data.
Chemistry zones are controls that contain information about a molecule and
display the information in a variety of ways. The underlying data is stored as
Chemical Markup Language (CML), a widely used XML schema for representing
chemical data. The data typically includes trivial and International Union of Pure
and Applied Chemistry (IUPAC) names, the concise formula, and data for a 2-D
structure.
Display chemical information in a variety of ways.
A chemistry zone can display any representation that is supported by the
underlying CML data. With a few clicks, you can switch from the molecule’s trivial
name to its concise formula to its 2-D representation.
Display print-quality 2-D chemical structures.
Chemistry zones can represent molecules by displaying a 2-D structure diagram.
The Chemistry Add-in also includes an editor that enables you to modify the
structure. The diagram is inserted into the document as a PNG image, so that
others can view it, whether or not they have installed the Chemistry Add-in on
their system. You can also publish a document authored using the Chemistry Add-
in as a PDF file.
Accept chemical data in a variety of formats.
You can create a “chemistry zone” by typing a simple common name such as
“water”, and then using the Chemistry Add-in to convert it to your preferred
representation.
Import CML files from online web services
Using the Load From option in the ribbon, you can look up existing molecular
structures from the NCBI’s PubChem (http://pubchem.ncbi.nlm.nih.gov/) or the
Unilever Centre’s OPSIN (http://opsin.ch.cam.ac.uk/) databases.
Handle most molecules.
The Chemistry Add-in can handle any molecule that has appropriate CML data.
The Chemistry Add-in includes CML data for several hundred common molecules.
For additional molecules, you simply create or obtain a CML file and import it into
a document.
Store and expose chemical information in a semantically rich manner.
The Chemistry Add-in supports publishing and data-mining scenarios for authors,
readers, publishers, and other vendors across the chemical information
community.
This paper describes how to use the Chemistry Add-in to include chemical
information in a Word document.
Getting Started
This section describes how to get started with the Chemistry Add-in.
Prerequisites
You should have a basic understanding of:
Microsoft Word
Chemical nomenclature and diagrams
An understanding of CML is helpful but not required.
System Requirements
Hardware Requirements
Any computer that can run Office 2007 or Office 2010.
Software Requirements
Your computer must have the following software:
Any version of Windows that can run Office 2007 or Office 2010, which
includes Windows XP SP3 and later versions of Windows.
Word 2007 or Word 2010
For details on Office requirements, see the Resources section at the end of this
document.
Installation
The Chemistry Add-in is packaged in a file named ChemistryAddinforWordv1.zip that
contains the following files:
Setup.exe
Chem4Word.Setup.msi
Tip: The rest of the document will be easier to follow if you first install the Chemistry
Add-in.
UI Overview
The Chemistry tab contains the primary user interface for the Chemistry Add-in, as
shown in Figure 2.
1. Select the word or phrase that you want to include in the zone and right-click it.
2. Click the Mark as Chemistry button and the corresponding text on the fly-out
menu to create a chemistry zone for the selected text, as shown in Figure 3.
If you hover over a chemistry zone, Word highlights it. If you click the highlighted
text, Word displays the zone UI, with a Chemistry label to identify it as a chemistry
zone. Unlike Math equation zones, the chemistry zone UI does not display a
dropdown menu. It simply indicates the zone’s type and extent.
Each chemistry zone is based on CML data that is included in the document. Marking
text as a chemistry zone automatically creates a CML data file which only contains the
selected text as a chemical name of unknown type.
The Chemistry Add-in enables you to add or remove labels (if they are not being used
in the document), or modify their properties.
To add a label
1. Click New Label, which displays an empty label field below the last label on the
current list.
2. Type the new label’s name in the empty box.
3. Select the label type from the Choose label type dropdown to the right of the
name. A label can have one of the types shown in Figure 6.
4. Click OK to add the new label to the zone’s CML.
You can remove labels or modify their properties.
To remove a label, click the X at the label’s right edge.
To modify a label’s text, click the text box and edit the text.
To change the label type, select a new type from the dropdown.
When you are finished, click OK to accept the changes.
The changes apply only to the selected zone’s CML data—which is stored in the
document—and to any linked zones. It does not change the CML file used to create
the zone. If you use the procedure in the preceding section to create a new water
zone, it will have a default set of labels. Linked zones are discussed later in this paper.
4. Type in you search term, and click the magnifying glass icon
5. Select the desired search result from the list, and click Import.
To add a zone
1. Open the Chemistry Gallery and right click a zone to display the Chemistry
Gallery popup.
2. Click Organize and Delete to display the Building Blocks Organizer dialog box.
3. Use the dialog box to modify the zone order, or delete zones.
The Chemistry Gallery zones are in the Custom 5 gallery.
The items are represented in the panel by the preferred navigator depiction, followed
by the 2-D representation where possible.
There are two zone types:
Unlinked zones: independent entities that have their own CML data.
You can change an unlinked zone’s representation or modify its labels or 2-D
structure without affecting any other zone, even those that represent the same
molecule.
Linked zones: a collection of zones that are based on the same stored CML
data.
If, for example, you change a particular linked zone’s representation or modify its
2-D structure, you also change every other zone in the collection.
You can use Chemistry Navigator to insert linked or unlinked zones by using the
buttons to the right of the appropriate concise formula, as shown in the second
instance of C6H6 in Figure 8.
Note: You must create the first instance of a linked zone by using the techniques
discussed earlier in this paper. Then you can use Chemistry Navigator to insert
additional instances.
When you click OK to close the editor, the zone’s CML data is updated and the new
diagram is displayed in the zone, as well as in any linked zones.
Important: When you modify a molecule, you will be prompted to delete and/or
modify the labels. You may also use Edit Labels to assign new labels to the modified
molecule.
The diagram shown in the document is a PNG image, which is generated from the
CML data and inserted into the document. Others can thus read documents authored
using the Chemistry Add-in, even with earlier versions of Word such as Word 2003. If
you view a chemistry document with a version of Word that lacks the Chemistry Add-
in, Word simply displays the image and ignores the embedded CML data.
The editor supports two approaches to selecting multiple atoms in one operation,
marquee-select and gesture.
To use marquee-select
1. Position the cursor just outside the “corner” of the group of atoms that you want
to select.
This approach selects all the atoms within a rectangle. This step defines one
corner of the rectangle.
2. Click and hold the left button and drag the cursor so that the rectangle includes
the atoms that belong in the group.
Marquee-select is based on the positions of the atoms themselves, not the
associated labels.
3. Release the left button.
The atoms in the group are indicated by closed blue circles, as shown in Figure 11.
The Rotate and Flip commands are disabled, because they apply only to groups of
atoms.
To edit the selected atom’s properties, click the appropriate command, which
typically displays a popup from which you can select alternatives. The remainder of
this section discusses how to use the various commands to edit the properties of an
atom.
Important: The 2-D editor attempts to provide guidance on the available chemically
valid alternatives, but it does not enforce that guidance. For example, the Set Isotope
popup lists likely isotope numbers for oxygen, but you can still choose to set the
isotope number to 42.
Delete Selection
Delete Selection removes the atom from the diagram, and attempts to remove
dependent atoms as well. For example, if you delete the highlighted O atom in Figure
13, the editor also deletes the associated H atom. Deleting any atom will also break
all the bonds to this atom. The resultant unfilled valencies will be filled by adding the
correct number of hydrogen atoms except where this would cause H 2 to be created.
The first part of the list shows individual atom substitutions and the second a selected
set of groups that can replace oxygen in the current chemical environment in a
chemically sensible way.The editor adds or removes attached H atoms as required.
However, you can insert any atom by clicking More. This item displays a periodic
table—shown in Figure 15—from which you can select any atom by clicking it.
+e/-e
These two commands add or remove electrons from an atom, and display the new
state to the upper right of the atom’s label.
Undo/Redo
These commands undo or redo your changes, beginning with the most recent.
+H+/-H+
These commands add or remove a proton from the selected atom.
+H●/-H●
These commands add or remove a hydrogen atom from the selected atom.
5. Use the Select bond stereo dropdown to specify the stereo chemistry about an
atom.
Figure 17 shows the upper right part of the testosterone molecule after a double
bond has been added into the right-most ring. Notice that the editor removed two
hydrogen atoms, to compensate.
atoms or groups of atoms. For example, when you replace an atom with a group of
atoms, you can end up with a crowded or even overlapping diagram.
To modify the structure, select the atom or group of atoms that you want to move,
and drag it to the new location. The editor will adjust the bonds accordingly. The left
side of figure 19 shows the diagram after adding a COCl group.
When you make this change, the oxygen atom ends up directly on top of a hydrogen
atom. One way to make the diagram more readable is to move COCl group. The
situation is complicated somewhat by the overlapping O and H atoms, which makes it
difficult to select just the COCl group. The following procedure shows one way to
address the problem and the resulting diagram is on the right side of Figure 19.
To move Cl and O
1. Select the COCl group by gesturing along the bond connecting the group to the
ring.
Using a gesture enables you to select the COCl group, without including the H
atom.
2. Drag the COCl group to a better location.
To rotate a group
Resources
This section provides links to additional information about the Chemistry Add-in.
2007 Microsoft Office system requirements
http://office.microsoft.com/en-us/products/HA101668651033.aspx
2010 Microsoft Office system requirements
http://technet.microsoft.com/en-us/library/ee624351(office.14).aspx
cml.sourceforge.net - OpenSource Site for CML
http://cml.sourceforge.net/
Ecma Office Open XML File Formats overview
http://office.microsoft.com/en-us/products/HA102058151033.aspx
ISO Standard
http://www.iso.org/iso/iso_catalogue.htm
Open XML Formats
http://www.openxmldeveloper.org
JUMBO FAQ
http://www.ch.ic.ac.uk/omf/cml/doc/jumbo/faq.html
Office Development with Visual Studio Developer Center
http://msdn.microsoft.com/en-us/vsto/default.aspx
PubChem
http://pubchem.ncbi.nlm.nih.gov/
The Chemistry Add-in Smart Tag folder contains CML data for several
hundred common molecules.
To simplify chemistry zone creation, many molecules are represented by smart
tags, as discussed in the next section. The associated data for each molecule is in
a .cml file in the add-in’s Smart Tag folder, which is typically c:\Program
Files\Chem4Word\Smart Tag.
The Chemistry Gallery is a Word gallery that contains a collection of
chemistry zones.
The gallery typically enables users to quickly find and insert a zone into a
document. It usually contains a small collection of commonly used molecules and
users can customize the collection, as appropriate. The Chemistry Gallery has its
own backing data; a set of .cml files in the add-in’s c:\Program
Files\Chem4Word\data folder.
When a user inserts a chemistry zone into a document, the associated CML
data is stored in the document.
Some commands modify the embedded CML data in various ways, such as adding
trivial names or modifying the 2-D structure. However, these commands affect
only the data that is stored in the document.
The document is primarily a collection of XML files. Figure 3 shows the Word folder,
which contains the document’s primary files. In particular, document.xml contains
the body of the document in Office Open XML (OOXML) format. For more
information on OOXML, see “Ecma Office Open XML File Formats overview.”
Chemistry zones are represented in document.xml by a structured document element
(<w:sdt>). The Chemistry Add-in identifies the associated XML block as a chemistry
zone by setting the alias element's val attribute to “chemistry”. The following
example shows the chemistry zone XML for benzene:
<w:sdt>
<w:sdtPr>
<w:alias w:val="chemistry"/>
<w:id w:val="23589811"/>
<w:placeholder>
<w:docPart w:val="DefaultPlaceholder_22675703"/>
</w:placeholder>
</w:sdtPr>
<w:sdtContent>
<m:oMath>
<m:r>
<m:rPr>
<m:sty m:val="p"/>
</m:rPr>
<w:rPr>
<w:rFonts w:ascii="MS ChemSans" w:hAnsi="MS ChemSans "/>
</w:rPr>
<m:t>benzene</m:t>
</m:r>
</m:oMath>
</w:sdtContent>
</w:sdt>
The zone’s CML data is stored separately, in the document’s customXml folder. The
zone’s id element links the zone to the associated CML data file. Figure 5 shows a
portion of the Chem4Word_Example’s customXml folder. The itemN.xml files contain
various types of custom XML data, including the CML data. The numbering scheme is
not related to the contents of the file. For this example, the benzene CML data is in
item8.xml.
The benzene chemistry zone was created with a smart tag, so item8.xml contains the
CML-formatted data from benzene’s CML file in the Smart Tag folder, 241.cml.
<cml xmlns="http://www.xml-cml.org/schema"
xmlns:nameDict="http://www.xml-cml.org/dictionary/cml/name/"
xmlns:cmlDict="http://www.xml-cml.org/dictionary/cml/"
xmlns:conventions="http://www.xml-cml.org/convention/"
convention="conventions:molecular">
<molecule id="m1" formalCharge="0" spinMultiplicity="1">
<name dictRef="nameDict:iupac">benzene</name>
<name dictRef="nameDict:trivial">Phenyl hydride</name>
<formula concise="C 6 H 6"/>
<atomArray>