MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

More problems with symbolize.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg16572] More problems with symbolize.
  • From: "Nicolas B.E. Sawyer" <nbes at eee.nott.ac.uk>
  • Date: Wed, 17 Mar 1999 23:54:53 -0500
  • Organization: University of Nottingham
  • Sender: owner-wri-mathgroup at wolfram.com

With help from Reinhold Kainhofer, I've been able to get Symbolize to
work in packages. One thing that I discovered is that the palette
supplied with v3.0 is not up to the job, I had to install v3.0.1.

I've still got some problems though - symbols with subscripts and
superscripts. These are best seen by running the notebooks below (based
on one Reinhold sent me), one of which contains my package.

Putting the symbol definitions into the notebook works, except that
syntax errors occur if I save and reopen the notebook.

Using the package is less successful. I get these errors reported (and
similar syntax problems on saving):-

Cell[BoxData[
    RowBox[{
      RowBox[{"Set", "::", "\<\"write\"\>"}], 
      RowBox[{":", " "}], 
      "\<\"Tag \\!\\(Power\\) in \\!\\(d\\_n\\%\\\\[Lambda]\\) is \
Protected.\"\>"}]], "Message",
  ShowCellLabel->True]


Cell[BoxData[
    RowBox[{
      RowBox[{"Information", "::", "\<\"ssym\"\>"}], 
      RowBox[{":", " "}], 
      "\<\"\\!\\(f\\_n\\%\\(\\\\[Lambda]\\_1\\)\\) is not a symbol or a
\
string.\"\>"}]], "Message",
  ShowCellLabel->True]



--------------------------------------------------------------------------
The notebook
--------------------------------------------------------------------------

Notebook[{

Cell[CellGroupData[{
Cell["Either use the definitions in this Notebook", "Subtitle"],

Cell[CellGroupData[{

Cell["Definitions", "Section"],

Cell[BoxData[
    \(\(Needs["\<Utilities`Notation`\>"]; \)\)], "Input"],

Cell[BoxData[
    RowBox[{
      RowBox[{"Symbolize", "[", 
        TagBox[\(a\_n\),
          NotationBoxTag,
          Editable->True], "]"}], ";"}]], "Input"],

Cell[BoxData[
    RowBox[{
      RowBox[{"Symbolize", "[", 
        TagBox[\(c\^\[Lambda]\),
          NotationBoxTag,
          Editable->True], "]"}], ";", "\n", 
      RowBox[{"Symbolize", "[", 
        TagBox[\(d\_n\%\[Lambda]\),
          NotationBoxTag,
          Editable->True], "]"}], ";", "\n", 
      RowBox[{"Symbolize", "[", 
        TagBox[\(e\^\[Lambda]\_1\),
          NotationBoxTag,
          Editable->True], "]"}], ";", "\n", 
      RowBox[{"Symbolize", "[", 
        TagBox[\(f\_n\%\[Lambda]\_1\),
          NotationBoxTag,
          Editable->True], "]"}], ";"}]], "Input"],

Cell["Symbolize[NotationBoxTag[\\(b\\_n\\)]]; ", "Input"],

Cell[BoxData[
    \(\(an::usage\  = \ "\<Normal usage.\>"; \ \n
    \(a\_n\)::usage\  = \ "\<Subscript usage.\>"; \ \ \n
    \(b\_n\)::usage\  = \ "\<second Subscript usage.\>"; \ \ \)\)],
"Input"],

Cell[BoxData[
    \(\(c\^\[Lambda]\)::usage\  = \ "\<Superscript usage.\>"; \n
    \(d\_n\%\[Lambda]\)::usage\  = \ "\<Subscript and Superscript
usage.\>"; 
    \n\(e\^\[Lambda]\_1\)::usage\  = \ "\<Elaborate Superscript
usage.\>"; \n
    \(f\_n\%\[Lambda]\_1\)::usage\  = \ 
      "\<Subscript and elaborate Superscript usage.\>"; \)], "Input"],

Cell[BoxData[
    \(an = "\<Normal symbol\>"; \na\_n = "\<Subscript symbol\>"; \n
    b\_n = "\<another subscript symbol\>"; \)], "Input"],

Cell[BoxData[
    \(c\^\[Lambda]\  = \ "\<Superscript symbol.\>"; \n
    d\_n\%\[Lambda]\  = \ "\<Subscript and Superscript symbol.\>"; \n
    e\^\[Lambda]\_1\  = \ "\<Elaborate Superscript symbol.\>"; \n
    f\_n\%\[Lambda]\_1\  = \ 
      "\<Subscript and elaborate Superscript symbol.\>"; \)], "Input"]
}, Closed]],

Cell[CellGroupData[{

Cell["Test this Notebook", "Section"],

Cell[BoxData[
    \(\(?a\_n\)\)], "Input"],

Cell[BoxData[
    \(?? a\_n\)], "Input"],

Cell[BoxData[
    \(?? b\_n\)], "Input"],

Cell[BoxData[
    \(?? c\^\[Lambda]\)], "Input"],

Cell[BoxData[
    \(?? d\_n\%\[Lambda]\)], "Input"],

Cell[BoxData[
    \(?? e\^\[Lambda]\_1\)], "Input"],

Cell[BoxData[
    \(?? f\_n\%\[Lambda]\_1\)], "Input"],

Cell[BoxData[
    \(a\_n\)], "Input"],

Cell[BoxData[
    \(b\_n\)], "Input"],

Cell[BoxData[
    \(c\^\[Lambda]\)], "Input"],

Cell[BoxData[
    \(d\_n\%\[Lambda]\)], "Input"],

Cell[BoxData[
    \(e\^\[Lambda]\_1\)], "Input"],

Cell[BoxData[
    \(f\_n\%\[Lambda]\_1\)], "Input"]
}, Open  ]]
}, Open  ]],

Cell[CellGroupData[{

Cell["Or load the definitions from the package", "Subtitle"],

Cell[CellGroupData[{

Cell["Test the package", "Section"],

Cell[BoxData[
    \(\(\(Needs["\<haemoglobin`test`\>"]; 
    \) (*\ load\ the\ package\ wherever\ you\ put\ it ... \ \ *) \)\)], 
  "Input"],

Cell[BoxData[
    \(\(?a\_n\)\)], "Input"],

Cell[BoxData[
    \(?? a\_n\)], "Input"],

Cell[BoxData[
    \(?? b\_n\)], "Input"],

Cell[BoxData[
    \(?? c\^\[Lambda]\)], "Input"],

Cell[BoxData[
    \(?? d\_n\%\[Lambda]\)], "Input"],

Cell[BoxData[
    \(?? e\^\[Lambda]\_1\)], "Input"],

Cell[BoxData[
    \(?? f\_n\%\[Lambda]\_1\)], "Input"],

Cell[BoxData[
    \(a\_n\)], "Input"],

Cell[BoxData[
    \(b\_n\)], "Input"],

Cell[BoxData[
    \(c\^\[Lambda]\)], "Input"],

Cell[BoxData[
    \(d\_n\%\[Lambda]\)], "Input"],

Cell[BoxData[
    \(e\^\[Lambda]\_1\)], "Input"],

Cell[BoxData[
    \(f\_n\%\[Lambda]\_1\)], "Input"]
}, Open  ]]
}, Open  ]]
},
FrontEndVersion->"Microsoft Windows 3.0",
ScreenRectangle->{{0, 1024}, {0, 740}},
AutoGeneratedPackage->None,
WindowSize->{915, 465},
WindowMargins->{{10, Automatic}, {Automatic, 15}}
]



--------------------------------------------------------------------------
The package
--------------------------------------------------------------------------

Notebook[{

Cell[CellGroupData[{
Cell["The package definition", "Section"],

Cell["\<\
BeginPackage[\"haemoglobin`test`\",
  {\"Utilities`Notation`\"}]\
\>", "Input",
  InitializationCell->True],

Cell[TextData[{
  "When you use the palette to enter the Symbolize and Notation
commands, you \
can use ordinary typesetting (if a SubscriptBox, SuperscriptBox etc. is
\
included. If not, insert ",
  Cell[BoxData[
      \(TraditionalForm\`\( (*\ 1\^1*)  \)\)]],
  " to that cell to make ",
  StyleBox["Mathematica",
    FontSlant->"Italic"],
  " save the box structure to the package.). What I wrote in my mail is
the \
box structure that ",
  StyleBox["Mathematica",
    FontSlant->"Italic"],
  " writes to the package if you use ordinary typesetting in the FE."
}], "Text"],

Cell[BoxData[
    RowBox[{
      RowBox[{"Symbolize", "[", 
        TagBox[\(a\_n\),
          NotationBoxTag,
          Editable->True], "]"}], ";"}]], "Input",
  InitializationCell->True],

Cell[BoxData[
    RowBox[{
      RowBox[{"Symbolize", "[", 
        TagBox[\(c\^\[Lambda]\),
          NotationBoxTag,
          Editable->True], "]"}], ";", "\n", 
      RowBox[{"Symbolize", "[", 
        TagBox[\(d\_n\%\[Lambda]\),
          NotationBoxTag,
          Editable->True], "]"}], ";", "\n", 
      RowBox[{"Symbolize", "[", 
        TagBox[\(e\^\[Lambda]\_1\),
          NotationBoxTag,
          Editable->True], "]"}], ";", "\n", 
      RowBox[{"Symbolize", "[", 
        TagBox[\(f\_n\%\[Lambda]\_1\),
          NotationBoxTag,
          Editable->True], "]"}], ";"}]], "Input",
  InitializationCell->True],

Cell["\<\
You might also convert the cell to input form (note the NotationBoxTag
that \
is wrapped around the box structure. This is absolutely needed by the \
Notation package. The disadvantage of this is that it is very hard to
change \
the box structure so that it is still what you want it to be.\
\>", "Text"],

Cell["Symbolize[NotationBoxTag[\\(b\\_n\\)]]; ", "Input",
  InitializationCell->True],

Cell[BoxData[
    \(\(an::usage\  = \ "\<Normal usage.\>"; \ \n
    \(a\_n\)::usage\  = \ "\<Subscript usage.\>"; \ \ \n
    \(b\_n\)::usage\  = \ "\<second Subscript usage.\>"; \ \ \)\)],
"Input",
  InitializationCell->True],

Cell[BoxData[
    \(\(c\^\[Lambda]\)::usage\  = \ "\<Superscript usage.\>"; \n
    \(d\_n\%\[Lambda]\)::usage\  = \ "\<Subscript and Superscript
usage.\>"; 
    \n\(e\^\[Lambda]\_1\)::usage\  = \ "\<Elaborate Superscript
usage.\>"; \n
    \(f\_n\%\[Lambda]\_1\)::usage\  = \ 
      "\<Subscript and elaborate Superscript usage.\>"; \)], "Input",
  InitializationCell->True],

Cell[BoxData[
    \(\(Begin["\<`Private`\>"]; \)\)], "Input",
  InitializationCell->True],

Cell[BoxData[
    \(an = "\<Normal symbol\>"; \na\_n = "\<Subscript symbol\>"; \n
    b\_n = "\<another subscript symbol\>"; \)], "Input",
  InitializationCell->True],

Cell[BoxData[
    \(c\^\[Lambda]\  = \ "\<Superscript symbol.\>"; \n
    d\_n\%\[Lambda]\  = \ "\<Subscript and Superscript symbol.\>"; \n
    e\^\[Lambda]\_1\  = \ "\<Elaborate Superscript symbol.\>"; \n
    f\_n\%\[Lambda]\_1\  = \ 
      "\<Subscript and elaborate Superscript symbol.\>"; \)], "Input",
  InitializationCell->True],

Cell[BoxData[
    RowBox[{
      RowBox[{"Notation", "[", 
        RowBox[{
          TagBox[\(a_\[CirclePlus]b_\),
            NotationBoxTag,
            Editable->True], " ", "\[DoubleLongLeftRightArrow]", " ", 
          TagBox[\(cpl[a_, \ b_]\),
            NotationBoxTag,
            Editable->True]}], "]"}], " ", 
      \( (*\ in\ this\ case\ you\ have\ to\ insert\ something\ like\
1\^1\ 
          somewhere\ in\ the\ cell, \ preferrably\ inside\ a\ comment\
*) 
        \)}]], "Input",
  InitializationCell->True],

Cell["\<\
End[]
EndPackage[]\
\>", "Input",
  InitializationCell->True]
}, Open  ]],

Cell[CellGroupData[{

Cell["Test", "Section"],

Cell["Save this notebook and quit the kernel.", "Text"],

Cell[BoxData[
    \(\(<< haemoglobin`test` (*\ 
      load\ the\ package\ wherever\ you\ put\ it ... \ \ *) \)\)],
"Input"],

Cell[BoxData[
    \(\(?a\_n\)\)], "Input"],

Cell[BoxData[
    \(?? a\_n\)], "Input"],

Cell[BoxData[
    \(?? b\_n\)], "Input"],

Cell[BoxData[
    \(?? c\^\[Lambda]\)], "Input"],

Cell[BoxData[
    \(?? d\_n\%\[Lambda]\)], "Input"],

Cell[BoxData[
    \(?? e\^\[Lambda]\_1\)], "Input"],

Cell[BoxData[
    \(?? f\_n\%\[Lambda]\_1\)], "Input"],

Cell[BoxData[
    \(a\_n\)], "Input"],

Cell[BoxData[
    \(b\_n\)], "Input"],

Cell[BoxData[
    \(c\^\[Lambda]\)], "Input"],

Cell[BoxData[
    \(d\_n\%\[Lambda]\)], "Input"],

Cell[BoxData[
    \(e\^\[Lambda]\_1\)], "Input"],

Cell[BoxData[
    \(f\_n\%\[Lambda]\_1\)], "Input"]
}, Open  ]]
},
FrontEndVersion->"Microsoft Windows 3.0",
ScreenRectangle->{{0, 1024}, {0, 740}},
NotebookAutoSave->True,
AutoGeneratedPackage->Automatic,
WindowToolbars->"EditBar",
WindowSize->{626, 357},
WindowMargins->{{13, Automatic}, {Automatic, 12}},
Magnification->1,
StyleDefinitions -> "Default.nb"
]


-- 
Nicolas B.E. Sawyer


Department of Electrical and Electronic Engineering,
University of Nottingham,
University Park,
Nottingham,
NG7 2RD.

Tel: +44 115 9515151 ext 12028
Fax: +44 115 9515616

E-mail: nbes at eee.nottingham.ac.uk


  • Prev by Date: Re: An open letter
  • Next by Date: Re: An open letter
  • Previous by thread: Re: need a hand ordering functions
  • Next by thread: controlling the size of tick marks (was Re: help)