3
$\begingroup$

I write my own stylesheet. I use GridBox and GridBoxOption to edit the environment of EquationNumbered, in which, I set

Cell[StyleData["EquationNumbered"],
TextAlignment->Center,
FontSize->14,
GridBoxOptions->{AllowScriptLevelChange->False,
GridBoxAlignment->{
  "Columns" -> {{"\[AlignmentMarker]"}}, 
"Rows" -> {{"\[AlignmentMarker]"}}}}]

Now, when I choose the style of EquationNumbered, the multi-line formula will align to the alignmentmarker that I set.
But,when I do not set the alignmentmarker, they will aligned to the right instead of the center as usual. How can I fix this problem.
Without AlignmentMarker

$\endgroup$
1
  • $\begingroup$ Want to know the solution too. But I suspect it's just not possible... (Or maybe there is a undocumented usage to specify the priorities of alignments?) $\endgroup$
    – Silvia
    Commented Nov 22, 2014 at 9:15

1 Answer 1

1
$\begingroup$

Extended comment.

1 You need to show the Grid/Matrix so we can see what you are trying to do.

2 If you want to align to the right you do not need to use alignment markers (hence point #1).

3 There is this example in the docs:

Grid[{{1.234, 12.34}, {123.4, 1234.}, {1234, 1.234}},Alignment -> "."]

where you would obviously replace "." with alignment marker

4 An alternative to programmatic generation of alignments is simply to create your grid/matrix and insert alignment markers Esc am Esc, then Format > Text Alignment > On Alignment Marker. e.g

Cell[TextData[Cell[BoxData[{
 FormBox[
  RowBox[{"x", "=", "\[AlignmentMarker]", "y"}], TraditionalForm], "\[IndentingNewLine]", 
 FormBox[
  RowBox[{
   RowBox[{"x", "+", "7"}], "=", "\[AlignmentMarker]", 
   RowBox[{"z", "-", "1234567"}]}], TraditionalForm]}],
 TextAlignment->AlignmentMarker,
 FormatType->"TraditionalForm"]], "Text"]

enter image description here

$\endgroup$
3
  • $\begingroup$ Thanks. I know everything you suggest. But my problem is that how can set the GridBoxAlignment in GridBoxOptions so that the grid elements shall align to the center when I do not set any alignmentmarker while align to the marker when I set it explicitly. Thank you. $\endgroup$
    – AchillesJJ
    Commented Nov 21, 2014 at 6:28
  • $\begingroup$ I'm searching for answer to the same thing. @AchillesJJ $\endgroup$
    – B flat
    Commented Sep 26, 2015 at 11:13
  • $\begingroup$ A workaround is to set the stylesheet to center and then create a shortcut to override it at the cell level using a shortcut key. This can be done with celleventactions. $\endgroup$
    – B flat
    Commented Apr 4, 2022 at 17:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.