# Tag Info

31

Seeing as there are no good repositories for Mathematica stylesheets and packages, I created a github account for the community. The account resides at github/stackmma. I know there's library.wolfram.com, but we should be independent of WRI. On the topic of this question, I created a public stylesheets repository and I've added halirutan and jmlopez as ...

29

The colors used by the syntax highlighter can be set by changing the styles for StandardForm. The following is a how-to that explains how I styled the input cell in the screenshot in the question. This should be a starting point to get your own custom highlighting scheme up and running. Note that you can also do the same by choosing the colours in ...

18

This is the sequence of commands that I use to create my CDFs. testCDF := DynamicModule[... some nice code] nb = CreateDocument[{testCDF} ,Visible -> False ,WindowTitle->"Export Test" ,WindowMargins->Automatic ,WindowSize->Automatic ,WindowElements->{"VerticalScrollBar","HorizontalScrollBar"} ...

15

In answering the question the underlying assumptions are that the parent stylesheet (myparent.nb) of private stylesheet for a notebook is not a built in stylesheet; and that the stylesheet has one or more custom styles that inherit from myparent.nb. ClearAll[stylesheetSetter]; stylesheetSetter[path_String] := Module[{child, childstyles, parent, nb, tmp, ...

14

Functions can be used in stylesheets but not defined as per: myColor = RGBColor[.5,.5,.5]; The reason you cannot, for example, enter Red in a stylesheet is because it is typically written in the underlying box code. By analogy you cannot choose show expression and replace RGBColor[1.,0.,0.] in the underlying expression with Red. But as @Mr.Wizard said ...

13

The style name is PrintUsage. It is defined in the stylesheet notebook Core.nb which you can find in the directory: $InstallationDirectory\SystemFiles\FrontEnd\StyleSheets It has the following settings: CellFrame -> {{0, 0}, {0, 3}} CellFrameColor -> RGBColor[1, 0.6000000000000001, 0] Background -> RGBColor[1, 0.993332, 0.899718] You ... 11 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 cell level, what's happening. First, a parent set of options is calculated at the notebook level and ... 11 You can do all this programmatically like so: SetOptions[EvaluationNotebook[], StyleDefinitions -> Notebook[{Cell[StyleData[StyleDefinitions -> "Default.nb"]], Cell[StyleData["MyStyle",StyleDefinitions -> StyleData["Text"]], Background->RGBColor[1,0,0]]},Saveable -> True, StyleDefinitions -> "PrivateStylesheetFormatting.nb"] ... 10 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 FWIW here are some styles I use when collaborating -- i.e. I am doing the programming but others are commenting on outcomes and providing feedback: The basic cell style is: Cell[StyleData["Mike", StyleDefinitions -> StyleData["Text"]], CellFrame->{{4, 0}, {0, 0}}, CellMargins->{{66, 10}, {7, 7}}, CellFrameLabels->{{ PaneBox[ ... 9 As @R.M. explained, the styling rules are stored in the AutoStyleOptions setting. There is already a built-in editor for the code highlighting style, that can be accessed through Edit -> Preferences... -> Apperance -> Syntax Coloring. This changes the styles globally though. My suggestion is to first edit the global styling (because the built-in ... 9 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 ... 8 You cannot save to Default.nb by default, because it has Savable set to False and it is a good idea to not forcibly modify this file. Instead, create a private stylesheet as you have done here and put it in$UserBaseDirectory/SystemFiles/FrontEnd/StyleSheets/. You can now use this with any notebook. See this answer of mine for an idea of which tokens to ...

8

As rm -rf wrote the looks of the printout are by default determined by the Printout style definitions in the stylesheet, and you could try to change those. However, if you don't feel like that, you could also try to change the printing environment from "Printout" to "Working", so that it uses the changes you already made for your screen layout. You can do ...

8

This is my suggestion: use CurrentValue and TaggingRules in this way: 1) Create a notebook in the stylesheet lookup path, say "myStyleParameters.nb", where you'll store your parameters. Add a cell such as Cell[StyleData["Notebook"], TaggingRules->{"color"->GrayLevel[0.5], "height"->222}]; 2) Open your custom stylesheet, say "myStyle.nb", then go ...

8

What is happening here is that when you print (or make a PDF) the default printing style has the sytnax colouring switched off. You can see this by editing your stylesheet then clicking on "default.nb" and then when that notebook opens clicking on "Core.nb" and have a look at the printout style: So when you highlight some input and save as PDF, or Export ...

8

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 ...

7

I'm not sure from your question if you need the docked cell to be an image. I cannot see why you would unless you already have a rendered image, and that is not what you show. Here is what I use: myCell = Cell[ "Title Goes Here", "DockedCell", CellFrameColor -> RGBColor[0.996109, 0.500008, 0], Background -> GrayLevel[0.750011], CellFrame ...

7

A style sheet is nothing more than a specific sequence of Mathematica Cell and StyleData expressions. An excerpt looks like this: Cell[StyleData["SmallText", "Presentation"], CellMargins->{{60, 10}, {9, 9}}, LineSpacing->{1, 5}, FontSize->18] Cell[StyleData["SmallText", "Condensed"], CellMargins->{{8, 10}, {5, 5}}, LineSpacing->{1, 2}, ...

7

You might work around the limitations of CellFrame by framing the content. Framed allows for a RoundingRadius. CellPrint[ Framed[TextCell[ StringTake[ ExampleData[{"Text", "AliceInWonderland"}], {200, 1000}], "Text", CellMargins -> {{100, 50}, {5, 5}}], RoundingRadius -> 15, FrameStyle -> Red]]

6

You can adjust page size, page number style, headers, footers, etc from items under File -> Printing Settings menu. Or you can programmatically modify them by manipulating Notebook's options: PrintingCopies, PrintingStartingPageNumber, PrintingPageRange, PageHeaderLines, PageFooterLines, PrintingOptions. Note: It seems "PaperSize" and "PrintingMargins" ...

6

I liked that stylesheet (Creative > Natural Color) as well. They're still present for backward compatibility, but are not listed in the Format menu anymore. You should still be able to browse to them using Stylesheet > Other... or by modifying an existing notebook that uses the stylesheet.

6

If applying a new stylesheet doesn't change the appearance then it looks like the styling is local to each cell. If you have a look at the underlying expression of some of these input cells by going to the menu and choosing Cell > Show Expression you should see some StyleBoxes, as per this example using your code that you have supplied: So if it is the ...

6

I don't think this is possible. One can set the four sides of the cell frame to various different styles using the undocumented option CellFrameStyle which you have to prefix with the System context to get it to work (syntax coloring won't recognize it as a valid option): CellPrint[ TextCell[ StringTake[ExampleData[{"Text", "AliceInWonderland"}], {200, ...

6

sample image you want to use as background: image = Import["ExampleData/lena.tif"]; Create cell that you need to put in style definition: Cell[StyleData["Notebook"], SystemBackgroundAppearance -> image] // CellPrint Open stylesheet editor (Format -> Edit StyleSheet...) Copy the cell you just created and install stylesheet.

5

The Text style uses FontFamily->"Times". Your fonts are almost certainly set to have the same family name as the built-in font that Mathematica normally uses, and leaves the system with two possible sets of fonts to choose from. Even though the internal font name being used is, e.g., Times-RomanSC, that's not the actual family name...that's the style ...

5

I believe it is like what @R.M said in the comments. And I agree with @Mr.Wizrd suggestion of using a meta-stylesheet. But in case you just want to do this in one stylesheet (eg. restrict in the private one), this is how I did: Open a new plain notebook "nb", in its private stylesheet, create three style like this: Cell[StyleData["color"], ...

5

This may not be a completely satisfying answer, but perhaps someone else can build upon it. I don't think Mathematica has the capability to put compositional conditions into the styles of cells, to check "what's around them". What you could do instead is to set InputOnly to be your default style, and include a costum CellEvaluationFunction that switches ...

5

Open up the Options Inspector (Format menu) Select Global Preferences in the first pull-down menu Search for "DefaultStyle..." When "DefaultStyleDefinitions" appears under the Global Options/File Locations, click on the wrench/hammer icon Select "NaturalColor.nb" in the "Creative" folder in the StyleSheets folder. (For reasons I don't understand, you ...

5

To my knowledge just removing the stylesheet file should be enough. The places where Mathematica looks for stylesheets can be extracted using CurrentValue CurrentValue["StyleSheetPath"] (* {FrontEndFileName[{$UserBaseDirectory,Autoload,_,FrontEnd,StyleSheets}], FrontEndFileName[{$UserBaseDirectory,Applications,_,FrontEnd,StyleSheets}], ...

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