Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- > I am working in a notebook. I would like to be able to easily style and restyle code fragments in a text cell.
- 1. Create a new notebook
- 2. Go to Format -> Edit Stylesheet...
- 3. In the text field at the top of the style window, enter InlineCode and press Enter. This creates the `InlineCode` style, and inserts a corresponding cell below.
- 4. Select the InlineCode cell in the style window and press Command-Shift-E to reveal its cell expression. It will be
- Cell[StyleData["InlineCode"],
- MenuSortingValue->10000]
- Edit it to add styling, e.g.
- Cell[StyleData["InlineCode"],
- FontFamily -> "Consolas",
- FontColor -> RGBColor[0.2, 0.4, 0.8],
- MenuSortingValue->10000]
- Press Command-Shift-E again to hide the cell expression, then close the style window.
- 5. While the notebook is selected, go to Format -> Option Inspector, and select Selected Notebook under Scope.
- 6. Search for DefaultNewInlineCellStyle and set it to InlineCode, the style you just created. This will cause new inline cells to have this style.
- 7. Additionally, under New Cell Defaults -> CommonDefaultFormatTypes, set `"TextInline"` to ????
- >> I don't know what to set this to so when typing things like std::map then it won't be automtically formatted as a Mathematica message <<
- 8. Now create a text cell in the notebook using Command-7, enter some text, then start an inline cell using Ctrl-(. You can exit the inline cell using Ctrl-). This new inline cell will have the InlineCode style, as you can verify by revealing the cell expression (Command-Shift-E).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement