I am using Grid to document a demo I have. i.e. I am writing the documentation of the demo as a help option, which will display information when clicked on.
Everything is working well. I am using the following pattern to do that:
help=Block[{a,b,c,.....}, (*Block is needed to prevent $nnn in symbols showing*)
Style[TraditionalForm[Grid[{
{"some text here, all in string"},
{equation here using symbols a,b,c, as in a=b+c},
...
]], FontFamily -> "Times"]
]
Then later on, when I want to display information, I simply display the help symbol. The nice thing also about this, is that I typeset these all once, in the initialization section. So that it is fast to display before as the help is typeset once and stored in the symbol.
The final result is really nice. The same as Latex. I see no difference at all.
The only glitch, is when I have long text, I'd like it to be full justified. Using normal Grid Alignments does not help here, and so I have to use TextCell
, with the TextJustification->1
for it to work.
But the only problem is that some of the text I have might include subscript, like this one example:
And you can see that the TextCell
does not like that one part (I understand also why it is not happy). I am trying to see if I can use TextCell
(as it seems the only way to have text justified in a grid) and at the same time use little bit of subscript and such in the string. If there is such a trick.
For the actual math part of the documentation, I can split the math from the text like I show above in the rest of the grid. But there are some parts, where I need to write all the text in one place, and use little bit of subscript and such in there. But also be able to text justify everything so it looks nice.
In a way, this is like I do in Latex, where the main equations go as centered form, and the description around them has very little math. I am trying to emulate this with the help of Grid.
If I do not use textCell, this is the result:
So it works now, but text is not justified inside the grid. It does not look as nice.
Here is the code, if someone wants to try something. I tried many things, but so far, no luck. below is small example, left many things out. I have to keep the ContentSize
fixed there since the overall size is fixed for display.
Manipulate[
Style[TraditionalForm[Grid[{
{"let \!\(\*SubscriptBox[\(u\), \(n\)]\) be the outward normal \
derivative on the boundary"}
}, Frame -> All]
], FontFamily -> "Times"],
ContentSize -> {300, 475}
]
I do not want to use GraphisGrid
and rasterize
things and such.
And this will be used for a demo that runs in CDF plugin, so the following symbols can't be used :
SetOptions
, ToExpression
, Symbol
, $Context
, SetAttribute
s, Clear
, Unprotect
, DownValues
, UpValues
, OwnValues
and packages not allowed to be used or created also. Also, Manipulate[]
has to be the most outside construct.
Thank you,
Note: TextJustification -> 1
does alignment on BOTH ends. Using LineIndent->0 only does it on one side. Below is an example of the difference.
Grid
. – Mike Honeychurch Jan 31 '12 at 7:04