Parent Directory
|
Revision Log
Revision 1 - (view) (download) (as text)
| 1 : | mark | 1 | \NeedsTeXFormat{LaTeX2e} |
| 2 : | \ProvidesPackage{shadethm}[1999/11/23] | ||
| 3 : | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
| 4 : | % ShadeThm.sty | ||
| 5 : | % Shaded theorem environments in LaTeX, with \newshadetheorem in addition to | ||
| 6 : | % \newtheorem. | ||
| 7 : | % | ||
| 8 : | % USAGE | ||
| 9 : | % Used as a LaTeX2e style, with \usepackage{shadethm}, it allows declarations | ||
| 10 : | % of the form \newshadetheorem{theorem}{Theorem}, so that | ||
| 11 : | % \begin{theorem} $e=mc^2$ \end{theorem} | ||
| 12 : | % will produce the usual theorem, only placed in a shaded box. | ||
| 13 : | % Options. Two come in this file: | ||
| 14 : | % bodymargin (default) The body of the shaded text lines up with the | ||
| 15 : | % margins. Just as though you called newtheorem, then colored later. | ||
| 16 : | % Shading falls outside the margin. | ||
| 17 : | % shademargin The shading lines up with the margins, so the body of | ||
| 18 : | % shaded text comes out a little thinner. | ||
| 19 : | % If you call it with an option not on that list then it will look for a | ||
| 20 : | % file <OptionName>.sth and take the parameters from there. See the included | ||
| 21 : | % files shadein.sth and colored.sth, the first of which gives theorems that are | ||
| 22 : | % (like LaTeX quotations) indented left and right and the second of which | ||
| 23 : | % gives color shading. | ||
| 24 : | % | ||
| 25 : | % REMARKS | ||
| 26 : | % (1) You can of course have non-shaded environments, also. The \newtheorem | ||
| 27 : | % command still works. | ||
| 28 : | % (2) Numbering within: An prior version of this style required that you | ||
| 29 : | % number within like this: | ||
| 30 : | % \newshadetheorem{thm}{Theorem} | ||
| 31 : | % \newshadetheorem{note}[shadethm]{Note} % No longer needed! | ||
| 32 : | % but this one drops that requirement. If you didn't use the old version, | ||
| 33 : | % forget about it. | ||
| 34 : | % (3) Uses the graphics package. Look for it in the CTAN TeX-archive nearest | ||
| 35 : | % you, for instance at tug.ctan.org. | ||
| 36 : | % (4) Works with amsthm.sty. | ||
| 37 : | % (5) Notice that if you say \newshadetheorem{theorem}{Theorem} and then | ||
| 38 : | % \newtheorem{theorem}{Theorem} then you will get an error message since | ||
| 39 : | % the first allows you to say \begin{theorem} ..., as does the second. | ||
| 40 : | % | ||
| 41 : | % INSTALLATION | ||
| 42 : | % Put this where your TeX looks for .sty files. | ||
| 43 : | % There are some parameters you could set the default for (try them as is, | ||
| 44 : | % first). | ||
| 45 : | % (i) shadethmcolor The shading color of the background. See the | ||
| 46 : | % documentation for the color package, but with a `gray' model, I find .97 | ||
| 47 : | % looks good out of my printer, while a darker shade like .92 is needed | ||
| 48 : | % to make it copy well. (Black is 0, white is 1.) | ||
| 49 : | % (i*) shaderulecolor The shading color of the border of the shaded box. | ||
| 50 : | % See (i). If \shadeboxrule is set to 0pt then this won't print anyway. | ||
| 51 : | % (i**) shadeboxrule The width of the border around the shading. Set it to | ||
| 52 : | % 0pt (not just 0) to make it disappear. | ||
| 53 : | % (i***) shadeboxsep The length by which the shade box surrounds the text. | ||
| 54 : | % (ii) shadesetinsideminipage The theorems are set inside a minipage to | ||
| 55 : | % get line breaks, but some things, like paragraph indents, are messed | ||
| 56 : | % with there, so I have a hook to reset them. Probably you can just | ||
| 57 : | % leave this alone. | ||
| 58 : | % (iii) The default option. Change the \ExecuteOptions{...} right before | ||
| 59 : | % the \ProcessOptions. | ||
| 60 : | % Comment: | ||
| 61 : | % If you get an error about `undefined color model' then you need to create | ||
| 62 : | % the file color.cfg in the same place as color.sty, and put in it the line | ||
| 63 : | % \ExecuteOptions{dvips} (or whatever is the name of your driver). See the | ||
| 64 : | % documentation for the graphics package. I needed this in the distant past | ||
| 65 : | % under NTeX. | ||
| 66 : | % | ||
| 67 : | % BUGS | ||
| 68 : | % (1) Page breaks are a problem since it sets the theorem before it is shaded. | ||
| 69 : | % The theorem is put into a minipage in order to have the right line breaks | ||
| 70 : | % put in, but then can't be broken across pages. I'd be interested in any | ||
| 71 : | % fixes for this. DA? | ||
| 72 : | % | ||
| 73 : | % LICENSE | ||
| 74 : | %% Copyright 1999 Jim Hefferon jim@joshua.smcvt.edu | ||
| 75 : | % This program can redistributed and/or modified under the terms | ||
| 76 : | % of the LaTeX Project Public License Distributed from CTAN | ||
| 77 : | % archives in directory macros/latex/base/lppl.txt; either | ||
| 78 : | % version 1 of the License, or (at your option) any later version. | ||
| 79 : | % | ||
| 80 : | % HISTORY | ||
| 81 : | % 99XI23 jh Redid the parsing to stick to \newcommand-style calls. Needed | ||
| 82 : | % to put in some oppresive \expandafter strings. | ||
| 83 : | % 99VII09 jh tex@joshua.smcvt.edu Fixed the number within situation. LPPL | ||
| 84 : | % added. | ||
| 85 : | % 97I07 jh Changed the interior of the \DeclareOptions to \AtBeginDocument | ||
| 86 : | % for cases where the \textwidth is changed. | ||
| 87 : | % 95VI19 jh Adapted for LaTeX2e. Now uses the graphics package, and all | ||
| 88 : | % the neat 2e package stuff. Still haven't rewritten the parsing code to | ||
| 89 : | % use the new optional arguments to \newcommand, though. Ah well. | ||
| 90 : | % 94VII11 jim hefferon hefferon@smcvax.smcvt.edu. First written (after lots | ||
| 91 : | % of sporadic tries, over months; I couldn't get any of the extant shading | ||
| 92 : | % macros to work with theorems) from a hint in TvZ's Fancybox writeup. | ||
| 93 : | % It's all so easy once you know how. | ||
| 94 : | % | ||
| 95 : | \DeclareOption{bodymargin}{ | ||
| 96 : | \AtEndOfPackage{% | ||
| 97 : | \setlength{\shadeboxsep}{0.1cm} | ||
| 98 : | \setlength{\shadeboxrule}{0pt} | ||
| 99 : | \setlength{\shadedtextwidth}{\textwidth} | ||
| 100 : | \setlength{\shadeleftshift}{-\shadeboxsep} | ||
| 101 : | \setlength{\shaderightshift}{-\shadeboxsep} | ||
| 102 : | \definecolor{shadethmcolor}{gray}{0.80} | ||
| 103 : | \definecolor{shaderulecolor}{gray}{0.80} | ||
| 104 : | } | ||
| 105 : | } | ||
| 106 : | \DeclareOption{shademargin}{ | ||
| 107 : | \AtEndOfPackage{% | ||
| 108 : | \setlength{\shadeboxsep}{2pt} | ||
| 109 : | \setlength{\shadeboxrule}{0pt} | ||
| 110 : | \setlength{\shadedtextwidth}{\textwidth} | ||
| 111 : | \addtolength{\shadedtextwidth}{-2\shadeboxsep} | ||
| 112 : | \setlength{\shadeleftshift}{0pt} | ||
| 113 : | \setlength{\shaderightshift}{0pt} | ||
| 114 : | \definecolor{shadethmcolor}{gray}{0.80} | ||
| 115 : | \definecolor{shaderulecolor}{gray}{0.80} | ||
| 116 : | } | ||
| 117 : | } | ||
| 118 : | \DeclareOption*{\InputIfFileExists{\CurrentOption.sth}{}{% | ||
| 119 : | \typeout{shadethm warning: option \CurrentOption\space not known.}}} | ||
| 120 : | |||
| 121 : | \ExecuteOptions{bodymargin} %default | ||
| 122 : | \ProcessOptions | ||
| 123 : | |||
| 124 : | \RequirePackage{color} | ||
| 125 : | |||
| 126 : | % Save the document paragraph indents so they can be reasserted inside the | ||
| 127 : | % minipage into which the theorems get put. | ||
| 128 : | \newlength{\saveparindent} %to have paragraphs default to their | ||
| 129 : | \setlength{\saveparindent}{\parindent} %usual indent inside the minipage | ||
| 130 : | \newcommand{\shadesetinsideminipage}{% %To reset this inside an option, | ||
| 131 : | \setlength{\parindent}{\saveparindent}} %or a document, \renewcommand{...} | ||
| 132 : | |||
| 133 : | % Declare the lengths we need. Set in the package options. | ||
| 134 : | % Here is a diagram: | ||
| 135 : | % text text text text text text text text text text text text | ||
| 136 : | % ------------------------------------------------------ | ||
| 137 : | % | Theorem. My bonnie lies over the ocean. My bonnie | | ||
| 138 : | % | lies over the sea. | | ||
| 139 : | % ------------------------------------------------------ | ||
| 140 : | % --->| |<---- --->| |<-- | ||
| 141 : | % \shadeleftshift \shadeboxsep | ||
| 142 : | % (all four sides) | ||
| 143 : | % | ||
| 144 : | % |<-------------- \shadetextwidth ---------------->| | ||
| 145 : | % | ||
| 146 : | \newlength{\shadeboxsep} %start of color to start of text; four sides | ||
| 147 : | \newlength{\shadeboxrule} %width of bordering rule | ||
| 148 : | \newlength{\shadedtextwidth} %width of the text body | ||
| 149 : | \newlength{\shadeleftshift} %margin to start of shading (may be negative) | ||
| 150 : | \newlength{\shaderightshift} %makes total line width come out (may be negative) | ||
| 151 : | |||
| 152 : | |||
| 153 : | % MAIN CODE | ||
| 154 : | % see LaTeXbook (second edition) pp 108 and 132 | ||
| 155 : | % (1) make a box \saveshadebox that will hold the text that is to be | ||
| 156 : | % typeset in the theorem. | ||
| 157 : | % (2) Read that material in with the lrbox environment. The material | ||
| 158 : | % is set in a minipage so the margins are controllable. | ||
| 159 : | % (3) Use that box, inside of an fcolorbox. | ||
| 160 : | % Notes | ||
| 161 : | % * lrbox is used instead of savebox because this is an environment. | ||
| 162 : | % * The fcolorbox is inside a trivlist because that makes the vertical | ||
| 163 : | % spacing come out right. I don't know how else to do it. | ||
| 164 : | % * The fcolorbox is left shifted by some length (which may be negative) and | ||
| 165 : | % then aftward, a right shift is put in. | ||
| 166 : | \newsavebox{\shadesavebox} % no `@'; users can redefine shadebox if they want | ||
| 167 : | \newenvironment{shadebox}% % shadow boxes or something. | ||
| 168 : | {\begin{lrbox}{\shadesavebox}\begin{minipage}{\shadedtextwidth}% | ||
| 169 : | \shadesetinsideminipage}% | ||
| 170 : | {\end{minipage}\end{lrbox}% | ||
| 171 : | \begin{trivlist}\item[]% In a trivlist because theorems are in trivlists. | ||
| 172 : | \setlength{\fboxsep}{\shadeboxsep}% | ||
| 173 : | \setlength{\fboxrule}{\shadeboxrule}% | ||
| 174 : | \mbox{\hspace{\shadeleftshift}\fcolorbox{shaderulecolor}{shadethmcolor}{\usebox{\shadesavebox}}\hspace{\shaderightshift}}% | ||
| 175 : | \end{trivlist}} | ||
| 176 : | |||
| 177 : | %PARSING CODE | ||
| 178 : | % The definition of \newshadetheorem is modelled on the one for \newtheorem | ||
| 179 : | % in latex.tex. | ||
| 180 : | % The invocation possibilities are: | ||
| 181 : | % \newshadetheorem{NAME}{TEXT}[COUNTER] | ||
| 182 : | % e.g., \newshadetheorem{theorem}{Theorem}[section] meaning to allow | ||
| 183 : | % one to say \begin{theorem} $e=mc^2$ \end{theorem} to produce | ||
| 184 : | % Theorem 1.1.1 e=mc2 | ||
| 185 : | % shaded and numbered by section. | ||
| 186 : | % \newshadetheorem{NAME}[OLDNAME]{TEXT} | ||
| 187 : | % e.g., \newshadetheorem{remark}[theorem]{Remark} meaning to allow | ||
| 188 : | % one to say \begin{remark} Obvious. \end{remark} to produce | ||
| 189 : | % Remark 1.1.2 Obvious. | ||
| 190 : | % shaded and numbered with the same counter used for theorems. | ||
| 191 : | % \newcommand parsing | ||
| 192 : | % In LaTeX2e, to call a macro with an optional argument, let the | ||
| 193 : | % optional's default value be given in a second set of []'s: | ||
| 194 : | % \newcommand{\mymac}[2][hello]{#2, ``#1''} will have | ||
| 195 : | % \mymac{I say} |---> I say ``hello'' | ||
| 196 : | % \mymac[goodbye]{You say} |---> You say ``goodbye'' | ||
| 197 : | % I want to use this to parse LaTeX's | ||
| 198 : | % \newtheorem{--env_name--}{--caption--}[--within--] | ||
| 199 : | % or \newtheorem{--env_name--}[--numbered_like--]{--caption--} | ||
| 200 : | % So | ||
| 201 : | % (1) \newshadetheorem{arg1} | ||
| 202 : | % arg1: the environment name (e.g. definition) | ||
| 203 : | % It ends by calling a macro \sth@getcaption with one mandatory argument and | ||
| 204 : | % one optional argument. | ||
| 205 : | % (2) \sth@getcaption[oparg1]{arg1} | ||
| 206 : | % arg1: the caption name (e.g. Definition) | ||
| 207 : | % oparg1: the numbered_like (e.g., theorem) | ||
| 208 : | % It ends by calling a macro \sth@getwithin of no mandatory arguments but | ||
| 209 : | % one optional argument. | ||
| 210 : | % (3) \sth@getwithin[oparg1] | ||
| 211 : | % oparg1: the numbered within (e.g. subsection) | ||
| 212 : | % This routine finishes the processing. Depending on the four possibilities | ||
| 213 : | % of whether there is a numbered_like or not, and whether there is a | ||
| 214 : | % within or not, \newtheorem is called as is appropriate. | ||
| 215 : | % If there is no numbered_like, then the counter has to be set. That is, | ||
| 216 : | % a user expects to say \newtheorem{corollary}[theorem]{Corollary} and get | ||
| 217 : | % a corollary environment that is numbered in the same sequence as the | ||
| 218 : | % theorem environment, e.g., uses the theorem counter c@theorem. But in | ||
| 219 : | % runnning the \newshadetheorem we have called a \newtheorem{shadetheorem}... | ||
| 220 : | % and so the counter actually created is c@shadetheorem. We need the three | ||
| 221 : | % c@theorem, p@theorem and \thetheorem. | ||
| 222 : | % **** Remark on the \expandafter madness **** | ||
| 223 : | % Probably I am going about this all wrong ... | ||
| 224 : | % The construct | ||
| 225 : | % \newtheorem{\sth@envname}{\sth@caption} | ||
| 226 : | % doesn't do the job here because the \sth@envname and sth@caption aren't | ||
| 227 : | % resolved until they are called in the document: | ||
| 228 : | % after \newshadetheorem{theorem}{Theorem} | ||
| 229 : | % \newshadetheorem{corollary}{Corollary} | ||
| 230 : | % and later in the document | ||
| 231 : | % \begin{theorem} .. \end{theorem} | ||
| 232 : | % we get ``Corollary'' because that's what \sth@envname is at that moment. | ||
| 233 : | % Aarrg! | ||
| 234 : | % Instead, it has to be expanded when \newshadetheorem is called. This is | ||
| 235 : | % hard, IMHO. \expandafter<tok1><\tok2> puts <tok1> on a stack and expands | ||
| 236 : | % <tok2>. If <tok2> is another \expandafter then we have | ||
| 237 : | % \expandafter<tok1>\expandafter<tok3><tok4> which resolves to | ||
| 238 : | % <tok1><tok3><expansion of tok4>. If <tok1> is another \expandafter then | ||
| 239 : | % there is another round of expansion. | ||
| 240 : | % * To have \newshadetheorem{thm}{Thm} expand, we do this (where \ea is an | ||
| 241 : | % abbreviation for \expandafter): | ||
| 242 : | % \ea\ea\ea\newtheorem\ea\ea\ea{\ea\sth@shadeenvname\ea}\ea{\sth@caption} | ||
| 243 : | % ... which resolves to ... | ||
| 244 : | % \ea \newtheorem \ea { \sth@shadeenvname } {Thm } | ||
| 245 : | % ... which in turn resolves to ... | ||
| 246 : | % \newtheorem { thm } {Thm } | ||
| 247 : | % ... which is what I want. | ||
| 248 : | % * To have a three-argument case come out right, we need seven \ea's. | ||
| 249 : | % Consider the one that we want to come out as \newtheorem{thm}{Thm}[section]. | ||
| 250 : | % \ea\ea\ea\ea\ea\ea\ea\newtheorem\ea\ea\ea\ea\ea\ea\ea{ | ||
| 251 : | % \ea\ea\ea\sth@shadeenvname\ea\ea\ea} | ||
| 252 : | % \ea\sth@caption\ea}\ea[\sth@within] | ||
| 253 : | % (ignore the line breaks, which are for visual clarity only) | ||
| 254 : | % ... which resolves to ... | ||
| 255 : | % \ea \ea \ea \newtheorem \ea \ea \ea { | ||
| 256 : | % \ea \sth@shadeenvname \ea } | ||
| 257 : | % \sth@caption } [section ] | ||
| 258 : | % ... which in turn resolves to ... | ||
| 259 : | % \ea \newtheorem \ea { | ||
| 260 : | % \sth@shadeenvname } | ||
| 261 : | % Thm } [section ] | ||
| 262 : | % ... which, in its turn, resolves to ... | ||
| 263 : | % \newtheorem { | ||
| 264 : | % shadethm } | ||
| 265 : | % Thm } [section ] | ||
| 266 : | % which is the call that I want. | ||
| 267 : | % TeX is a strange place. | ||
| 268 : | |||
| 269 : | \newcommand{\newshadetheorem}[1]{% | ||
| 270 : | \def\sth@envname{#1}\def\sth@shadeenvname{shade#1}% | ||
| 271 : | \sth@getcaption} | ||
| 272 : | |||
| 273 : | \newcommand{\sth@getcaption}[2][\relax]{% | ||
| 274 : | \def\sth@caption{#2}\def\sth@numberedlike{#1}% | ||
| 275 : | \sth@getwithin} | ||
| 276 : | |||
| 277 : | \newcommand{\sth@getwithin}[1][\relax]{% | ||
| 278 : | \def\sth@within{#1}% | ||
| 279 : | \if\sth@numberedlike\relax %if --numbered_like-- is not present | ||
| 280 : | \if\sth@within\relax | ||
| 281 : | %\newtheorem{shade\sth@envname}{\sth@caption}% | ||
| 282 : | \expandafter\expandafter\expandafter\newtheorem\expandafter\expandafter\expandafter{\expandafter\sth@shadeenvname\expandafter}\expandafter{\sth@caption} % | ||
| 283 : | \else | ||
| 284 : | %\newtheorem{shade\sth@envname}{\sth@caption}[\sth@within]% | ||
| 285 : | \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\newtheorem\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter{\expandafter\expandafter\expandafter\sth@shadeenvname\expandafter\expandafter\expandafter}\expandafter\expandafter\expandafter{\expandafter\sth@caption\expandafter}\expandafter[\sth@within]% | ||
| 286 : | \fi | ||
| 287 : | \global\expandafter\countdef\csname \expandafter c\expandafter @\sth@envname\endcsname=\allocationnumber % just allocated shade<ctr>; make <ctr> be the same register | ||
| 288 : | \expandafter\expandafter\expandafter\gdef\expandafter\csname the\sth@envname\expandafter\endcsname\expandafter{\csname theshade\sth@envname\endcsname}% make \the<ctr> display the same as \theshade<ctr> | ||
| 289 : | \global\expandafter\let\csname p@\sth@envname\endcsname\@empty % and what the heck is p@<ctr>, anyway? | ||
| 290 : | \else %if --numbered_like-- is present | ||
| 291 : | \if\sth@within\relax | ||
| 292 : | %\newtheorem{shade\sth@envname}[\sth@numberedlike]{\sth@caption}% | ||
| 293 : | \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\newtheorem\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter{\expandafter\expandafter\expandafter\sth@shadeenvname\expandafter\expandafter\expandafter}\expandafter\expandafter\expandafter[\expandafter\sth@numberedlike\expandafter]\expandafter{\sth@caption}% | ||
| 294 : | \else | ||
| 295 : | % Presumably get an error from newtheorem. | ||
| 296 : | \typeout{!!!ERROR, shadethm.sty: \newshadetheorem used with both [numbered like] and [within] options.} | ||
| 297 : | \newtheorem{\sth@shadeenvname}[\sth@numberedlike]{\sth@caption}[\sth@within]% | ||
| 298 : | \fi | ||
| 299 : | \fi | ||
| 300 : | \expandafter\shade@@thm\expandafter{\sth@envname}} | ||
| 301 : | |||
| 302 : | % \shade@@thm | ||
| 303 : | % arg1: name of environment (e.g., `definition') | ||
| 304 : | % Define an environment that will be called by the user (e.g., | ||
| 305 : | % \begin{definition} .. \end{definition}. | ||
| 306 : | % Calls, e.g., \begin{shadedefinition} .. \end{shadedefinition} inside of | ||
| 307 : | % a \begin{shadebox} .. \end{shadebox} environment. | ||
| 308 : | \def\shade@@thm#1{% | ||
| 309 : | \newenvironment{#1}% | ||
| 310 : | {\begin{shadebox}\begin{shade#1}}% | ||
| 311 : | {\end{shade#1}\end{shadebox}}} | ||
| 312 : | |||
| 313 : | \endinput %end shadethm.sty | ||
| 314 : | =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-shadetest.tex-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | ||
| 315 : | \documentclass{article} % test of LaTeX package shadethm.sty | ||
| 316 : | \usepackage{shadethm} | ||
| 317 : | \newshadetheorem{theorem}{Theorem}[section] | ||
| 318 : | \newshadetheorem{cor}[theorem]{Corollary} | ||
| 319 : | \newtheorem{remark}[theorem]{Remark} | ||
| 320 : | \newtheorem{unshadedtheorem}[theorem]{Theorem} | ||
| 321 : | \newtheorem{comment}{Comment}[section] | ||
| 322 : | |||
| 323 : | \begin{document} | ||
| 324 : | Document begins with some initial text. | ||
| 325 : | |||
| 326 : | \section{First Section} | ||
| 327 : | Here is some initial text before the shaded box. | ||
| 328 : | |||
| 329 : | \begin{theorem} | ||
| 330 : | This is the text to be shaded. | ||
| 331 : | \end{theorem} | ||
| 332 : | |||
| 333 : | This is some text after the first shade. | ||
| 334 : | It is separated from the environments by a blank line; that is | ||
| 335 : | all handled as usual in \LaTeX. | ||
| 336 : | \begin{cor} | ||
| 337 : | This is more text to be shaded. | ||
| 338 : | It is numbered with the same counter as the environment above. | ||
| 339 : | |||
| 340 : | Multiple paragraphs will be handled with the usual paragraph indentation, | ||
| 341 : | unless of course the user asks for a different paragraph indentation inside | ||
| 342 : | the environment. | ||
| 343 : | \end{cor} | ||
| 344 : | This is not separated from the prior environment by a blank line and | ||
| 345 : | so I don't expect a new paragraph. | ||
| 346 : | This shows that the default is for the shaded areas have the usual text size | ||
| 347 : | so that shading sticks out into the margin. | ||
| 348 : | This is the shadethm option \emph{bodymargin}. | ||
| 349 : | The behavior of having the shading end at the margin | ||
| 350 : | (so the words do not take up the full text width) | ||
| 351 : | comes from the option \emph{shademargin}, invoked with | ||
| 352 : | \verb!\usepackage[shademargin]{shadethm}!. | ||
| 353 : | |||
| 354 : | |||
| 355 : | \begin{unshadedtheorem} | ||
| 356 : | More text. | ||
| 357 : | This time not set in shade, but it is still numbered in the same sequence. | ||
| 358 : | \end{unshadedtheorem} | ||
| 359 : | |||
| 360 : | A bit more. | ||
| 361 : | |||
| 362 : | \begin{comment} | ||
| 363 : | More text. | ||
| 364 : | This time neither set in shade, nor numbered in the same sequence. | ||
| 365 : | \end{comment} | ||
| 366 : | |||
| 367 : | |||
| 368 : | \section{A New Section} | ||
| 369 : | |||
| 370 : | Section preamble. | ||
| 371 : | |||
| 372 : | \begin{theorem} | ||
| 373 : | This theorem is shaded and the number has been reset by the section. | ||
| 374 : | \end{theorem} | ||
| 375 : | |||
| 376 : | \begin{remark} | ||
| 377 : | And a closing remark | ||
| 378 : | \end{remark} | ||
| 379 : | Finishing text. | ||
| 380 : | |||
| 381 : | \clearpage | ||
| 382 : | \section{A Test of Colors} | ||
| 383 : | This section shows how you can fool around to see some of you own colors. | ||
| 384 : | % Set up some lengths so that you can see the border. | ||
| 385 : | \setlength{\shadeboxsep}{2pt} | ||
| 386 : | \setlength{\shadeboxrule}{.4pt} | ||
| 387 : | \setlength{\shadedtextwidth}{\textwidth} | ||
| 388 : | \addtolength{\shadedtextwidth}{-2\shadeboxsep} | ||
| 389 : | \addtolength{\shadedtextwidth}{-2\shadeboxrule} | ||
| 390 : | \setlength{\shadeleftshift}{0pt} | ||
| 391 : | \setlength{\shaderightshift}{0pt} | ||
| 392 : | % Macro to test colors | ||
| 393 : | \newcommand{\thmwithcmykcolor}[2]{% | ||
| 394 : | \par Material before the theorem. | ||
| 395 : | \definecolor{shadethmcolor}{cmyk}{#1}% | ||
| 396 : | \definecolor{shaderulecolor}{cmyk}{#2}% | ||
| 397 : | \begin{theorem} | ||
| 398 : | This is a theorem set in the cmyk color \textbf{#1}, surrounded with a | ||
| 399 : | borderline set in the cmyk color \textbf{#2}. | ||
| 400 : | Note, for instance, that shades darken on overheads, so test your colors | ||
| 401 : | where you will use them. | ||
| 402 : | \end{theorem}} | ||
| 403 : | % Some colors | ||
| 404 : | \thmwithcmykcolor{.10,.10,0,0}{.75,.75,0,.5} | ||
| 405 : | \thmwithcmykcolor{.04,.04,0,.10}{.99,0,0.52,0.70} | ||
| 406 : | \thmwithcmykcolor{0,.13,.11,0}{0,0.88,0.85,0.35} | ||
| 407 : | The prior theorem illustrates what happens if you use the option | ||
| 408 : | \emph{colored}, as supplied in the file \verb!colored.sth!, | ||
| 409 : | except that the supplied file has the color stick out into the margin. | ||
| 410 : | |||
| 411 : | One more supplied option is \emph{shadein} where each shaded theorem | ||
| 412 : | is indented, like a \LaTeX\ quotation. | ||
| 413 : | % ---> Uncomment if you want to test dvips's named colors | ||
| 414 : | % \newcommand{\thmwithnamedcolor}[1]{% | ||
| 415 : | % \par Material before the theorem. | ||
| 416 : | % \definecolor{shadethmcolor}{named}{#1}% | ||
| 417 : | % \definecolor{shaderulecolor}{named}{Black}% | ||
| 418 : | % \begin{theorem} | ||
| 419 : | % This is a theorem set in the named color \textbf{#1}, surrounded with a blac | ||
| 420 : | % borderline. | ||
| 421 : | % Note, for instance, that colors darken on overheads, so test your colors | ||
| 422 : | % where you will use them. | ||
| 423 : | % \end{theorem}} | ||
| 424 : | % | ||
| 425 : | % These are all the DVIPS named colors from color.pro (as of 1999-Aug-11). | ||
| 426 : | % \thmwithnamedcolor{GreenYellow} | ||
| 427 : | % \thmwithnamedcolor{Yellow} | ||
| 428 : | % \thmwithnamedcolor{Goldenrod} | ||
| 429 : | % \thmwithnamedcolor{Dandelion} | ||
| 430 : | % \thmwithnamedcolor{Apricot} | ||
| 431 : | % \thmwithnamedcolor{Peach} | ||
| 432 : | % \thmwithnamedcolor{Melon} | ||
| 433 : | % \thmwithnamedcolor{YellowOrange} | ||
| 434 : | % \thmwithnamedcolor{Orange} | ||
| 435 : | % \thmwithnamedcolor{BurntOrange} | ||
| 436 : | % \thmwithnamedcolor{Bittersweet} | ||
| 437 : | % \thmwithnamedcolor{RedOrange} | ||
| 438 : | % \thmwithnamedcolor{Mahogany} | ||
| 439 : | % \thmwithnamedcolor{Maroon} | ||
| 440 : | % \thmwithnamedcolor{BrickRed} | ||
| 441 : | % \thmwithnamedcolor{Red} | ||
| 442 : | % \thmwithnamedcolor{OrangeRed} | ||
| 443 : | % \thmwithnamedcolor{RubineRed} | ||
| 444 : | % \thmwithnamedcolor{WildStrawberry} | ||
| 445 : | % \thmwithnamedcolor{Salmon} | ||
| 446 : | % \thmwithnamedcolor{CarnationPink} | ||
| 447 : | % \thmwithnamedcolor{Magenta} | ||
| 448 : | % \thmwithnamedcolor{RedViolet} | ||
| 449 : | % \thmwithnamedcolor{Fuchsia} | ||
| 450 : | % \thmwithnamedcolor{Lavender} | ||
| 451 : | % \thmwithnamedcolor{Thistle} | ||
| 452 : | % \thmwithnamedcolor{Orchid} | ||
| 453 : | % \thmwithnamedcolor{DarkOrchid} | ||
| 454 : | % \thmwithnamedcolor{Purple} | ||
| 455 : | % \thmwithnamedcolor{Plum} | ||
| 456 : | % \thmwithnamedcolor{Violet} | ||
| 457 : | % \thmwithnamedcolor{RoyalPurple} | ||
| 458 : | % \thmwithnamedcolor{BlueViolet} | ||
| 459 : | % \thmwithnamedcolor{Periwinkle} | ||
| 460 : | % \thmwithnamedcolor{CadetBlue} | ||
| 461 : | % \thmwithnamedcolor{CornflowerBlue} | ||
| 462 : | % \thmwithnamedcolor{MidnightBlue} | ||
| 463 : | % \thmwithnamedcolor{NavyBlue} | ||
| 464 : | % \thmwithnamedcolor{RoyalBlue} | ||
| 465 : | % \thmwithnamedcolor{Blue} | ||
| 466 : | % \thmwithnamedcolor{Cerulean} | ||
| 467 : | % \thmwithnamedcolor{Cyan} | ||
| 468 : | % \thmwithnamedcolor{ProcessBlue} | ||
| 469 : | % \thmwithnamedcolor{SkyBlue} | ||
| 470 : | % \thmwithnamedcolor{Turquoise} | ||
| 471 : | % \thmwithnamedcolor{TealBlue} | ||
| 472 : | % \thmwithnamedcolor{Aquamarine} | ||
| 473 : | % \thmwithnamedcolor{BlueGreen} | ||
| 474 : | % \thmwithnamedcolor{Emerald} | ||
| 475 : | % \thmwithnamedcolor{JungleGreen} | ||
| 476 : | % \thmwithnamedcolor{SeaGreen} | ||
| 477 : | % \thmwithnamedcolor{Green} | ||
| 478 : | % \thmwithnamedcolor{ForestGreen} | ||
| 479 : | % \thmwithnamedcolor{PineGreen} | ||
| 480 : | % \thmwithnamedcolor{LimeGreen} | ||
| 481 : | % \thmwithnamedcolor{YellowGreen} | ||
| 482 : | % \thmwithnamedcolor{SpringGreen} | ||
| 483 : | % \thmwithnamedcolor{OliveGreen} | ||
| 484 : | % \thmwithnamedcolor{RawSienna} | ||
| 485 : | % \thmwithnamedcolor{Sepia} | ||
| 486 : | % \thmwithnamedcolor{Brown} | ||
| 487 : | % \thmwithnamedcolor{Gray} | ||
| 488 : | |||
| 489 : | Enjoy! | ||
| 490 : | \textit{--Jim Hefferon} | ||
| 491 : | \end{document} | ||
| 492 : | |||
| 493 : | |||
| 494 : | |||
| 495 : | |||
| 496 : | |||
| 497 : |
| Administrator | ViewVC Help |
| Powered by ViewVC 1.0.3 |