%% box_math.txt %% Created by Laurence D. Finston (LDF) Di Sep 20 18:31:13 CEST 2005 %% $Id:$ %% Copyright (C) 2005, 2006, 2007 The Free Software Foundation %% Permission is granted to copy, distribute, and/or modify this document %% under the terms of the GNU Free Documentation License, Version 1.1 or %% any later version published by the Free Software Foundation; with no %% Invariant Sections, with no Front-Cover Texts, and with no Back-Cover %% Texts. A copy of this license is included in the file %% `http://wwwuser.gwdg.de/~lfinsto1/COPYING.TXT'. %% * (1) %% Run these commands: %% tex box_math.txt && dvips -o b.ps box_math %% Conversion for portrait: %% convert -crop 0x0 +antialias -fill white -opaque "rgb(255,0,0)" b.ps b.png %% Conversion for landscape: %% convert -crop 0x0 +antialias -fill white -opaque "rgb(255,0,0)" -rotate -90 b.ps b.png %% display b.png & %% cp b.png ~/www/b.png %% * (1) Magnification. \magnification=\magstep5 %\magnification=3000 %\magnification=3650 %% This seems to be about the limit when \hsize == 40 true cm, %% when using DIN A3 landscape format. %% `convert' fails when \magnification == 3700. %% LDF 2005.09.21. %% It might be worth experimenting with using this font. If it's used, %% new definitions must be written for the math fonts. %% LDF 2005.09.21. %% * (1) Fonts. %\font\normal=cmr17 scaled \magstep3 %% * (1) Input macro files. \input colordvi.tex %% * (1) Page format. \advance\voffset by -1true in \advance\hoffset by -1true in \newif\iflandscape %\landscapetrue \landscapefalse \iflandscape \special{papersize=420mm, 297mm} %% DIN A3 Landscape \vsize=297 true mm \hsize=420 true mm \else \hsize=297 true mm \vsize=420 true mm \special{papersize=297mm, 420mm} %% DIN A3 Portrait \fi \nopagenumbers %% * (1) Named boxes, skips, dimensions, etc. \newbox\imagebox \newtoks\imagetoks \newdimen\hruleheight \hruleheight=1 true mm \newdimen\vrulewidth \vrulewidth=\hruleheight \newskip\topmarginoffset \newskip\bottommarginoffset \topmarginoffset=5 true mm \bottommarginoffset=\topmarginoffset \newskip\leftmarginoffset \newskip\rightmarginoffset \leftmarginoffset=2 true mm \rightmarginoffset=\leftmarginoffset %% * (1) Definitions. %% ** (2) \boximage. \newdimen\defaultlandscapehsize \defaultlandscapehsize=40 true cm \newdimen\defaultportraithsize \defaultportraithsize=15 true cm \newcount\defaulttolerance \defaulttolerance=1000 \newcount\defaultpretolerance \defaultpretolerance=1000 \newcount\savetolerance \newcount\savepretolerance \def\boximage#1#2#3#4#5#6#7#8#9{\begingroup \setbox1=\hbox{#1}\setbox2=\hbox{#2}\setbox3=\hbox{#3}% \setbox4=\hbox{#4}\setbox5=\hbox{#5}\setbox6=\hbox{#6}% \setbox7=\hbox{#7}\setbox8=\hbox{#8}\setbox9=\hbox{#9}% \ifdim\wd1>0pt \toks0={#1}\else \toks0={Red}\fi \ifdim\wd2>0pt \dimen5=#2 \else \dimen5=\defaultlandscapehsize \fi % \ifdim\wd3>0pt \dimen6=#3 \else \dimen6=\defaultportraithsize \fi % \iflandscape \hsize=\dimen5 \else \hsize=\dimen6 \fi % \ifdim\wd4>0pt \hsize=\csname#4\endcsname \fi % \ifdim\wd5>0pt \tolerance=#5 \pretolerance=#5 \else \tolerance=\defaulttolerance \pretolerance=\defaultpretolerance \fi % \ifdim\wd6>0pt \parindent=#6 \else \parindent=0pt \fi \parskip=0pt \ifdim\wd7>0pt \parskip=#7 \else \ifdim\wd8>0pt \parskip=\csname#8\endcsname \else \ifdim\wd9>0pt \parskip=#9\baselineskip \fi \fi \fi % \setbox\imagebox=\hbox{\hskip\leftmarginoffset\vbox{\vskip 2\hruleheight \vskip\topmarginoffset \the\imagetoks \vskip\bottommarginoffset}\hskip\rightmarginoffset}% % \parindent=0pt \parskip=0pt \baselineskip=0pt \dimen0=\wd\imagebox \advance\dimen0 by 2\vrulewidth \dimen1=\ht\imagebox \advance\dimen1 by \dp\imagebox \dimen2=\dimen1 \advance\dimen2 by -1\hruleheight \dimen3=\ht\imagebox \dimen4=\dp\imagebox \hsize=297 true mm \hbox to 0pt{\hskip1 true cm\hskip2 true mm\vbox to 0pt{\copy\imagebox \vskip 0pt minus \dimen3 \vskip 0pt minus \dimen4}\hss}% \setbox3=\vbox{%\leavevmode \csname\the\toks0\endcsname{\vrule width \vrulewidth height \dimen1 % Left vertical \hbox to 0pt{\vrule width \dimen0 height \hruleheight\hss}% Bottom \hbox to 0pt{\hskip\dimen0\vrule width \vrulewidth height \dimen1\hss}% Right vertical \hbox to 0pt{\hskip\dimen0\hskip\vrulewidth \raise\dimen2\hbox{\hskip-\dimen0\hskip-\vrulewidth \vrule width \dimen0 height \hruleheight}\hss}% Top }}\hbox{\hskip1 true cm\copy3\hss}% \endgroup } %% * (1) A box of running text with a predetermined \hsize. \imagetoks={This is a running text. It takes up several lines. I've had good results with making a wire armature, filling it with paper mache, and covering it with plaster. When the plaster has dried (give it a week, maybe, or more in a humid climate), you can sand it and seal it with several thin coats of shellac. Then you can paint on it directly. Plaster is very absorbant, so you need to seal it. I don't remember whether I primed it, but it wouldn't hurt. You'll have to make sure that the attachment of your armature to the plywood is strong enough. Of course, you could use ordinary wooden boards or a strong wooden frame. This is a bit of math mode in a new paragraph: $a^2 + b^2 = c^2$. End of paragraph. Now for a bit of display math: $$a^2 + b^2 = c^2$$ End of display math.} %% ** (2) Call \boximage. %% Arguments: % #1: Color for frame. Default "red". % #2: \hsize for landscape % #3: \hsize for portrait % #4: \hsize for explicitly broken text. % #5: \tolerance and \pretolerance % #6: \parindent. Default 0pt. % #7: \parskip, explicit value. Default 0pt. % #8: \parskip, named \skip, without backslash, e.g., "baselineskip". % #9: \parskip, number. Proportion of \baselineskip, e.g., ".5". %% This call uses defaults for all parameters. %\boximage{}{}{}{}{}{}{}{}{} %\boximage{Green}{}{}{}{}{.5 true cm}{}{}{} %% * (1) Box image with explicit line breaks. Use the width of the %% longest line for the \hsize. The \hboxes will have to be %% generated by a separate program. \newdimen\imagehsize \imagetoks={This is a text with explicit line breaks.\hfil\break It takes up several lines.\hfil\break These lines are of uneven length.\hfil\break I've had good results with making a wire armature,\hfil\break filling it with paper mache, and covering it with plaster.\hfil} \setbox0=\hbox{This is a text with explicit line breaks.} \imagehsize=\wd0 \setbox1=\hbox{It takes up several lines.} \ifdim\wd1>\imagehsize \imagehsize=\wd1 \fi \setbox0=\hbox{These lines are of uneven length.} \ifdim\wd0>\imagehsize \imagehsize=\wd0 \fi \setbox1=\hbox{It takes up several lines.} \ifdim\wd1>\imagehsize \imagehsize=\wd1 \fi \setbox0=\hbox{I've had good results with making a wire armature,} \ifdim\wd0>\imagehsize \imagehsize=\wd0 \fi \setbox1=\hbox{filling it with paper mache, and covering it with plaster.} \ifdim\wd1>\imagehsize \imagehsize=\wd1 \fi %% ** (2) Call \boximage. %% Arguments: % #1: Color for frame. Default "red". % #2: \hsize for landscape % #3: \hsize for portrait % #4: \hsize for explicitly broken text, named \dimen, without backslash, e.g., "imagehsize". % #5: \tolerance and \pretolerance % #6: \parindent. Default 0pt. % #7: \parskip, explicit value. Default 0pt. % #8: \parskip, named \skip, without backslash, e.g., "baselineskip". % #9: \parskip, number. Proportion of \baselineskip, e.g., ".5". \boximage{}{}{}{imagehsize}{}{}{}{}{} %% * (1) \bye %% * (1) Local variables for Emacs. %% Local Variables: %% mode:tex %% eval:(local-set-key [C-kp-add] 'vc-diff) %% eval:(local-set-key "\"" 'self-insert-command) %% eval:(outline-minor-mode t) %% eval:(read-abbrev-file abbrev-file-name) %% abbrev-mode:t %% outline-regexp:"%% [*\f]+" %% End: