Re: Question about FormatType Styles
- To: mathgroup@smc.vnet.net
- Subject: [mg10330] Re: [mg10322] Question about FormatType Styles
- From: John Fultz <jfultz@wolfram.com>
- Date: Thu, 8 Jan 1998 23:40:53 -0500
> What is the purpose of FormatType styles? > > When I type stuff in, the cell has style "Input". But the FormatType > style "InputForm" overrides the style settings for the style "Input". > > What is the point of this? I looked in the option inspector, and the > FormatType cannot be removed. So it appears that the style settings > for "Input" never do anything. I find this style stuff exceedingly > complex. Far more complex than any mathematics I have ever seen. Yes, it is complicated, but it's not completely nonsensical. In order to understand why there's a separate FormatType style, I have to lay a bit of background. I'm afraid this email's going to be long, so I hope you'll bear with me. First, it's not clear to me whether you know what a format type is. Just in case you don't, I'll explain it. A format type is basically a a set of rules that describes how mathematical expressions will look. For example, TraditionalForm uses 'sin(x)', whereas the others use 'Sin[x]'. InputForm uses '1/2', whereas OutputForm uses 1 (new line) - (new line) 2, and Standard and TraditionalForms typeset the fraction. Each form has a certain visual identity along with the associated rules, and thus slightly different styles. So, your statement about removing the FormatType doesn't really make sense, as there must always be some set of rules for how to display mathematical input/output for Input/Output/etc. styles. Next, we need to to understand that your statement about "style settings for Input never doing anything" is not correct. Try changing the text color of the Input style to green. Voilah...your input turns green. Now, try changing the font of the Input style (this is probably what you've been trying). Doesn't seem to work. The problem here is that the InputForm style has an explicit font setting. However, the InputForm style has no explicit color setting, so it inherits the color setting from the Input style. You can tell whether a cell has an explicit setting for something by clicking anywhere in the cell and choosing Format->Show Expression to see the cell contents. Use this menu option again to restore the cell the way it was before. Incidentally, the TraditionalForm style has no explicit font setting, so in fact, any font change you made to the Input style shows up in TraditionalForm input cells. Format Type styles can inherit from styles other than Input...for example, Output, Message, and Print styles. Yes, the mechanism could have been implemented by having separate Input-TraditionalForm, Output-TraditionalForm, Input-StandardForm, Output-StandardForm, etc. cell styles, but the proliferation of unique, one-shot styles would probably be more confusing than the inheritance method we're using now. Another question you might be wondering (as I did when I first learned this mechanism) is why doesn't the Input cell style have an explicit font family setting? Why set to Courier in the StandardForm and InputForm styles instead? The answer has to do with inline cells. Just like format type styles inherit from cell styles, an inline cell inherits style settings from its surrounding cells. Try pasting the following cell expressions with inline mathematical expressions into a notebook front end: Cell[TextData[{ "Theorem 1: ", Cell[BoxData[ FormBox[ RowBox[{ RowBox[{ SuperscriptBox["x", "2"], " ", "+", " ", SuperscriptBox["y", "2"]}], " ", "\[Equal]", " ", SuperscriptBox["z", "2"]}], TraditionalForm]]] }], "Text"] Now change the entire cell's cell style to Title, or Section. You'll notice that the inline cell changes as well. As I said earlier, the different format types have a certain visual identity that we've attached to them. TraditionalForm's identity uses proportional fonts...in inline cells, it uses the same font the surroung text uses by default. StandardForm and InputForm, though, are identified with monospaced fonts (specifically Courier). So, if you create an inline StandardForm cell, the StandardForm style overrides the inherited cell style's font and chooses Courier instead. For example: Cell[TextData[{ "Theorem 1: ", Cell[BoxData[ RowBox[{ RowBox[{ SuperscriptBox["x", "2"], "+", SuperscriptBox["y", "2"]}], "==", SuperscriptBox["z", "2"]}]], ImageMargins->{{0, 0}, {0, 0}}] }], "Text"] So, given that for inline cells, we want TraditionalForm to have no explicit font setting, and we want StandardForm, et. al., to have a font setting of Courier, the choice to make StandardForm, et. al., styles to be explicitly Courier while not setting explicitly the Input cell style's font makes some sense. I hope this helps. > Christopher R. Carlen > crobc@epix.net <--- Reply here, please. carlenc@cs.moravian.edu > My OS is Linux v2 Sincerely, John Fultz jfultz@wolfram.com Front End Group Wolfram Research, Inc.