MathGroup Archive 2001

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

Search the Archive

Re: Aligning equal signs

  • To: mathgroup at smc.vnet.net
  • Subject: [mg31450] Re: Aligning equal signs
  • From: "Steve Luttrell" <luttrell at signal.qinetiq.com>
  • Date: Wed, 7 Nov 2001 05:29:11 -0500 (EST)
  • References: <9rqveb$jin$1@smc.vnet.net> <9s0gvs$n5s$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

I have found that using alignment markers is rather buggy. This can be
avoided by using boxes to align text. Also, boxes translate cleanly to TeX
and MathML, whereas alignment markers do not, so boxes appear to be the
"approved" way to do this sort of thing.

--
Steve Luttrell
QinetiQ
Malvern Technology Centre
UK

Here is the notebook that illustrates some bugs with alignment markers:

Notebook[{

Cell[CellGroupData[{
Cell["Trouble with Alignment Markers", "Title"],

Cell["\<\
Here are a couple of irritating bugs with alignment markers. These \
can be avoided by using boxes to align text. Also, boxes translate \
cleanly to MathML, whereas alignment markers do not, so boxes appear \
to be the \"approved\" way to do this sort of thing.\
\>", "Text"],

Cell[CellGroupData[{

Cell["Bug 1", "Section"],

Cell["Here are some equations that you want to align.", "Text"],

Cell[BoxData[{
    \(TraditionalForm\`E = m\ c\^2\), "\[IndentingNewLine]",
    \(TraditionalForm\`E\^2 = \(p\^2\) c\^2 + \(m\^2\)
          c\^4\)}], "NumberedEquation"],

Cell["\<\
Insert some alignment markers after the \"=\" signs (using \
\[AliasIndicator]am\[AliasIndicator]), and change the cells text \
alignment to \"On AlignmentMarker\".\
\>", "Text"],

Cell[BoxData[{
    \(TraditionalForm\`E = \[AlignmentMarker]m\ c\^2\), "\
\[IndentingNewLine]",
    \(TraditionalForm\`E\^2 = \[AlignmentMarker]\(p\^2\)
          c\^2 + \(m\^2\) c\^4\)}], "NumberedEquation",
  TextAlignment->AlignmentMarker],

Cell["The equation number has disappeared.", "Text",
  FontColor->RGBColor[1, 0, 0]]
}, Open  ]],

Cell[CellGroupData[{

Cell["Bug 2", "Section"],

Cell["\<\
Here are some more equations that you want to align (taken from one \
of my own papers).\
\>", "Text"],

Cell[BoxData[{
    FormBox[
      RowBox[{\(incoherent\ piece\), "=",
        RowBox[{"\[Integral]",
          RowBox[{
            StyleBox[
              RowBox[{"d",
                StyleBox["x",
                  FontWeight->"Bold"]}]], " ",
            RowBox[{"Pr", "(",
              StyleBox["x",
                FontWeight->"Bold",
                FontSlant->"Italic"], ")"}],
            RowBox[{\(\[Sum]\+\(y = 1\)\%M\),
              RowBox[{
                RowBox[{"Pr", "(",
                  RowBox[{"y", "|",
                    StyleBox["x",
                      FontWeight->"Bold"]}], ")"}],
                SuperscriptBox[
                  RowBox[{"\[LeftDoubleBracketingBar]",
                    RowBox[{
                      StyleBox["x",
                        FontWeight->"Bold"], "-",
                      RowBox[{
                        SuperscriptBox[
                          StyleBox["x",
                            FontWeight->"Bold"], "\[Prime]"], "(",
                        "y", ")"}]}], "\[RightDoubleBracketingBar]"}],
                   "2"]}]}]}]}]}],
      TraditionalForm], "\[IndentingNewLine]",
    FormBox[
      RowBox[{\(coherent\ piece\), "=",
        RowBox[{"\[Integral]",
          RowBox[{
            StyleBox[
              RowBox[{"d",
                StyleBox["x",
                  FontWeight->"Bold"]}]], " ",
            RowBox[{"Pr", "(",
              StyleBox["x",
                FontWeight->"Bold",
                FontSlant->"Italic"], ")"}],
            SuperscriptBox[
              RowBox[{"\[LeftDoubleBracketingBar]",
                RowBox[{
                  StyleBox["x",
                    FontWeight->"Bold"], "-",
                  RowBox[{\(\[Sum]\+\(y = 1\)\%M\),
                    RowBox[{
                      RowBox[{"Pr", "(",
                        RowBox[{"y", "|",
                          StyleBox["x",
                            FontWeight->"Bold"]}], ")"}],
                      RowBox[{
                        SuperscriptBox[
                          StyleBox["x",
                            FontWeight->"Bold"], "\[Prime]"], "(",
                        "y", ")"}]}]}]}],
                "\[RightDoubleBracketingBar]"}], "2"]}]}]}],
      TraditionalForm]}], "NumberedEquation"],

Cell["\<\
Now insert alignment markers after the \"=\" signs (using \
\[AliasIndicator]am\[AliasIndicator]). Don't bother changing the \
cells text alignment to \"On AlignmentMarker\".\
\>", "Text"],

Cell[BoxData[{
    FormBox[
      RowBox[{\(incoherent\ piece\), "=", "\[AlignmentMarker]",
        RowBox[{"\[Integral]",
          RowBox[{"dx\:01ddam", " ",
            RowBox[{"Pr", "(",
              StyleBox["x",
                FontWeight->"Bold",
                FontSlant->"Italic"], ")"}],
            RowBox[{\(\[Sum]\+\(y = 1\)\%M\),
              RowBox[{
                RowBox[{"Pr", "(",
                  RowBox[{"y", "|",
                    StyleBox["x",
                      FontWeight->"Bold"]}], ")"}],
                SuperscriptBox[
                  RowBox[{"\[LeftDoubleBracketingBar]",
                    RowBox[{
                      StyleBox["x",
                        FontWeight->"Bold"], "-",
                      RowBox[{
                        SuperscriptBox[
                          StyleBox["x",
                            FontWeight->"Bold"], "\[Prime]"], "(",
                        "y", ")"}]}], "\[RightDoubleBracketingBar]"}],
                   "2"]}]}]}]}]}],
      TraditionalForm], "\[IndentingNewLine]",
    FormBox[
      RowBox[{\(coherent\ piece\), "=", "\[AlignmentMarker]",
        RowBox[{"\[Integral]",
          RowBox[{"dx", "\.00", " ",
            RowBox[{"Pr", "(",
              StyleBox["x",
                FontWeight->"Bold",
                FontSlant->"Italic"], ")"}],
            SuperscriptBox[
              RowBox[{"\[LeftDoubleBracketingBar]",
                RowBox[{
                  StyleBox["x",
                    FontWeight->"Bold"], "-",
                  RowBox[{\(\[Sum]\+\(y = 1\)\%M\),
                    RowBox[{
                      RowBox[{"Pr", "(",
                        RowBox[{"y", "|",
                          StyleBox["x",
                            FontWeight->"Bold"]}], ")"}],
                      RowBox[{
                        SuperscriptBox[
                          StyleBox["x",
                            FontWeight->"Bold"], "\[Prime]"], "(",
                        "y", ")"}]}]}]}],
                "\[RightDoubleBracketingBar]"}], "2"]}]}]}],
      TraditionalForm]}], "NumberedEquation"],

Cell["\<\
The characters immediately following the alignment markers have been \
damaged.\
\>", "Text",
  FontColor->RGBColor[1, 0, 0]]
}, Open  ]]
}, Open  ]]
},
FrontEndVersion->"4.1 for Microsoft Windows",
ScreenRectangle->{{0, 1024}, {0, 687}},
WindowSize->{722, 585},
WindowMargins->{{18, Automatic}, {Automatic, 23}},
Magnification->1.25,
StyleDefinitions -> "Report.nb"
]





  • Prev by Date: Re: Aligning equal signs
  • Next by Date: Re: ListContourPlot Color
  • Previous by thread: Re: Aligning equal signs
  • Next by thread: Re: weibull distribution