# Tag Info

19

[Edit: I updated this question to fix a couple of mistakes and to reflect the behavior in 10.3. -jf] The question I'll answer here is "How is the cell style of a given cell resolved." There are several other questions one could ask about option resolution, and I won't attempt to answer all of them here, but I will show in some exhaustive detail, at the ...

13

Add the following option to your CreateDocument call: StyleDefinitions -> CurrentValue[EvaluationNotebook[], StyleDefinitions] This works for both embedded stylesheets and stylesheets on the StyleSheetPath. In this case, I use EvaluationNotebook to refer to the notebook containing the button but it could, of course, be whatever NotebookObject you ...

13

This required editing the cell expression (Ctrl+Shift+E, or Cmd+Shift+E on Mac), but it's exactly what you're looking for: Cell[StyleData["childstylename", StyleDefinitions-> StyleData["parentstylename"]], opts...] To do this, your stylesheet has to either contain the parent style or inherit from another stylesheet which contains the parent style. ...

9

The only solution I've found is to set empty Tagging rules first: CurrentValue[EvaluationNotebook[], TaggingRules] = {}; CurrentValue[ EvaluationNotebook[], {TaggingRules, "InputFieldState"}] = "initial string"; Which is fine enough for my purposes but this is ok only if the notebook was just created or you know that there aren't any TaggingRules. The ...

9

Cell[TextData["string"]] is completely equivalent to Cell["string"]. There's no reason to expect the two to behave differently. TextData is a required wrapper when the contents are more complex than a string, but when it's a string, it changes nothing. And TextData cells have only a single way of determining the format type...from the FormatType option. ...

8

Update I must have read fontstyle instead of fontsize in your question. Therefore, the approach below shows how to use the complete style of Section with the frame of Program. To achieve what you want, just create a new style and copy any style properties (e.g. FontSize and CellFrame) from any existing style with the method I explain below. Sidenote: To ...

7

The FE always opens the stylesheet named in the DefaultStyleDefinitions option at the global level. In certain failsafe cases, it will fall back to this stylesheet if style definitions can't be found anywhere else. The one case I know for certain(*) where this happens is if the FE followed a stylesheet chain all the way to the end looking for stylename, ...

6

TLDR: The point of this answer is that we can move styles merging from stylesheet to the expression/boxes level. But sill have all definitions kept in the stylesheet. My last conclusions are that what I was after was not meant to work and an example with plain Inherited was a coincidence. We can create main styles and complementary styles. So the main is: ...

6

As Compatibility/tutorial/Utilities/FilterOptions says: The functionality of FilterOptions is provided by the kernel function FilterRules. Although the syntax is not identical. You have to change two things in the code: BeginPackage["RiemannSum", {"UtilitiesFilterOptions"}] to BeginPackage["RiemannSum"] And Begin["Private"] to Begin["...

6

How about this: ClearAll[framed, button, $opts];$opts = {}; Options[framed] = {a -> 1}; button[x_] := With[{opts = $opts}, Button[x, Print@framed[x, opts]]]; framed[x_, opts : OptionsPattern[]] := Block[{$opts = Flatten[{opts}]}, Framed[{button[x], OptionValue@a}] ]; and you use this as before: Print@framed["Push", a -> 1111] ...

6

Something like CellPrint[Cell["text", FontColor -> CurrentValue[{StyleDefinitions, "Section", "FontColor"}], FontFamily -> CurrentValue[{StyleDefinitions, "Section", "FontFamily"}], FontSize -> CurrentValue[{StyleDefinitions, "Section", "FontSize"}] , CellFrame ->CurrentValue[{StyleDefinitions, "Program", "CellFrame"}], ...

5

A solution for the issue at hand Based on your comments I believe you are looking for ScriptLevel itself: expr2 = "\!$$\*FractionBox[\(\[Alpha]$$,$$360 \[Degree]$$]\)"; expr2 = Style[expr2, Bold, 30, ScriptLevel -> 0]; Grid[{{#, Column[{#}]}}] & @ expr2 For application at the Grid/Column level one can use ItemStyle: {#, Grid[{{#, Column[{#}, ...

5

According to the Documentation, DefaultStyleDefinitions is a global option that specifies the default stylesheet for all new notebooks. By spelunking Export with GeneralUtilitiesPrintDefinitionsLocal Needs["GeneralUtilities"] PrintDefinitionsLocal[Export] one can find that for general expr Export first converts it into a Notebook using System...

4

Palette is a notebook so if you want to use that style there you have to set a stylesheet for it which will contain that style. The solution is closely related to Inheriting Stylesheets when using CreateDocument but not as straightforward since your private stylesheet inherits from Default.nb while a palette should from Palette.nb. Let's replace it then: ...

4

Ok, after taking a look at Core.nb stylesheet it is clear what happens. What's there is a Notebook setting of ShowStringCharacters->True and ShowStringCharacters->False are included only in styles that need it to be False, like an Output. Input just inherits from the Notebook. By evaluating ExpressionCell[ Defer @ Style["string", Red], "Input"] we ...

4

A copy of John Fultz's comments posted June 26, 2015 preserved for enduring reference: The multiple inheritance problem is not to be dismissed. Styles can be "re-rooted" (effectively told to ignore inheritance) by using StyleData[name, StyleDefinitions->None]. So, let's assume you have multiple stylesheets which inherit from Core.nb. Each one ...

3

As noted by ilian, this behaviour is explained in StoringAndTrackingPaletteStates tutorial. Shortly, CurrentValue[$FrontEnd, SystemPalettesMenuSettings] keeps those values cached. In order to achieve what I described in the question we have to drop an entry that coresponds to our palette. It doesn't really matter when it's done. Just do it before you ... 3 In this particular case it seems to be inheriting its font characteristics from TextForm because of FormatType->TextForm in its style definition. CellPrint[Cell["integrate x", "WolframAlphaLong"]] SetOptions[EvaluationNotebook[], StyleDefinitions -> Notebook[{ Cell[StyleData[StyleDefinitions -> "Default.nb"]], Cell[StyleData["Input"], ... 3 You may think the following is a cheat, but it accomplishes what you ask for. I tested the code with V10.3 on OS X 10.10.2. With[{size = 24}, CreateDocument[{ Cell[StyleData[StyleDefinitions -> "Default.nb"]], Cell[StyleData["myStyle1"], Background -> LightBlue, FontSize -> size], Cell[StyleData["myStyle2", StyleDefinitions -> ... 3 ScriptMinSize behaves well with respect to inheritance, so one work-around is to add it: {#, Grid[{{#, Column[{#}, BaseStyle -> {ScriptMinSize -> 30}]}}]} & @ expr It is still not the same and still inconvenient but sufficient for my purposes. 3 So I think this resolves at the CurrentValue[$FrontEndSession, DefaultStyleDefinitions] level as can be seen by first finding the notebook object that tracks these styles and inserting your definition there: defaultStylingNotebook = First@ Select[ FrontEndExecute@FrontEndObjectChildren@$FrontEnd, (WindowTitle /. AbsoluteOptions[#, WindowTitle])... 3 Intro It is not an isolated problem, similar limitation affects e.g. Button's Appearance. And it is internally considered a minor bug, read more in comments to that answer: Evaluation leak from Dynamic in Button's action Solution Summing up, I don't think there is an easy way. You either have to modify built-in GridDumpGridToBoxes definitions or you ... 3 I failed to find a duplicate so here it is: StyleData["DisplayFormulaNumbered"] is not environment specific so e.g. StyleData["DisplayFormulaNumbered", "Working"] will take precedence over your settings. My guess is this is what happens as there is always a default stylesheet inherited (87184). So the way to fix is to specify your style changes for all ... 2 Your syntax is off. You need StyleData[ "SubsectionNumbered","Working", StyleDefinitions -> StyleData["Subsection"] ] not StyleData[ "SubsectionNumbered", StyleDefinitions -> StyleData["Subsection"], "Working" ] which made "Working" being ignored and specific styles for Subsection + Working took precedence. 2 While delving in the clutter which Trace[<<MyPackage, TraceInternal -> True] returned to me, I have spotted three symbols which seem to be involved in the question. The first one is PacletManagerManagerPrivate$pathMap, which stores an Association between contexts and Paclets to load. The second one is PacletManagerManagerPrivate`getPathMap....

2

Updating the style definition cascade after in-memory modification of a stylesheet using SetOptions I've found that simple (and invalid) FrontEndExecute@ExportPacket[] doesn't work for this purpose but a valid ExportPacket works: FrontEndExecute@ExportPacket[Notebook[{Cell[""]}], "BoundingBox"]; // AbsoluteTiming {0.0135368, Null} (instead of "...

1

Warning: this answer is about updating the default style definitions after changing CurrentValue[\$FrontEndSession, DefaultStyleDefinitions] as shown here. About updating the style cascade after in-memory modification of a stylesheet using SetOptions see another answer in this thread. One simple way to force updating of the style definitions is to invoke ...

1

So I discovered the problem is just fundamentally that I'm an idiot. The issue wasn't that the notebook wasn't visible. It's that "ToggleShowExpression" was being called on the wrong notebook. For completeness here's how I'm doing it: StylesheetApplyEdits[cells : {__CellObject}] := With[{e = EvaluationCell[]}, Do[ SelectionMove[c, All, Cell, ...

1

Bug introduced in 10.4 and fixed in 11.0.1 [...] This GridGraph behavior does appear to be a regression in Mathematica 10.4 from earlier versions. As such I will file a report with the appropriate developers so that they may investigate the issue to be fixed in a future release. [...]

Only top voted, non community-wiki answers of a minimum length are eligible