14
$\begingroup$

I'm writing an article, and I really like this style that you get when you type ?AnyFunction.

I want to achieve style like this

Is it possible to achieve this?

$\endgroup$
2
  • 1
    $\begingroup$ Are you looking for the tutorial/EnteringTwoDimensionalInput in the Mathematica Documentation? $\endgroup$ Apr 27, 2012 at 12:43
  • 1
    $\begingroup$ Or is it the yellow background and border/text styles that you like? $\endgroup$
    – Verbeia
    Apr 27, 2012 at 12:46

1 Answer 1

16
$\begingroup$

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 can use the OptionInspector to set DefaultNewCellStyle or DefaultReturnCreatedCellStyle to PrintUsage. You can also change these settings at the notebook, front-end session or front-end level using

SetOptions[xx,DefaultNewCellStyle->"PrintUsage"]

where xx is EvaluationNotebook[] or $FrontEndSession, or $DefaultFrontEnd.

A third alternative is to use the right-click context menu on a cell bracket,choose Style->Other and type PrintUsage in the dialog box to change the style of that cell.

One important issue with the above approach is that a cell with PrintUsage style is not editable. So, you may want to define your custom style using something like this answer by Mike Honeychurch:

SetOptions[EvaluationNotebook[], 
   StyleDefinitions -> 
   Notebook[{Cell[StyleData[StyleDefinitions -> "Default.nb"]], 
   Cell[StyleData["myPrintUsageStyle"], Editable -> True, Evaluatable -> True,
   CellFrame -> {{0, 0}, {0, 3}}, CellMargins -> {{66, 10}, {10, 5}},
   CellFrameColor -> RGBColor[1, 0.6000000000000001, 0], 
   Background -> RGBColor[1, 0.993332, 0.899718]]}, 
   Saveable -> True, StyleDefinitions -> "PrivateStylesheetFormatting.nb"]];

and use it in place of PrintUsage using any of the usage options mentioned above, e.g.,

SetOptions[EvaluationNotebook[],  DefaultNewCellStyle -> "myPrintUsageStyle"]
$\endgroup$
2
  • $\begingroup$ Thank you, you have totally answered my question. :) $\endgroup$
    – balboa
    Apr 27, 2012 at 16:17
  • $\begingroup$ @balboa, glad to know it worked for you. Thanks for the accept. $\endgroup$
    – kglr
    Apr 27, 2012 at 16:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.