Hot answers tagged

53

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


39

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


28

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


24

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


22

If you are skilled in particular code or packages then the switching costs (in time, possibly also money) to adopt a new software/package are usually prohibitive. In the context of typesetting, if you already are well versed in a typesetting software, e.g. LaTeX then I don't see any reason to attempt publication quality documents with Mathematica. So the ...


21

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


20

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


18

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


16

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


16

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


16

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


16

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


15

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.


14

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


14

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


14

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


14

I don't know how about you but I missed the fact it is built in since V 10. Go Format -> Stylesheet -> ReverseColor:


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

I created own dark theme for Mathematica. It looks like All stylesheets needed for that you can found here [repo]=https://github.com/dmarienko/Matlab/tree/master/.Mathematica You need to copy .nb files from repo [repo]/SystemFiles/FrontEnd/StyleSheets/ to your local Mathematica StyleSheets folder. After that you can choose stylesheet named as Dimad.nb (You ...


12

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


12

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


12

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


11

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


11

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

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


10

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


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


9

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


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

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



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