Tag Info

Hot answers tagged

41

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


32

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


24

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


21

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


19

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


17

Mathematica still works with Courier by default. Nothing is broken about your copy of Mathematica. It is the case, however, that if you use any sans serif font (or at least any font that properly advertises itself as sans serif...many amateur font designers don't bother setting font metadata bits correctly), you'll see the new MathematicaSans font in use ...


15

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


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


13

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

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


11

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


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


11

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


11

I believe what you are asking for is solved by use of the All style. Adding this to the private style sheet: Cell[StyleData[All], FontFamily->"Trajan Pro" ] Results in: (Trajan Pro is a distinctive small caps font I had available.) As you can see the Input and Code styles are not affected, but those are affected by the "StandardForm" style, as ...


10

Check out the Mathematica Journal style-sheet. Just download an article and if you like what you see, you can just copy the style from the Style Description window that is brought up by choosing the "Format -> Edit Stylesheet" menu item.


10

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


10

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


10

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


10

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

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

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


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

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


9

Inspired by the posts on this thread, I've made a Solarized stylesheet after mucking around with the text options and asking stupid questions on here--thank you so much for those who made the time to answer them! I know you can change the syntax highlighting by running option-setting commands [1][2][3], but I'd rather have a stylesheet that takes care of all ...


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


8

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"] (* {FrontEnd`FileName[{$UserBaseDirectory,Autoload,_,FrontEnd,StyleSheets}], FrontEnd`FileName[{$UserBaseDirectory,Applications,_,FrontEnd,StyleSheets}], ...


8

Nothwithstanding the answer from Mr.Wizard and discussion with @R.M it seems like you want to make a stylesheet with a docked cell ...right? img = Plot[Sin[x^2], {x, -3, 3}, Axes -> False, AspectRatio -> 0.25, BaseStyle -> Directive[FontFamily -> "Helvetica", 9], Frame -> True, FrameLabel -> {{"x axis", None}, {"y axis", None}}, ...


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


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



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