SHARE
TWEET

Untitled

a guest Sep 22nd, 2017 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. > I am working in a notebook. I would like to be able to easily style and restyle code fragments in a text cell.
  2.  
  3.  1. Create a new notebook
  4.  2. Go to Format -> Edit Stylesheet...
  5.  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.
  6.  4. Select the InlineCode cell in the style window and press Command-Shift-E to reveal its cell expression.  It will be
  7.  
  8.         Cell[StyleData["InlineCode"],
  9.          MenuSortingValue->10000]
  10.  
  11.     Edit it to add styling, e.g.
  12.  
  13.         Cell[StyleData["InlineCode"],
  14.          FontFamily -> "Consolas",
  15.          FontColor -> RGBColor[0.2, 0.4, 0.8],
  16.          MenuSortingValue->10000]
  17.  
  18.     Press Command-Shift-E again to hide the cell expression, then close the style window.
  19.  
  20.  5. While the notebook is selected, go to Format -> Option Inspector, and select Selected Notebook under Scope.
  21.  6. Search for DefaultNewInlineCellStyle and set it to InlineCode, the style you just created.  This will cause new inline cells to have this style.
  22.  7. Additionally, under New Cell Defaults -> CommonDefaultFormatTypes, set `"TextInline"` to ????  
  23.  
  24.  
  25.   >>  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 <<
  26.  
  27.  
  28.  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).
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top