TeXhax Digest Sunday, November 10, 1991 Volume 91 : Issue 050 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: MIDNIGHT Macros available on FILESERV How to move page number to right of text DVIMSWIN, Landscape Tables TeX for Lisp CWEB and ANSI C Exporting Formulae from Mathematica to LaTeX -- Summary Summary of solutions to a Dirty Trick type problem ----------------------------------------------------------------------- Date: Tue, 29 Oct 1991 11:37:38 CST From: "George D. Greenwade" Subject: MIDNIGHT Macros available on FILESERV Keywords: Midnight, macros, Fileserv Marcel van der Goot kindly notified me of his updated Midnight macros set, which have been placed on FILESERV and are available from Niord. The home server for these is csvax.cs.caltech.edu [131.215.131.131], in the directory pub/tex/Midnight (with a midnight.tar.Z in pub/tex). Below is the description file for this package. Regards, George %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% George D. Greenwade, Ph.D. Bitnet: BED_GDG@SHSU Department of Economics and Business Analysis THEnet: SHSU::BED_GDG College of Business Administration Voice: (409) 294-1266 P. O. Box 2118 FAX: (409) 294-3612 Sam Houston State University Internet: bed_gdg@SHSU.edu Huntsville, TX 77341 bed_gdg%SHSU.decnet@relay.the.net %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MIDNIGHT -------- The MIDNIGHT package includes the 15 files of Marcel van der Goot's Midnight Macros. The Midnight Macros provide a rather diverse set of macros. Some are useful in general applications (e.g., loop.tex); some can be used to write other macros (e.g., dolines.tex); and some are intended for very specific typesetting problems (e.g., labels.tex). What they have in common is (somewhat) the style of programming, applicability in a variety of situations (e.g., through parametrization), and, maybe most important, a user manual. The files come in pairs: xxx.tex is the file you should \input to use the macros; xxx.doc is a TeX file that describes how to use them. A list of the available files with one line descriptions can be found in the Index file. You may retrieve the entire package of 15 files by including the command: SENDME MIDNIGHT in the body of a mail mesasge to FILESERV@SHSU.BITNET (FILESERV@SHSU.edu). A complete distribution of this version of MIDNIGHT requires all 15 files in this package, so this command is suggested. If, for some reason, you should only need one of these files, say MIDNIGHT.INDEX, use the command: SENDME MIDNIGHT.INDEX in your message to FILESERV. For users with anonymous ftp facilities, these files are available from Niord.SHSU.edu (192.92.115.8) in the directory [.MIDNIGHT]; a compressed tar file of this package is available in the directory [.MIDNIGHT.FTP]. Files in this package: (1 Block = 512 bytes) File Blocks Save file as: MIDNIGHT.BORDER_DOC 33 BORDER.DOC MIDNIGHT.BORDER_TEX 23 BORDER.TEX MIDNIGHT.DOLINES_DOC 27 DOLINES.DOC MIDNIGHT.DOLINES_TEX 12 DOLINES.TEX MIDNIGHT.GLOSS_DOC 24 GLOSS.DOC MIDNIGHT.GLOSS_TEX 9 GLOSS.TEX MIDNIGHT.INDEX 2 INDEX MIDNIGHT.LABELS_DOC 21 LABELS.DOC MIDNIGHT.LABELS_TEX 24 LABELS.TEX MIDNIGHT.LOOP_DOC 13 LOOP.DOC MIDNIGHT.LOOP_TEX 7 LOOP.TEX MIDNIGHT.QUIRE_DOC 44 QUIRE.DOC MIDNIGHT.QUIRE_TEX 37 QUIRE.TEX MIDNIGHT.STYLEDEF_DOC 28 STYLEDEF.DOC MIDNIGHT.STYLEDEF_TEX 16 STYLEDEF.TEX Approximate total blocks in full MIDNIGHT package = 320 -------------------------------------------------------------------------- Date: Mon, 28 Oct 1991 22:56:50 -0600 (CST) From: H0L4059@ZEUS.TAMU.EDU Subject: How to move page number to right of text Keywords: Latex, page numbers, right of text Regrarding the subject matter which sent to your couple of day ago. I also forwarded my question to LaTeX-help@sumex-aim.stanford.edu (Latex Helpdesk). My mail were forwarded to several members of the volunteer corps. They are such a wonderful group, I received serveral response the second day. Michael Barr mailed me his answer to my question, which does the exact thing that I need. I am listing his mail here for people who may need it. The short answer is there is no such latex command. Which doesn't mean one cannot be built. Here is a file that puts the number 30pt to the right of the right margin. By modifying and playing with it, you can do all sorts of tricks, such as page styles that don't have numbers of that have them centered, etc. This should either be put into a style file or preceded by \makeatletter and followed by \makeatother. Here is the complete file: \documentstyle{article} \makeatletter \def\ps@right {\let\@mkboth\markboth \def\@oddfoot{}\def\@evenfoot{}\def\@evenhead{\rm \thepage\hfil \sl \leftmark}\def\@oddhead{\hbox{}\sl \rightmark \hfil \hbox to 0pt{\kern30pt \rm\thepage\hss}% }\def\sectionmark##1{\markright {\uppercase{\ifnum \c@secnumdepth >\z@ \thesection\hskip 1em\relax \fi ##1}}}} \makeatother \pagestyle{right} \begin{document} This is a sentence long enough to fill out one line so we can see where the line break is and see if the page number comes to the right of it. \newpage This is a sentence long enough to fill out one line so we can see where the line break is and see if the page number comes to the right of it. \end{document} Michael Barr -------------------------------------------------------------------- Date: Mon, 28 Oct 91 12:51 EST From: GRONKE@DUKEMVS.BITNET Subject: DVIMSWIN, Landscape Tables Keywords: DVIMSWIN, Landscape Tables In TexHax 91:48 G. Burton asks about printing in landscape mode. The dvi drivers included with emTeX have a page layout command which allows you to rotate the output. For example, "/tr1" = rotate 90 degrees anticlockwise. It appears that this doesnt work for dvihplj, so this may not solve the problem. Steve Grigg asks about using DVIMSWIN. My version of the program looks in the EMTEXTEXFONTSDPI100 directory. I have the environment variables: DVIDRVFONTS=C:EMTEXTEXFONTS in the autoexec file. You'll need to get the DPI100 fonts. Paul Gronke, Duke University GRONKE@DUKEMVS.AC.DUKE.EDU --------------------------------------------------------------------- Date: Mon, 28 Oct 91 09:22:45 EST From: Tim Larkin Subject: TeX for Lisp Keywords: TeX, Lisp I am looking for a Lisp (source or binary) for TeX to run on a Symbolics, along with a DVI for the printer and a previewer. Can anyone help me to locate such a creature? ------------------------------------------------------------------------ Date: Sun, 27 Oct 91 17:00:08 EST From: karney@theory.pppl.gov (Charles Karney) Subject: CWEB and ANSI C Keywords: CWEB, ANSI C Marc van Leeuwen (TeXhax V91 #048) asks about a version of CWEB that understands ANSI C. I recommend FWEB by John Krommes. FWEB was originally based on Levy's CWEB but has been extensively modified. FTANGLE handles ANSI and old-style C as well as Fortran (77 and 90), Ratfor, and TeX. FWEAVE understands Plain TeX and LaTeX. It's available via anonymous FTP from lyman.pppl.gov in directory pub/fweb. It was announced in a recent issue of TeXhax. Charles Karney Plasma Physics Laboratory E-mail: Karney@Princeton.EDU Princeton University Phone: +1 609 243 2607 Princeton, NJ 08543-0451 FAX: +1 609 243 2662 ------------------------------------------------------------------------- Date: Fri, 25 Oct 1991 17:36:40 GMT From: gabriel@sce.carleton.ca (Gabriel Warshaw) Subject: Exporting Formulae from Mathematica to LaTeX -- Summary Keywords: LaTeX, Mathematica I have been trying to use the "TeXForm" function of Mathematica to convert mathematical expressions that can be used directly by LaTex. For the expressions of interest (they consist of dozens or hundreds of terms), the LaTex output using the TexForm-generated input is not very readable and some of it completely unreadable due to misplaced brackets, tiny text, etc. I requested help to answer the following: Is there a better way to get the output I want? Are there any routines available to conveniently get output which can be directly used by LaTex withou t errors? The following is a summary of the responses I received. One of the ways to save Mathematica output in TeXForm is to use Splice["infile.mtex"]. To use this function, you need to create an input file named infile.mtex, using a text editor outside of Mathematica. In this file, you must enclose the expressions that you want evaluated by Mathematica with <* and *> . Then, within Mathematica, invoke Splice["infile.mtex"]. Mathematica will take <*some expression*> of infile.mtex, evaluate 'some expression' as a Mathematica input, convert the output to TeXForm and will save in a new file named infile.tex. Any text in the inputfile not enclosed between <* and *> is copied without change to the infile.tex. Notice that the default format for Mathematica output by Splice[] is determined by the extension of the input file name (consult the Mathematica book for other forms): input file -> name.mtex output file -> name.tex Another way to get TeXForm is to use OpenWrite command. Use the following syntax: if y = Integrate[Sin[x],x] then, OpenWrite["filename", FormatType->OutputForm] Write["filename", TeXForm[y]] Close["filename"] The output file will contain TeXForm of the result of integration. xxxxxxxxxxxxxxxxxxx Try instead `Scientific Word' from TCI in New Mexico... Scientific Word allows you to set up equations in classic WYSWYG style. The result is then converted to TeX macros for insertion in your TeX document. xxxxxxxxxxxxxxxxxxx Just a short remark to what may/may not be part of the problem you describe: we have Mathematica 1.0 for VAX/VMS and in this version TeXForm has a bug (among so many other bugs) - TeX-commands at the end of a line are broken, like \ov er instead of \over Don't know if you have this problem - but it might be.... xxxxxxxxxxxxxxxxxx A line-splitting algorithm is available for TeX form in the Maple computer algebra program. That may be of use to you, if you are willing to use Maple instead. Two other things to consider: (a) Is mathematica's display order really what you want to see? (b) Do you really want to typeset an expression with hundreds of terms (since it is unfit for consumption by anyone, really)? There was also a line-splitting algorithm implemented in Macsyma, but with an EQN/TROFF target, and also, I think one with a TeX target, but that one was not widely distributed. Good luck ... incidentally, TeX may choke on really large expressions, so ASCII may be what you have to use. ----------------------------------------------------------------------- Date: Wed, 30 Oct 91 17:01:25 -0500 From: Stephen G Simpson Subject: Summary of solutions to a Dirty Trick type problem Keywords: active byte, TeX This is a summary of the situation regarding my recent request for help with a "Dirty Trick" type problem. Many thanks to the wizards on comp.text.tex for numerous helpful responses. The problem is as follows. How can I make + into an active byte which always causes the immediately following byte, and only that byte, to print in typewriter font? I want this to happen not only if the immediately following byte has catcode 11 or 12, but also if it is active or one of the special TeX bytes #$\{}^_. Thus AAA+\AAA+{AAA+}AAA++AAA is supposed to print as AAA\AAA{AAA}AAA+AAA with \ and { and } and + in typewriter font and the A's in the default font. Also, I want this to work even inside constructions such as \centerline. In other words I want to be able to do things like \centerline{AAA+\AAA+{AAA+}AAA++AAA} [ The above problem statement is actually a little different from the original. Where now I am asking for typewriter font, the original problem statement asked for Italic. I meant Italic to be a generic example of a font other than the default font, but this choice was confusing, because there is no Italic \ or { or }. Typewriter font illustrates my point better, because it does contain all the special TeX characters. Sorry for any confusion! ] This problem is not just a brain teaser. It is a condensed version of a problem that arose in a real application, namely my port of Thomas Ridgeway's Poor Man Chinese TeX macros from GB character codes to BIG-5 character codes. Thanks to all the help from the wizards on comp.text.tex, I was able to simplify and improve my macros considerably. The rest of this posting is a summary of known solutions to my problem. My own solution was a clumsy hack that involved manipulating huge numbers of catcodes. It worked well in straight text but failed completely inside a \centerline argument. It was sketched in my original posting and is not worth reproducing here. Many people suggested the elegant solution \catcode`+=13 \def+#1{{\tt#1}} but this fails if the byte immediately following + is { or } or \. (One of my postings was insufficiently clear on this point.) The following works much better: \def+{\begingroup\catcode`\{=12 \catcode`\}=12 \catcode`\\=12 \pickone} \def\pickone#1{{\tt\char`#1}\endgroup} [ This combines ideas from Raymond Chen (raymond@math.berkeley.edu) and Victor Eijkhout (eijkhout@csrd.uiuc.edu). Many thanks to those two wizards. ] This works perfectly in straight text. It also works inside arguments to macros such as \centerline, provided the byte immediately following + is not { or } or \. I have rewritten my Chinese TeX application to use this approach. Several people suggested another solution: \catcode`+=13 \def+{\expandafter\bbbb\string} \def\bbbb#1{{\tt#1}} [ This was suggested independently by Bernd Raichle (raichle@azu.informatik.uni-stuttgart.de) and Donald Arseneau (asnd@erich.triumf.ca). Thanks! ] This works almost as well as the previous solution, even inside a \centerline, and it is a little more general because it does not assume that \, {, } are the only bytes with catcode 0, 1, 2 respectively. Unfortunately, this solution fails if the byte following + is an active byte in the hexadecimal range 80 to FF. This is because, for instance, if we pretend that * is the byte with hex code AA and is active, then \string* expands as ^^aa rather than *. Unfortunately, active bytes in the 80-FF range play a key role in my Chinese TeX application, so I cannot use this idea involving \string. A number of people pointed out that it is impossible to solve my problem completely in all contexts. This is illustrated by an example such as \centerline{AAA+}AAA}. Because TeX completely tokenizes macro arguments before feeding them to the macro expander, it is difficult or impossible for TeX to avoid treating the first } as a right delimiter. (I don't know why it is necessary or desirable for TeX to completely tokenize macro arguments before feeding them to the macro expander. But I do know that this is what TeX in fact does.) In order to work around this remaining difficulty, several people suggested that I rewrite the \centerline macro to take no arguments. This can be done as follows: \def\centerline{\setbox0=\hbox\bgroup\aftergroup\finishcenterline\let\next=} \def\finishcenterline{\line{\hss\unhbox0\hss}} [ This is from Raymond Chen. ] Alternatively and more generally, we can define an \expandarg macro: \def\expandarg#1{\let\command#1% \setbox0=\hbox\bgroup\aftergroup\finishcommand\let\next=} \def\finishcommand{\command{\unhbox0}} and use \expandarg\centerline instead of \centerline as needed, or redefine \centerline as follows: \let\oldcenterline\centerline \def\centerline{\expandarg\oldcenterline} Here \centerline is only an example. We can do the same with any macro whose argument could include text containing +. [ The \expandarg macro is from Kresten Krab Thorup (krab@iesd.auc.dk). Many thanks to wizards Chen and Thorup. ] The \expandarg idea suggests the following question, which I throw open for discussion. Is it possible to change the global behavior of TeX so that it starts feeding macro arguments to the macro expander before completely tokenizing them? In other words, I would like TeX to process macro arguments the same way it processes straight text. Assuming this were possible, would it break any standard TeX constructions? I DO NOT promise to summarize responses to this question. Have fun! Stephen G. Simpson simpson@math.psu.edu Department of Mathematics +1 814 863-0775 Pennsylvania State University home: +1 814 238-2274 University Park, PA 16802 ------------------------------------------------------------------------------- %%% 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.14 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.2 gftopk 2.2 %%% weave 4.2 gftype 3.1 %%% dvitype 3.2 pktype 2.3 %%% pltotf 3.4 pktogf 1.1 %%% tftopl 3.1 mft 2.0 %%% BibTeX 0.99c VFtoVP 1.2 %%% AmSTeX 1.1d VPtoVF 1.3 %%% DVIcopy 1.0 %%%\bye %%% End of TeXhax Digest ************************** -------