TeXhax Digest Sunday, March 10, 1991 Volume 91 : Issue 010 Moderators: Tiina Modisett and Pierre MacKay %%% The TeXhax digest is brought to you as a service of the TeX Users Group %%% %%% in cooperation with the UnixTeX distribution service at the %%% %%% University of Washington %%% Today's Topics: Answers to exercises in LaTeX TeX bug: optional spaces are mandatory Optional Spaces are mandatory (TeXhax Digest V91 #008) Interactive TeX/Mathematica documents -d filter? TeXhax via bitnet. Check your subscription. Reversing authors' names with tib --------------------------------------------------------------------------- Date: Fri, 22 Feb 91 12:25:47 From: Mike Piff Subject: Answers to exercises in LaTeX Keywords: Latex, exercises Tom Prusa asks whether there exists a style file for LaTeX which allows answers to be shifted to the end of a chapter/book/article. I used the following variant on DEK's macros in a book which is just about to appear. Feel free to copy it. Mike Piff %---------------------------CUT HERE------------------------------------------- % LaTeX Answer style file. Mike Piff, Sheffield, England % % Defines \newrtheorem, and commands \Solution and \Hint which % cause all text up to first line starting \end{Exercise} to be output % to t$\jobname.sol. WARNING: \end{Exercise} MUST BE LEFT JUSTIFIED ON LINE % File opened with \Opensolutionfile, and input with \Readsolutionfile. % Example: % \documentstyle[answers]{book} % \newrtheorem{Exercise}{Exercise}[chapter] % \newrtheorem % \begin{document} % \Opensolutionfile % \chapter{one} % \begin{Exercise} % First exercise % \Solution Not too interesting % \end{Exercise} % \begin{Exercise} % Second exercise % \Hint Harder! % \end{Exercise} % % \appendix % \chapter{Solutions} % \Readsolutionfile % \end{document} \newfont{\itb}{cmbxti10}%bold slanted font in normal text size \ifcase\@ptsize\or scaled\magstephalf\or scaled\magstep1\fi \def\newrtheorem#1{\@ifnextchar[{\@orthm{#1}}{\@nrthm{#1}}} \def\@nrthm#1#2{\@ifnextchar[{\@xnrthm{#1}{#2}}{\@ynrthm{#1}{#2}}} \def\@xnrthm#1#2[#3]{\expandafter\@ifdefinable\csname #1\endcsname {\@definecounter{#1}\@addtoreset{#1}{#3}% \expandafter\xdef\csname the#1\endcsname{\expandafter\noexpand \csname the#3\endcsname \@rthmcountersep \@rthmcounter{#1}}% \global\@namedef{#1}{\@rthm{#1}{#2}}\global\@namedef{end#1}{\@endrtheorem}}} \def\@ynrthm#1#2{\expandafter\@ifdefinable\csname #1\endcsname {\@definecounter{#1}% \expandafter\xdef\csname the#1\endcsname{\@rthmcounter{#1}}% \global\@namedef{#1}{\@rthm{#1}{#2}}\global\@namedef{end#1}{\@endrtheorem}}} \def\@orthm#1[#2]#3{\expandafter\@ifdefinable\csname #1\endcsname {\global\@namedef{the#1}{\@nameuse{the#2}}% \global\@namedef{#1}{\@rthm{#2}{#3}}% \global\@namedef{end#1}{\@endrtheorem}}} \def\@rthm#1#2{\refstepcounter {#1}\@ifnextchar[{\@yrthm{#1}{#2}}{\@xrthm{#1}{#2}}} \def\@xrthm#1#2{\@beginrtheorem{#2}{\csname the#1\endcsname}\ignorespaces} \def\@yrthm#1#2[#3]{\@opargbeginrtheorem{#2}{\csname the#1\endcsname}{#3}\ignorespaces} \def\NoBr@ak{\@endparpenalty\@M\postdisplaypenalty\@M} \def\@rthmcounter#1{\noexpand\arabic{#1}} \def\@rthmcountersep{.} \def\@makerthmnumber#1#2{\bf #1 #2:} \def\@beginrtheorem#1#2{% \trivlist \parshape \@ne \@totalleftmargin \linewidth \item[\hskip \labelsep{\itb #1\ #2\/}]} \def\@opargbeginrtheorem#1#2#3{% \trivlist \parshape \@ne \@totalleftmargin \linewidth \item[\hskip \labelsep{\itb #1\ #2\ (#3)\/}]} \def\@endrtheorem{\endtrivlist} %The answer is announced with \Solution or \Hint, and finishes with a line %which must consist ONLY of \end{Exercise} \def\Solno#1{\begin{trivlist}\item[\hskip\labelsep{\itb #1}]} \def\endSolno{\end{trivlist}} \newwrite\@ns \def\Solfile{t$\jobname.sol} {\catcode`\|=0 \catcode`\<=1 \catcode`\>=2 \catcode`\{=12 \catcode`\}=12 \catcode`\\=12 |gdef|@ndExercise<\end{Exercise}>% > \def\M@k#1{{\ifhmode\unskip\nobreak\hfil\penalty50 \hskip1em\else\nobreak\fi \mbox{}\nobreak\hfil\fbox{#1}% \parfillskip=0pt \finalhyphendemerits=0 \par}} \outer\def\Opensolutionfile{\immediate\openout\@ns=\Solfile} \outer\def\Solution{\S@lution{}} \outer\def\Hint{\S@lution{\string~(Hint)}} \def\S@lution#1{\immediate\write\@ns{}% \immediate\write\@ns{\string\Solno{\theExercise#1}}% \c@pytoendExerci% } \def\c@pytoendExerci{\begingroup\s@tupcopy\c@pyans} \def\s@tupcopy{\def\do##1{\catcode`##1=12}\dospecials% \catcode`\|=12 \makeatother\obeylines} \def\@Ndgroup{\endgroup\end{Exercise}} {\obeylines% \gdef\c@pyans#1 {\def\n@xt{#1}% \ifx\n@xt\@ndExercise% \immediate\write\@ns{\string\endSolno}% \let\n@xt=\@Ndgroup% \else \immediate\write\@ns{\n@xt}% \let\n@xt=\c@pyans% \fi% \n@xt% }} \def\Closesolutionfile{\immediate\closeout\@ns} \def\Readsolutionfile{\Closesolutionfile\input \Solfile} % end of ANSWERS.STY From Dr M. J. Piff, Department of Pure Mathematics, PO Box 597, Hicks Noisy Building Site, Hounsfield Road, SHEFFIELD S10 2UN, England. Tel. SHEFFIELD(0742) 768555 Extension 4431. JANET MPiff@UK.AC.SHEF.PA or MPiff@UK.AC.SHEF.IBM ------------------------------------------------------------------------------- Date: Fri, 22 Feb 91 08:21:44 -0500 From: amgreene@ATHENA.MIT.EDU Subject: TeX bug: optional spaces are mandatory Keywords: TeX, bug, spaces Sorry, but these spaces *are* mandatory. If a constant is followed by a counter, then the constant acts as a scalar that multiplies the contents of the counter. Since the \if is expanded in TeX's mouth, and the constant/counter pair is evaluated in TeX's stomach, the intervening \if construction doesn't count. I hope this helps, - Andrew Marc Greene Student Information Processing Board (SIPB) MIT Project Athena Watchmaker -------------------------------------------------------------------------- Date: Sun, 24 Feb 91 17:53:08 -0800 From: mackay@cs.washington.edu (Pierre MacKay) Subject: Optional Spaces are mandatory (TeXhax Digest V91 #008) Keywords: TeX, spaces I don't know what nasty side-effects may result from changing the evaluation of numbers, but I would worry about it. I remember David Fuchs explaining the reasons for the tricky timing in evaluation of numeric strings, but I can't recall the argument. Anyway, the requirement under some circumstances to have the space there so that the number will be fully evaluated and the assignment completed has been around for a long time. If it could be avoided safely, it would have been fixed a long time ago. I think the problem is that TeX must actually *read* a non-numeric token before it can make the assignment. Not too bad if the token is something that is dealt with in TeX's digestive tract, but if the token is something like \ifnum, which is way up in TeX's masticatory organs, The test will be made much too early, and you get the results you describe. The need for that space can hardly be called a feature, but I suspect that it has been a known fact for too long to be called a bug. I would certainly proceed cautiously and hammer on the code you have emended before you trust it. Email concerned with UnixTeX distribution software should be sent primarily to: elisabet@max.u.washington.edu Elizabeth Tachikawa otherwise to: mackay@cs.washington.edu Pierre A. MacKay Smail: Northwest Computing Support Center TUG Site Coordinator for Thomson Hall, Mail Stop DR-10 Unix-flavored TeX University of Washington Seattle, WA 98195 (206) 543-6259 ---------------------------------------------------------------------------- Date: Fri, 22 Feb 91 09:00:41 -0500 From: dan@chem.bu.edu (Dan Dill) Subject: Interactive TeX/Mathematica documents Keywords: Interactive TeX/Mathematica, documents I have written a set of tools to help in the interactive preparation of TeX/LaTeX documents containing Mathematica input and output, including graphics (using Trevor Darrell's psfig/tex). The tools consist of GNU Emacs functions to exchange information between TeX/LaTeX documents in one buffer and Mathematica running in another buffer in David Jacobson's Mathematica mode, and TeX macros and LaTeX .sty files to format Mathematica text and to include Mathematica graphics. The tools are available from Internet host chem.bu.edu (128.197.30.18) by anonymous ftp in directory /pub/tex-mma. The file README there describes what to do. If you encounter problems, just let me know. If the tools turn out to be useful to you, let me know so I can keep you informed of changes. Dan Dill dan@chem.bu.edu ----------------------------------------------------------------------------- Date: Fri, 22 Feb 91 9:24:49 CST From: Paul A. Scowen Subject: -d filter? Keywords: dvi filter Hi, this may be a dumb question but I've been trying to track down the DVI filter for a PostScript printer. This fabled piece of software is mentioned in all the lpr manual pages on Unix systems such that you can just type "lpr -d doc.dvi" and bang you've got the printout. Now I know this is emulated by the dvips function, but the xtex software is set up to use lpr -d. No-one has ever seen this damned thing! Is it a cruel joke? - __________ - | Paul A. Scowen / ___ ___ \ | - Department of Space Physics and Astronomy / / @ \/ @ \ \ - | Rice University, Houston TX 77251 \ \___/\___/ /\ | - (713) 527-8101 x2433, x3534 \____\/____/|| - | / /\\\\\// | - Internet: uk1@spacsun.rice.edu | |\\\\\\ - | scowen@vega.rice.edu \ \\\\\\ | - \______/\\\\ - | Span: RICE::SCOWEN _||_||_ | - -- -- - --------------------------------------------------------------------------- Date: Mon, 25 Feb 91 12:33:12 -0800 From: mackay@cs.washington.edu (Pierre MacKay) Subject: TeXhax via bitnet. Check your subscription. Keywords: TeXhax, Bitnet Something strange is happening to the BITNET part of this list. It puts us in the characteristically bizarre position to have to ask those who do NOT receive this notice to take some sort of steps to ensure that they do receive it in future. We have noticed that a great many requests for confirmation of subscription are going out. Perhaps there is a sort of purge going on. We are not much direct help. We are on an internet site which simply makes a drop into the BITNET system and depends on the management of the various links within that system. We will send out this short message to see if it gets through where a full issue does not. If it does, and you have not been receiving TeXhax, please see what you can do by tracing the links at your end. You might also find out about confirming your subscription, in case it has been accidentally dropped. It sounds to us as if several redistribution sites have been dropped. There seems to be trouble in Austria, part of the Netherlands, and in both Turkey and Greece, so far. Email concerned with UnixTeX distribution software should be sent primarily to: elisabet@max.u.washington.edu Elizabeth Tachikawa otherwise to: mackay@cs.washington.edu Pierre A. MacKay Smail: Northwest Computing Support Center TUG Site Coordinator for Thomson Hall, Mail Stop DR-10 Unix-flavored TeX University of Washington Seattle, WA 98195 (206) 543-6259 -------------------------------------------------------------------------- Date: Fri, 22 Feb 91 15:12:06 -0500 From: Mary McCaskill Subject: Reversing authors' names with tib Keywords: TiB, reversing, names I have been enthusiastically implementing tib on our plain TeX manuscript preparation system to produce reference lists and bibliographies in the style favored for NASA technical reports. I've now run into a problem when an author's name ending in ``Jr.'' or ``III'' is reversed: Consider the following line in a tib reference file: %A J. H. Starnes, Jr. The correct way to reverse this author's name is Starnes, J. H., Jr. After running tib with authors' names reversed, the result is Jr., J. H. Starnes, Tying the ``Jr.'' to the last name with a tilde %A J. H. Starnes,~Jr. results in Starnes, Jr., J. H. Has anyone addressed this problem? Thanks in advance! Mary K. McCaskill Technical Editing Branch NASA Langley Research Center Hampton, VA (804) 864-2506 Internet: mary@teb.larc.nasa.gov ------------------------------------------------------------------------------- %%% The TeXhax digest is brought to you as a service of the TeX Users Group %%% in cooperation with the UnixTeX distribution service at the %%% University of Washington %%% %%% Concerning subscriptions, address changes, unsubscribing: %%% BITNET: send a one-line mail message to LISTSERV@xxx %%% where xxx is the nearest geographical site in the %%% tree shown below %%% SUBSCRIBE TEX-L % to subscribe %%% or UNSUBSCRIBE TEX-L %%% Here is the BITNET re-distribution tree as shown in a recent %%% REVIEW (The geography is guessed at from the subscription list) %%% %%% CLVM TAMVM1 FINHUTC %%% | | (Finland, UK, Scand, CERN) %%% | | | %%% TeXhax ----> UWAVM ----- MARIST ----- EB0UB011 ----- BNANDP11 %%% | (France,Italy,Spain) (Belgium) %%% | | %%% UBVM HEARN --- DEARN %%% (Netherlands) (Germany) %%% %%% Internet: send a similar one line mail message to %%% TeXhax-request@cs.washington.edu %%% Please be sure you send a valid internet address!! %%% in the form name@domain or name%routing@domain %%% and use the style of the Bitnet one-line message, so that %%% we can find your subscription request easily. %%% %%% JANET users may choose to use %%% texhax-request@uk.ac.nsf %%% %%% All submissions to: TeXhax@cs.washington.edu %%% %%% Back issues available for FTPing as: %%% machine: directory: filename: %%% JUNE.CS.WASHINGTON.EDU TeXhax/TeXhaxyy.nnn %%% yy = last two digits of current year %%% nnn = issue number %%% Previous years in TeXhax/TeXhaxyy.dir/ %%% %%% For further information about TeX Users Group services and publications %%% contact Karen at KLB@MATH.AMS.COM or write to TUG at %%% TeX Users Group %%% P.O. Box 9506 %%% Providence, R.I. 02940-9506 %%% Telephone (401) 751-7760 %%% %%% Current versions of the software now in general distribution: %%% TeX 3.1 metafont 2.7 %%% plain.tex 3.0 plain.mf 1.8 %%% LaTeX 2.09 (12/7/89) cmbase.mf see cm85.bug %%% SliTeX 2.09 (12/4/89) gftodvi 3.0 %%% tangle 4.0 gftopk 2.2 %%% weave 4.1 gftype 3.0 %%% dvitype 3.2 pktype 2.2 %%% pltotf 3.2 pktogf 1.0 %%% tftopl 3.1 mft 2.0 %%% BibTeX 0.99c %%% AmSTeX 1.1d %%%\bye %%% End of TeXhax Digest ************************** -------