# Tag Info

33

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

31

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

21

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

18

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

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

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

12

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

12

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

12

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 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. ... 10 Typesetting in Text cells Cell[TextData[Cell[BoxData[ FormBox[ RowBox[{ FractionBox["1", "N"], RowBox[{ UnderoverscriptBox["\[Sum]", RowBox[{"i", "=", "1"}], "N"], FractionBox[ RowBox[{ SubsuperscriptBox[ OverscriptBox["x","~"], "j", "i"], "(", RowBox[{"k", "|", "k"}], ")"}], SqrtBox[ ... 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 ... 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 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 ...

9

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

9

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.

9

As Brett Champion says in his answer the NaturalColor stylesheet is still availble but hidden. If you want to use it on a regular basis, I suggest moving a copy of it to a folder where Mathematica will find and put it on the Format > Stylesheet menu. Mathematica can aid you in finding the stylesheet folders and the stylesheets themselves. The function ...

9

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

9

I have created a new style to implement this. The first screen grab is the finished product: Here is a pic with the underlying expression shown. Note the new style "DisplayFormulaNumberedPrimed": The new style was added to the private stylesheet for this notebook: The underlying box code for this style is: ...

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

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

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

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

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 need CurrentValue[{StyleDefinitions, stylename}] Examples: CurrentValue[{StyleDefinitions, "Section"}] CurrentValue[{StyleDefinitions, "Section", "CellFrame"}] (* {{0, 0}, {0, 1}} *) CurrentValue[{StyleDefinitions, "Subsection", "FontFamily"}] (* "Helvetica" *) CurrentValue[{StyleDefinitions, "Graphics", "CapForm"}] (* "Square" *) etc. ...

6

To specify the style of inline formula, there is a style called "InlineCell". Add the following to the stylesheet would do it: Cell[StyleData["InlineCell"], LanguageCategory->"Formula", FontFamily->"Arial"] Or specify the "TraditionalForm" style as Rojo said to make sure the font used in inline formula is consistent with it used in stand alone ...

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.

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