Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re:Re: Re: Courier New Button, selecting cells without brackets

  • To: mathgroup at smc.vnet.net
  • Subject: [mg51008] Re:[mg50979] Re: [mg50728] Re: Courier New Button, selecting cells without brackets
  • From: "Ingolf Dahl" <ingolf.dahl at telia.com>
  • Date: Fri, 1 Oct 2004 04:48:59 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

I submitted yesterday a palette changing face and font inside a Notebook:

A slight correction to this mailing: The Bold button was not working
properly, since a ",Null" had been added by mistake in the code.

To get the palette, execute the command below. Select the resulting cell,
Use "Generate Palette from Selection" in the File menu. Find your
$BaseDirectory or $UserBaseDirectory. Create a subdirectory
Applications\Palettes\FrontEnd\Palettes there. Close the generated palette
and save it to the file SetFaceAndFont.nb. Then this palette will be
available beneath "Palettes" in the File menu the next time you start
Mathematica.

You might also download the palette directly from
http://w1.318.telia.com/~u31815170/Mathematica/SetFaceAndFont.nb. Save it in
the way described above.

Suggestions to improve this palette are welcome.
Have Fun!

Ingolf Dahl
Sweden

Mathematica code follows:

NotebookWrite[InputNotebook[],
  Cell[BoxData[{ButtonBox[RowBox[{"Copy", " ", "As", " ", "InputForm"}],
          ButtonFunction :>
            Module[{cpy, cpynb, evalnb},
              CompoundExpression[Set[cpy, NotebookRead[InputNotebook[]]],
                If[SameQ[cpy, {}], Return[]],
                Set[cpynb, NotebookCreate[Visible -> False]],
                NotebookWrite[cpynb, cpy],
                SelectionMove[cpynb, All, Notebook],
                FrontEndExecute[{FrontEndToken[cpynb, "SelectionConvert",
                      "InputForm"]}],
                Set[evalnb,
                  NotebookPut[
                    Notebook[
                      Map[Cell[#, "Input"] &, {BoxData[
                            RowBox[{"cpynb", "=", ToBoxes[cpynb]}]],
                          "FrontEndExecute[{FrontEndToken[cpynb, \
\"CopySpecial\",\"PlainText\"]}]", "NotebookClose[cpynb]",
                          "NotebookClose[EvaluationNotebook[]]"}],
                      Visible -> False]]],
                SelectionMove[evalnb, All, Notebook],
                SelectionEvaluate[evalnb], Null]],
          ButtonEvaluator -> Automatic, Active -> True], "\n",
        RowBox[{StyleBox[
              ButtonBox["Plain",
                ButtonFunction :>
                  SetOptions[NotebookSelection[InputNotebook[]],
                    FontSlant -> "Plain", FontWeight -> "Plain",
                    FontVariations -> {"Underline" -> False}],
                ButtonEvaluator -> Automatic, Active -> True],
              FontFamily -> "Courier", FontSlant -> "Plain"],
            StyleBox[
              ButtonBox["Bold",
                ButtonFunction :>
                  SetOptions[NotebookSelection[InputNotebook[]],
                    FontWeight -> "Bold"], ButtonEvaluator ->
Automatic,
                 Active -> True], FontWeight -> "Bold"],
            StyleBox[
              ButtonBox["Italic",
                ButtonFunction :>
                  SetOptions[NotebookSelection[InputNotebook[]],
                    FontSlant -> "Italic"], ButtonEvaluator -> Automatic,
                Active -> True], FontFamily -> "Courier",
              FontSlant -> "Italic"],
            StyleBox[
              ButtonBox["Underline",
                ButtonFunction :>
                  SetOptions[NotebookSelection[InputNotebook[]],
                    FontVariations -> {"Underline" -> True}],
                ButtonEvaluator -> Automatic, Active -> True],
              FontFamily -> "Courier",
              FontVariations -> {"Underline" -> True}]}], "\n",
        RowBox[{ButtonBox[RowBox[{"Courier", " ", "Plain"}],
              ButtonFunction :>
                SetOptions[NotebookSelection[InputNotebook[]],
                  FontSlant -> "Plain", FontFamily -> "Courier"],
              ButtonEvaluator -> Automatic, Active -> True],
            StyleBox[
              ButtonBox[RowBox[{"Times", " ", "Plain"}],
                ButtonFunction :>
                  SetOptions[NotebookSelection[InputNotebook[]],
                    FontSlant -> "Plain", FontFamily -> "Times"],
                ButtonEvaluator -> Automatic, Active -> True],
              FontFamily -> "Times",
              FontVariations -> {"CompatibilityType" -> 0}],
            StyleBox[
              ButtonBox[RowBox[{"Times", " ", "Italic"}],
                ButtonFunction :>
                  SetOptions[NotebookSelection[InputNotebook[]],
                    FontSlant -> "Italic", FontFamily -> "Times"],
                ButtonEvaluator -> Automatic, Active -> True],
              FontFamily -> "Times", FontSlant -> "Italic"]}]}],
    NotebookDefault, PageBreakAbove -> True, FontFamily -> "Courier",
    FontSlant -> "Plain"]]

End of Mathematica code

>
>Ingolf Dahl wrote:
>>
>> I am trying to write some Help pages, and there I need to be
>able to change
>> some words to the font "Courier New" (Regular) or to "Times New Roman"
>> (Italic). Now I use "Choose Font" under Format, but since I have
>many fonts
>> installed, it is a bit cumbersome. Is there any key sequence
>available, or
>> has anyone a convenient button for these tasks?
>> Another question: In the help files, often there are no cell
>brackets. How
>> can I choose a whole cell without cell brackets? I can choose "Show
>> Expression" beneath Format, and edit the style, but there should be some
>> simpler way.
>>
>> Ingolf Dahl
>> Sweden
>



  • Prev by Date: Re: Simulating random fields in Mathematica
  • Next by Date: Re: Simulating random fields in Mathematica
  • Previous by thread: Re: Courier New Button, selecting cells without brackets
  • Next by thread: Re: Re: Re: Courier New Button, selecting cells without brackets