MathGroup Archive 2001

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

Search the Archive

Re: Printing in Boldface

  • To: mathgroup at smc.vnet.net
  • Subject: [mg29060] Re: Printing in Boldface
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Sat, 26 May 2001 21:53:55 -0400 (EDT)
  • References: <9ektfr$7vi@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

> wouldn't it be nice if one could write
> ....
>       PrintStyled[expr1, expr2, expr3, expr4, "style"]


Options[PrintStyled]= {PrintStyle->{}};

PrintStyled[expr___, (opts___)?OptionQ] :=
  Module[{stl},
    stl = PrintStyle /. Flatten[{opts}] /. Options[PrintStyled];
    stl = Flatten[{stl}, 1];
    Print @@ MapThread[StyleForm[#1, Sequence @@
         Flatten[{#2}]] & , {{expr},
         PadRight[stl, Length[{expr}], stl]}]
  ]

TESTS

PrintStyled[a, b, c, PrintStyle ->
   {{"Title"}, {FontSize -> 18, FontWeight -> "Bold"}}]

PrintStyled[a, b, c, PrintStyle ->
   {"Title", FontSize -> 18, FontWeight -> "Bold"}]

PrintStyled[a, b, c, PrintStyle -> FontSize -> 18]

SetOptions[PrintStyled, PrintStyle ->
    FontColor -> Hue[0]];

PrintStyled[a, b, c]

SetOptions[PrintStyled, {PrintStyle->{}};


--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

"aes" <siegman at stanford.edu> wrote in message
news:9ektfr$7vi at smc.vnet.net...
> Is there any way to set an option so I can have the output of
>
>       Print[expr1, expr2, expr3, expr4]
>
> be printed in boldface, different font size, etc, without having to use
> the (very klunky) StyleForm[ ] approach.
>
> To put this another way, wouldn't it be nice if one could write
>
>       StylePrint[expr1, expr2, expr3, expr4, "style"]
>
> or maybe
>
>       PrintStyled[expr1, expr2, expr3, expr4, "style"]
>
> and have the expr-k's strung together automatically in the way that
> Print[] does?
>






  • Prev by Date: Re: Plot[f[x], {x,a,b}] Not Reaching End Points
  • Next by Date: Re: Help tips.
  • Previous by thread: Printing in Boldface
  • Next by thread: Re: Printing in Boldface