Re: Chemical notation
- To: mathgroup@smc.vnet.net
- Subject: [mg12292] Re: Chemical notation
- From: "P.J. Hinton" <paulh@wolfram.com>
- Date: Thu, 7 May 1998 18:51:28 -0400
- Organization: Wolfram Research, Inc.
- References: <6imhlr$gv1@smc.vnet.net>
On 5 May 1998, Nicolas Martignoni wrote: > I would like to typeset a chemical element notation, with Z and A > numbers, like the following: > > 214 > Po > 84 > > Is there a way to do this in Mathematica 3.0.x ? This requires a little trickery. There is a SubsuperscriptBox construct that can align the atomic and mass numbers as you wish, but you have to use an empty string as the "anchor" for the sub and superscripts. Evaluating the following expression will demonstrate an example of how you might create this effect.: RowBox[{ RowBox[{ SubsuperscriptBox[""," 84", "214"]}], "Po"}] // DisplayForm Here is an example which uses the ChemicalFormula style inline within a Text cell. The ChemicalFormula contains some option settings which distinguish it from typical typeset math cells. Since this is an inline cell, it will use the setting for Default Inline Format Tyle under the Cell menu, which is TraditionalForm, meaning that the text will be set in whatever font is used by the style sheet for TraditionalForm (in this case -- Times). Cell[TextData[{ "The decay of the isotope ", Cell[BoxData[ FormBox[ RowBox[{ SubsuperscriptBox["", RowBox[{" ", "84"}], "214"], "Po"}], ChemicalFormula]]] }], "Text"] Try pasting this cell in a notebook which uses one of the following style sheets: ArticleClassic ArticleModern Classic Report Textbook TutorialBook When the front end asks you whether the cell expression should be interpreted, click "Yes." And as an added bonus, here is an expression that generates a button to speed the entry of the box: DisplayForm[ ButtonBox[StyleBox[RowBox[{SubsuperscriptBox["", "\[Placeholder]","\[Placeholder]"], "\[SelectionPlaceholder]"}],"ChemicalFormula"], Active\[Rule]True]] Paste the above in an Input cell and evaluate it to make the button. Here are the instructions for using the button. 1) Enter the element name "Po." 2) Select the element name text with your mouse. 3) Click on the button. 4) Enter the subscript number. 5) Hit the Tab key. 6) Enter the superscript number. 7) Hit Ctrl-Space twice to escape the math editor. 8) Continue typing the text. Hope that helps. -- P.J. Hinton Mathematica Programming Group paulh@wolfram.com Wolfram Research, Inc. http://www.wolfram.com/~paulh/ Disclaimer: Opinions expressed herein are those of the author alone.