TeXhax Digest Tuesday, April 26, 1988 Volume 88 : Issue 41 [SCORE.STANFORD.EDU]TEXHAX41.88 Editor: Malcolm Brown Today's Topics: Immoderate notes (Unix-) TeX redistribution (TeXhax Digest V88 #39) TeX mystery APA reference style TFM checksums may not be a TeX-to-C problem. (TeXhax Digest V88 #39) standard fonts Crudetype on Unix How wide is a period? Reserving two blank pages? Re: dvi-to-text and printers C preprocessor for BibTeX style files LaTeX Notes (Re: TeXhax Digest V88 #40) ---------------------------------------------------------------------- Date: 26 April 88 From: Malcolm Subject: Immoderate notes %%% Well, the disk crash that Score suffered was exacerbated by an %%% additional failure in the tape backup system. TeXhax's files %%% were involved. It seems that they restored the files from %%% April 18th backup files. This caused some TeXhax digests to %%% disappear (as some of you have already noticed) and submissions %%% were lost. %%% I have now sent out all the submissions that were left after %%% the disaster. If you sent a submission but haven't seen it in %%% this or previous digests, you should assume it was lost in the mess %%% and re-send it. %%% On another front, I have finally begun the forced migration to %%% TEX-L of all BITNET folks on the Score list. Again, you'll know %%% that this has happened to you because (1) you'll start getting %%% duplicates of the digests (one from Score and one from your local %%% list server) and (2) you'll receive a note in the mail telling %%% you you've been subscribed. When this happens, please send a %%% note to texhax-request@score.stanford.edu and I'll drop you from %%% the Score list. ------------------------------ Date: Sun, 24 Apr 88 11:35:42 PDT From: mackay@june.cs.washington.edu (Pierre MacKay) Subject: (Unix-) TeX redistribution (TeXhax Digest V88 #39) THERE ARE NO LICENSING RESTRICTIONS ON ANY PART OF THE UNIX TeX DISTRIBUTION. Copyright notices, where they exist, are intended to protect the integrity of the software under any given program name. They are not intended to restrict the redistribution of genuine copies of the software. The file ./tex82/COPYING.POLICY goes out with every UnixTeX distribution, and makes it clear that redistribution is always permitted, so long as it is redistribution of the COMPLETE distribution. The caveat there is to protect us from what in fact happens all the time. Partial distributions are passed around with missing essential parts, and we have to field requests (99 percent worded kindly, one percent worded as if we had somehow failed in a contractual obligation) for patch upgrades. Partial upgrades take far more time than full distribution copies. Owing to the way in which elements of the Unix TeX distribution were gathered in we can not word things quite as elegantly as the Free Software Foundation does, but our principle is the same. Free Public Domain Software means just that, and the UnixTeX distribution is Free Public Domain Software, unrectricted by any license restrictions. I would call general attention to the fact that in TeXhax I recently asked the Europeans to consider arranging to do some free redistribution rather than using translantic bandwidth for individual copies of parts of the TeX system. (FOOTNOTE: There may be some distant memory of the time when the Unix TeX distribution required a Berkeley Unix license. That was because we had to distribute parts of Berkeley BSD source code to make TeX work on BSD4.1 systems. That code has long disappeared from the distribution, and since then I have made it an absolute rule to accept nothing into the distribution unless it may be redistributed free of any licensing restriction whatsoever.) Email: mackay@june.cs.washington.edu Pierre A. MacKay Smail: Northwest Computing Support Group TUG Site Coordinator for Lewis Hall, Mail Stop DW10 Unix-flavored TeX University of Washington Seattle, WA 98195 (206) 543-6259 ------------------------------ Date: Sun, 24 Apr 88 16:41 EDT From: Robert Messer Subject: TeX mystery Can anyone explain the problem with the following three lines of TeX code? The log file shows that TeX tries to define an if-condition \aifb and generates an error because the control sequence does not begin with \if. Putting a space after \openout0=a clears up the problem. Robert Messer Department of Mathematics Albion College Albion, MI 49224 RAM@ALBION.BITNET --------------------------------------------------------------------- \iftrue\openout0=a\fi \newif\ifb \end --------------------------------------------------------------------- This is TeX, VAX/VMS Version 2.0.0 (preloaded format=plain 86.5.17) 18 FEB 1988 16:29 **M1 (DISK$ACADEMIC:[RAM.TEX]M1.TEX;2 ! Use of if@ doesn't match its definition. a ifb aifb @if #1#2->csname expandafter if@ string #1 #2endcsname newif ...expandafter expandafter edef @if #1{true} {let noexpand #1=noexpand ... l.6 \newif\ifb ? x No pages of output. ------------------------------ Date: Sun, 24 Apr 88 15:55:51 CDT From: Manuel Valenzuela Subject: APA reference style Does anybody out there have a BIBTeX style file that does APA (American Psychological Association) reference style? It seems to pose an interesting problem because it requires several different forms of citation. Suppose the following three entries in the reference list are cited: 1. John Doe, 1985. 2. John Doe and Janet Peters, 1986. 3. John Doe, Janet Peters, and George Smith, 1987. Citations to 1 and 2 can appear in one of the two following forms, depending if the author(s) is (are) mentioned in the sentence where the citation occurs: 1. (Doe, 1985) or (1985) 2. (Doe & Peters, 1986) or (1986) For more than two authors, the first citation includes all the authors, the next citations use the form "et. al": 3. (Doe, Peters, & Smith, 1987) or (Doe et. al, 1987) or (1987) Multiple citations are enclosed in the same set of parenthesis and separated by semicolons: 1,2,3. (Doe, 1985; Doe & Peters 1986; Doe, Peters, & Smith, 1986) There are other rules that deal with special cases, for example multiple citation of works by the same author, multiple works by the same author in the same year, etc., but I would be glad just something that implements the basic rules. Manuel Valenzuela, ------------------------------ Date: Sun, 24 Apr 88 14:23:36 PDT From: mackay@june.cs.washington.edu (Pierre MacKay) Subject: TFM checksums may not be a TeX-to-C problem. (TeXhax Digest V88 #39) I can't be absolutely sure, of course, but here is what I think happened. Several years ago, when cm metafont files were changing fairly often, I was receiving a flood of protests about incompatible checksums as each new distribution went out. Since it was pretty clear that nothing significant in the TFMs was actually changing, I used tftopl on the entire lot, reset the checksums to 0, and remade the tfm's with pltotf. During that period a separate lot of PL files was sent out with the checksums left in. It is part of the specifications for a DVI driver that the occurrence of a xero checksum in either the DVI specification or the associated rasterized file (gf, pk, or pxl, for instance) should shut off checksum validation in the driver. If you are still using tfms delivered in those days, they should have 0 checksums and the version of TeX compiled with TeX-to-C is doing entirely the right thing. On the other hand, if you have recompiled the fonts that are preloaded in plain.tex, there is something seriously wrong, because any locally recompiled fonts should have valid checksums, not 0. If this is the case, another explanation is possible. A recent revision of web2c included an additional line in both the "dump" and the "undump" parts of the ctex.ch change file, and it may be that the absence of that line resulted in the disappearance of checksums. It is a funny case: If checksum values have disappeared,. the problem may only have been revealed by a non-standard feature in the driver, but it is still a non-standard feature. The standard feature, which shuts off checksum comparison if either is 0 can be very useful. Email: mackay@june.cs.washington.edu Pierre A. MacKay Smail: Northwest Computing Support Group TUG Site Coordinator for Lewis Hall, Mail Stop DW10 Unix-flavored TeX University of Washington Seattle, WA 98195 (206) 543-6259 ------------------------------ Subject: standard fonts Date: Sun, 24 Apr 88 18:05:16 -0400 From: Ken Yap A user wanted to print a document with cmr9 at magstep1. We didn't have it because it wasn't in the Unix TeX distribution. Now I understand that what was provided on the tape is fairly minimal and I should make more sizes. The question is, what is a standard set of CM fonts? You see, I don't want to be guilty of encouraging users to use fonts in weird magsteps that will not port to other TeX sites. In the TeXbook Knuth mentions only the small set used by plain. Should I make all the fonts in cmfonts/mf in magsteps .5 and 1 through 5? Disk space is not an issue, portability is. Thanks, Ken ------------------------------ Date: Mon, 25 Apr 88 10:11:42 BST From: Dr R M Damerell (RHBNC) Subject: Crudetype on Unix Peter King (Heriot-WattUniversity) has written a Unix Change file for Crudetype and kindly given me permission to redistribute it. He has also written a M Makefile. Once I can get myself organised I intend to submit copies to Aston and Washington and Stanford with the request that it be considered for inclusion in their distributions. Please note that this software is provided free, "AS IS" with absolutely no guarantee of performance. Anybody who uses it must do so entirely at own risk. Crudetype is a lineprinter device driver for TeX. It runs on VMS and now (th (thanks to Dr. King) Unix. You can also do things like: examine the output with EDT (needs a 132-col terminal) and send it by mail to friends. I origin- ally intended it for printers such as daisy-wheels or the so-called 'high quality dot-matrix' 24-pin printers, and inserted a lot of code that was intended to drive these, but these printers now seem to be out of fashion. It is described in more length in Tugboat vol. 7 no.3. MArk ------------------------------ Date: Mon, 25 Apr 88 10:40:24 EDT From: beck@svax.cs.cornell.edu (Micah Beck) Subject: How wide is a period? I am trying to figure out how to make a line of a given thickness using the PiCTeX macros. Since PiCTeX uses a period character ('.') to plot curves, I need to know the relationship between the design size of a font and the width of a period in that font. I guess I'm interested only in the fonts in the family defined as \*rm by LaTeX using CM fonts. /micah ------------------------------ Date: Mon, 25 Apr 88 10:48 EST From: Subject: Reserving two blank pages? A friend is writing his thesis using plain TeX. He needs to have two consecutive blank pages for figures. Any suggestions? Thanks, Jack Sharer, JWS@PSUARLC ------------------------------ Date: Mon, 25 Apr 88 10:50:22 EDT From: Ashwin Ram Subject: Re: dvi-to-text and printers > From: lantz@orc.olivetti.com > Date: Thu, 14 Apr 88 16:55:17 -0700 > > 1. Are there any (preferably good) "dvi2ps"-like converters out there for > converting dvi to formatted text -- similar to using device:file or > device:pagedfile in Scribe? If not, one wonders how you TeXophiles include > readable documents in e-mail messages. I've been wondering this myself. I've seen a couple of programs that convert TeX's .dvi files to ascii, but results from these are barely passable. It would be nice to have a way to use (La)TeX to format ascii texts, such as on-line manuals, e-mail, and ascii approximations of regular documents as you mentioned. I doubt that this can be done as a dvi filter though; to get acceptable results (e.g., as good as Scribe or tbl|nroff), one would need to get (La)TeX to format the document keeping the limitations of the output (ascii-only) in mind. Since TeX already has pretty sophisticated optimization algorithms, this shouldn't be too hard (no harder than formatting a document in \tt font). If anyone has a solution to this, I would love to hear about it too. -- Ashwin. ARPA: Ram-Ashwin@cs.yale.edu UUCP: {decvax,ucbvax,harvard,cmcl2,...}!yale!Ram-Ashwin BITNET: Ram@yalecs ------------------------------ Date: Mon, 25 Apr 88 15:56:55 PDT From: KARNEY%PPC.MFENET@NMFECC.ARPA Subject: C preprocessor for BibTeX style files I have written a C preprocessor for hacking BibTeX style files. It runs under GNU Emacs and takes care of the conditional assembly of .bst files from a single master file. (Thus it converts btxbst.doc in the standard BibTeX distribution to plain.bst, for example.) The Emacs code (190 lines) is appended, although I expect it will get diverted to a file at SCORE. I would also be happy to E-mail this code to anyone who wants it. Charles Karney Plasma Physics Laboratory Phone: +1 609 243 2607 Princeton University MFEnet: Karney@PPC.MFEnet PO Box 451 ARPAnet: Karney%PPC.MFEnet@NMFECC.ARPA Princeton, NJ 08543-0451 Bitnet: Karney%PPC.MFEnet@ANLVMS.Bitnet ------------------------------------------------------------------------ ;; A C preprocessor for use in generating BibTeX style files from a master ;; file. In addition it removes whole-line comments (with "%" in the first ;; column) and collapses multiple blank lines to a single blank line. ;; Charles Karney ;; Plasma Physics Laboratory Phone: +1 609 243 2607 ;; Princeton University MFEnet: Karney@PPC.MFEnet ;; PO Box 451 ARPAnet: Karney%PPC.MFEnet@NMFECC.ARPA ;; Princeton, NJ 08543-0451 Bitnet: Karney%PPC.MFEnet@ANLVMS.Bitnet ;; RESTRICTIONS: ;; Recognizes only a subset of C precessor symbols: ;; #include, #ifdef, #ifndef, #define, #undef, #if, #else, #endif. ;; Macro values can only be numbers. ;; Expressions are not allowed, except for !MACRO. Thus ;; "#if FOO" and "#if !FOO" work OK ;; "#if (FOO | BAR)" and "#if FOO == 4" do not work ;; Value substitution is done in a separate pass through the file at the end. ;; This means that the value substituted for a particular macro is the last ;; one defined. Thus ;; #define FOO 4 ;; FOO ;; #define FOO 10 ;; FOO ;; produces ;; 10 ;; 10 (defvar cpp-macros nil "currently defined macros") (defvar cpp-values nil "values for currently defined macros") (defun cpp (init) "Run C preprocessor on current buffer. Argument is single macro to get defined before processing begins. Recognizes a subset of C precessor symbols: #include, #ifdef, #ifndef, #define, #if, #else, #endif. Also strips out any comments starting with % in the first column." (interactive "sRun cpp defining: ") (goto-char (point-min)) (setq init (upcase init)) (let (verb) (setq cpp-macros nil cpp-values nil) (cond ((> (length init) 0) (cpp-define init 1) (insert (concat "%% #define " init " 1\n")))) (insert (concat "%% #include \"" (buffer-file-name) "\"\n")) (while (re-search-forward "^#" nil t) (save-excursion (beginning-of-line) (insert "%% ")) (setq verb (cpp-next-word)) (cond ((equal verb "include") (cpp-include (cpp-next-word))) ((equal verb "define") (cpp-define (cpp-next-word) (cpp-eval (cpp-next-word)))) ((equal verb "undef") (cpp-undef (cpp-next-word))) ((equal verb "ifdef") (cond ((zerop (cpp-ifdef (cpp-next-word))) (cpp-skip)))) ((equal verb "ifndef") (cond ((not (zerop (cpp-ifdef (cpp-next-word)))) (cpp-skip)))) ((equal verb "if") (cond ((zerop (cpp-eval (cpp-next-word))) (cpp-skip)))) ((equal verb "else") (cpp-skip)) ((equal verb "endif")) (t (error "Unknown preprocessor directive: %s" verb))))) (goto-char (point-min)) (forward-line 2) (while (re-search-forward "^%" nil t) (beginning-of-line) (delete-region (point) (progn (forward-line 1) (point)))) (goto-char (point-min)) (while (re-search-forward "\n\n\n" nil t) (backward-char 3) (delete-char 1)) (let ((macros cpp-macros) (values cpp-values) (case-fold-search nil)) (while macros (goto-char (point-min)) (forward-line 2) (while (re-search-forward (concat "\\b" (car macros) "\\b") nil t) (delete-region (match-beginning 0) (match-end 0)) (insert (int-to-string (car values)))) (setq macros (cdr macros) values (cdr values))))) (defun cpp-include (file) "Include a file" (forward-line 1) (insert-file (substring file 1 -1))) (defun cpp-eval (macro) "Returns the value of a macro" (cond ((equal (substring macro 0 1) "!") (if (eq (cpp-eval (substring macro 1 nil)) 0) 1 0)) ((or (equal (substring macro 0 1) "0") (not (eq (string-to-int macro) 0))) (string-to-int macro)) (t (let ((macros cpp-macros) (values cpp-values)) (while (not (or (null macros) (equal (car macros) macro))) (setq macros (cdr macros) values (cdr values))) (if (null macros) (error "Undefined macro %s",macro) (car values)))))) (defun cpp-define (macro value) "Make a definition" (let ((macros cpp-macros) (values cpp-values)) (while (not (or (null macros) (equal (car macros) macro))) (setq macros (cdr macros) values (cdr values))) (if (null macros) (setq cpp-macros (cons macro cpp-macros) cpp-values (cons value cpp-values)) (rplaca values value)))) (defun cpp-undef (macro) "Remove a definition" (let ((macros cpp-macros) (values cpp-values) macrosa valuesa) (cond ((null macros)) ((equal (car macros) macro) (setq cpp-macros (cdr macros) cpp-values (cdr values))) (t (setq macrosa (cdr macros) valuesa (cdr values)) (while (not (or (null macrosa) (equal (car macrosa) macro))) (setq macros macrosa values valuesa macrosa (cdr macrosa) valuesa (cdr valuesa))) (cond ((null macros)) (t (rplacd macros (cdr macrosa)) (rplacd values (cdr valuesa)))))))) (defun cpp-ifdef (macro) "Returns 1 if macro is defined, 0 otherwise" (let ((macros cpp-macros) (values cpp-values)) (while (not (or (null macros) (equal (car macros) macro))) (setq macros (cdr macros) values (cdr values))) (if (null macros) 0 1))) (defun cpp-next-word () "Return next blank-delimited word in buffer" (skip-chars-forward " \t") (buffer-substring (point) (progn (re-search-forward " \\|\t\\|$") (match-beginning 0)))) (defun cpp-skip () "Skips to next endif or else" (forward-line 1) (delete-region (point) (let ((count 1)) (while (> count 0) (re-search-forward "^#[ \t]*\\(if\\|else\\|endif\\)") (goto-char (match-beginning 1)) (cond ((looking-at "if") (setq count (1+ count))) ((looking-at "else") (if (eq count 1) (setq count 0))) ((looking-at "endif") (setq count (1- count))))) (beginning-of-line) (point))) (insert "%% ")) (defun cpp-file (name) "Run C preprocessor on physics.bst. Argument is single macro to get defined before processing begins and this is used in the filename that the results get written to." (interactive "sRun cpp-file defining: ") (let ((dir "tex$root:[bibtex]")) (find-file (concat dir "physics.bst")) (cpp name) (write-file (concat dir name ".bst")))) (defun cpp-everything () "Runs cpp on physics.bst to produce all standard styles" (interactive) (let ((macros (list "report" "aip" "nf" "cpc"))) ; The "standard styles are ; "plain" "unsrt" "abbrv" "alpha" (while macros (cpp-file (car macros)) (kill-buffer (buffer-name)) (setq macros (cdr macros))))) CC: TeXhax@Score.Stanford.EDU KARNEY ------------------------------ Date: Mon, 25 Apr 88 18:15:06 PDT From: lamport@src.dec.com (Leslie Lamport) Subject: LaTeX Notes (Re: TeXhax Digest V88 #40) Ralph Becker-Szendy asks I want the headings on the page to extend all the way over everything, text AND marginal notes. I tried: \makeatletter \def\@evenhead$\underline$\protect\hspace*$0pt-\marginparwidth \rm \thepage \hfill \sl \leftmark \def\@oddhead$\hbox$ \underline$\sl \rightmark \hfill \protect\hspace*$\marginparwidth \rm\thepage \makeatother which follows the original definition closely, except for inserting the \marginparwidth. Well, it JUST DOESN'T WORK. Why not ? Is there a solution ? There is a common tendency to think that you can write an `\hfill' and TeX will magically fill the space to just the point where you want it to be filled. An \hfill expands things to fill up the (innermost) containing box. If that containing box is not specified to be a fixed width, then the \hfill is a no-op. There are a number of ways to make a box that is the desired width, underline it, and tuck it inside another box. Careful reading of Section 5.4 should reveal them. The next problem occurs when a chapter or section heading (which appears in the page header) is too long for the page header. In the section heading it will just be broken across lines, but as it goes into a box for the page heading, it will just NOT FIT. I tried using \markright and \markboth with absolutely no effect. Is there any way of having an alternative page heading ? My dream would be something like \section[Short title]$And here comes the ... long title, where "Short title" goes into the page header, and "And here comes the .. long title" is the real section title, which is typeset at the beginning of the section, and goes into the table of contents. It seems to me that the area of page headings is implemented in a way too confusing for me (maybe it is not my fault). I don't know why \markright and/or \markboth don't work. When something doesn't work even though the manual says that it should, then the proper approach is (1) figure out what you think the manual should do on a particular input sequence. (2) find out what input sequence actually produces (3) if they disagree, go back and reread the manual carefully. (4) if you still think your interpretation in (1) was correct and you correctly implemented it in (2) and still got the same disagreement, then send a question to TeXHaX. Just stating that "I tried using \markright and \markboth with absolutely no effect" is not very helpful. Next problem: I redefined citations to be \def\@cite#1$$$#1$ so they look like an exponent. Now, how can I access the "content" of the citation in the text without using the \cite command ? If i have a \bibitem[1]$whatever Whatever et^al ... and then say "In reference^\cite$whatever the author ..." I get the exponent. But that is exactly NOT what i want in this situation, I just want the text "1" here. How do I get it ? You want two different citation commands--one to produce an exponent and another to produce a number. How about something like \newcommand{\othercite}[1]{$^{\cite{#1}}$}? Leslie Lamport ------------------------------ %%% %%% Concerning subscriptions, address changes, unsubscribing: %%% BITNET: send a one-line mail message to LISTSERV@TAMVM1.BITNET: %%% SUBSCRIBE TEX-L % to subscribe %%% %%% All others: send mail to %%% texhax-request@score.stanford.edu %%% please send a valid arpanet address!! %%% %%% %%% All submissions to: texhax@score.stanford.edu %%% %%%\bye %%% ------------------------------ End of TeXhax Digest ************************** -------