I would like to change a StyleSheet in such a way that any text that is typed into the inline cell (the one created by Ctrl+9) is shown in a different font (e.g. the font of my choice). At present I do not see, what definition should I change.
-
$\begingroup$ I have the impression that the code-related styles have a harder-coded font setting. There is some logic to this, as this style has to be able to display all kinds of mathematical symbols, usually not present in text fonts. It is easy to change the header fonts. The default.nb file says:"The cells in this section define styles used for input and output to the kernel. Be careful when modifying, renaming, or removing these styles, because the front end associates special meanings with these style names. Some attributes for these styles are actually set in FormatType Styles. " $\endgroup$– Sjoerd C. de VriesCommented Mar 26, 2012 at 21:37
2 Answers
Using the Option Inspector:
In the Format
menu choose Option Inspector
, select Cell Options > New Cell Defaults
and edit the value of the option DefaultNewInlineCellStyle
.
In the screenshot below, I changed the value of this option from {}
to "Subsection"
using the drop-down menu.
The first two cells on the left notebook show the inline cell styles before and after changing the value of the option in the Option Inspector
.
Using SetOptions
:
To change the for the new inline cells for the active notebook, use
SetOptions[EvaluationNotebook[], DefaultNewInlineCellStyle -> "Section"]
Example cell containing an inline cell:
For the style change to apply to all new inline cells in the current front-end session, use
SetOptions[$FrontEndSession, DefaultNewInlineCellStyle -> "Section"]
If you want to have the changes to persist across sessions, use
SetOptions[$FrontEnd, DefaultNewInlineCellStyle -> "Section"]
Finally, to reset any of the changes, use
SetOptions[xxx, DefaultNewInlineCellStyle -> Inherited]
where xxx
is EvaluationNotebook[]
, or $FrontEndSession
or $FrontEnd
.
Setting your own custom styles:
SetOptions[EvaluationNotebook[],
DefaultNewInlineCellStyle -> {FontFamily -> "SketchFlowPrint", FontSize -> 24}]
-
$\begingroup$ Thank you, that is, indeed, the possibility. However, my question is still valid: is it possible to change the StyleSheet in such a way that using this StyleSheet I never should think about fixing this style for each new notebook? It would be great, if such a possibility exists. $\endgroup$ Commented Mar 26, 2012 at 11:26
-
$\begingroup$ @A.Boulbitch, I agree that your question stands. I am hoping someone more comfortable with style sheets will come up with an answer. $\endgroup$– kglrCommented Mar 26, 2012 at 11:52
To do this via a StyleSheet add this to your stylesheet:
Cell[StyleData["InlineCell"],
TextAlignment->Left,
LanguageCategory->"Formula",
ScriptLevel->1,
StyleMenuListing->None,
FontFamily->"Helvetica",
FontSize->16]
Cell[StyleData["InlineCellEditing"],
StyleMenuListing->None,
Background->RGBColor[1,0,0]]
To create your stylesheet you could follow these steps if you prefer doing things programmatically:
Quickly editing the stylesheet and saving it
or if you prefer a more "standard" way of adding a stylesheet you could follow the steps outlined by @kguler in the comment below.
-
$\begingroup$ +1 @Mike, thank you! This works great. I had come across these two cells in
Core.nb
stylesheet but was afraid to edit that file:) It would be useful to add the steps to be followed: eg. selectEdit Stylesheet
from theFormat
menu; copy/paste the two cells separately intoStyle Definitions for Untitled-x.nb
; and then click theInstall Stylesheet
button etc $\endgroup$– kglrCommented Mar 27, 2012 at 1:17 -
1$\begingroup$ Never edit Core.nb. What you should do in all cases is add the relevant style to your specific stylesheet. The stylesheet will have a dependency on Default.nb which in turn uses Core.nb. $\endgroup$ Commented Mar 27, 2012 at 2:04
-
$\begingroup$ Thank you, that is exactly what I looked for. Alexei $\endgroup$ Commented Mar 27, 2012 at 9:10