home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / text / tex / 13374 < prev    next >
Encoding:
Internet Message Format  |  1992-11-20  |  19.5 KB

  1. Path: sparky!uunet!dtix!darwin.sura.net!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!ames!agate!doc.ic.ac.uk!uknet!keele!nott-cs!usenet
  2. From: UKTeX-Request@tex.ac.uk
  3. Newsgroups: comp.text.tex
  4. Subject: UKTeX Digest V92 #43
  5. Message-ID: <17804.722278334@mips.nott.ac.uk>
  6. Date: 20 Nov 92 16:52:14 GMT
  7. Sender: cczdao@mips.ccc.nottingham.ac.uk
  8. Reply-To: UKTeX@tex.ac.uk
  9. Lines: 476
  10.  
  11. UKTeX Digest    Friday, 20 Nov 1992    Volume 92 : Issue 43
  12.  
  13.    ``The UKTeX Digest is brought to you as a free, unfunded and voluntary
  14.         service of the UK TeX Users Group and the UK TeX Archive.''
  15.  
  16. Today's Topics:
  17.  {Q&A}:
  18.                              Bringing back hanging
  19.                              re: Bring back hanging
  20.                              RE: Bring back hanging
  21.                              Re: Bring Back hanging
  22.                   TeX variable scope rules (was: another gem)
  23.                Double-sided printing and page-imposition in LaTeX
  24.  
  25. Administrivia:
  26.     Moderators:     Peter Abbott (Aston University) and
  27.                     David Osborne (University of Nottingham)
  28.     Contributions:  UKTeX@uk.ac.tex
  29.     Administration, subscription and unsubscription requests:
  30.                     UKTeX-request@uk.ac.tex
  31.  
  32. ------------------------------------------------------------
  33.  
  34. Date:    Sun, 15 Nov 92 10:56:38 -0500
  35. From:    Jerry Leichter <leichter%com.lrw@uk.ac.aston>
  36. Subject: Bringing back hanging
  37.  
  38. In a recent UKTeX, R.A. Reese has two questions.
  39.  
  40. First, he attempts to make every paragraph a hanging paragraph by executing
  41.  
  42.         \everypar{\hang}
  43.  
  44. This works fine until he starts a paragraph with a font shift:
  45.  
  46.         This paragraph has hanging indentation.
  47.  
  48.         {\bf This} paragraph should be similar to the first, but it is not;
  49.         it does not have hanging indentation.
  50.  
  51. What is going on is quite simple.  Let's look at the first paragraph.  TeX is
  52. in vertical mode when it reaches the "T".  Since a <letter> is "incompatible
  53. with vertical mode" (ref. the TeXbook, page 283).  TeX responds by effectively
  54. performing an \indent command before returning to deal with the "T".  The
  55. \indent command (a) inserts \parskip glue (in most cases, see page 282 for
  56. details); (b) enters unrestricted horizontal mode; (c) adds an empty hbox of
  57. width \parindent to the new horizonal list; (d) inserts the \everypar tokens
  58. into the input stream, where they will be seen before the still-waiting "T";
  59. (e) exercises the page builder.  When the page builder is finished, the tokens
  60. from \everypar are read, in this case setting \hangindent.  Eventually, we
  61. reach the end of the paragraph.  It is set indented (since \hangindent is set)
  62. and \hangindent is reset to 0pt.
  63.  
  64. Now consider the second paragraph.  We start out in vertical mode again.  The
  65. first thing we see is "{".  TeX starts a new group, and remains in vertical
  66. mode.  Next, we see \bf.  TeX expands this, changing the current font; it is
  67. still in vertical mode, since nothing in the expansion of \bf should cause
  68. it to change.  Finally, it sees the "T", and goes through the same five steps
  69. as previously.  \hangindent is set as before, and "This" is typeset in bold-
  70. face.  Now we reach "}".  This ends the group.  As part of ending the group,
  71. the previous value of \hangindent (0pt) is restored.  When we eventually
  72. reach the end of the paragraph, the value of \hangindent set by the \everypar
  73. is long gone, and it is the value THEN that determines how the paragraph
  74. should be typeset.
  75.  
  76. This kind of thing is a recurring problem with the \everypar mechanism:  It's
  77. always essential to remember that the \everypar tokens may be interpreted
  78. within a group - in fact, within arbitrarily many groups, since the input
  79. could have been:
  80.  
  81.         {{{\bf This}}} is strange by legal.
  82.  
  83. One way to get around this is to use \global\hang.  (This works because \hang
  84. is just \hangindent\parindent, so the \global applies to the stuff "inside"
  85. with no problem.  Admittedly, as a general practice such reliance on what a
  86. macro translates to is a bad idea - much better to use:
  87.  
  88.         \everypar{\global\hangindent\parindent}
  89.  
  90. which works as well but is independent of the innards of \hang.)
  91.  
  92. The only other fix requires an explicit \indent or \noindent at the beginning
  93. of paragraphs that start with "{".
  94.  
  95. In a second question (which, as we've seen, is actually closely related to the
  96. first), Mr. Reese comments that:
  97.  
  98.         ...Scoping is fine but TeX's rules are not the same as proper scoping
  99.         in an algorithmic language. If you "declare a variable" it stays in
  100.         scope for all inferior blocks unless the name has been reused. TeX is
  101.         following the Fortran tradition here where variables are implicitly
  102.         local unless made global...
  103.  
  104. Well, no.  There have been two general kinds of scoping rules used in program-
  105. ming languages, static (lexical) scoping and dynamic scoping.  ALGOL 60 and
  106. languages derived from it use lexical scoping.  LISP, APL, and SNOBOL are
  107. examples of languages that use dynamic scoping.  Lexical scoping has tradi-
  108. tionally been associated with compilers.  Dynamic scoping has traditionally
  109. been associated with interpreters.  (This distinction has broken down to a
  110. degree with lexically-scoped LISP's, such as SCHEME.)
  111.  
  112. Macro languages are almost always dynamically scoped.  In addition, they often
  113. do not require variables to be declared before they are used.  To accomodate
  114. this, many use a variation on dynamic scoping in which a new scope for a
  115. variable is begun when it is re-defined within a group.  This allows both
  116. for nesting of definitions and for the import of definitions from surrounding
  117. groups.
  118.  
  119. TeX follows this approach.  See any good programming language text for a
  120. discussion of the tradeoffs between static and dynamic scoping; the choice is
  121. by no means black and white.  For a language like C, where the definitions of
  122. functions cannot be nested in other functions, a simple stack is sufficient to
  123. implement static scoping.  For PASCAL, one has to be a bit more clever.  For
  124. SCHEME, where functions can be defined on the fly, static scoping requires
  125. the use of closures, a complex matter.  Stacks alone won't do.  In TeX, where
  126. macros can define other macros, the same would apply.  Further, pure static
  127. scoping, even after buying in to closures, would have made some other things
  128. we are used to doing in TeX quite difficult.
  129.  
  130. Knuth's choice of context style was not arbitrary, nor was it "wrong".  It
  131. simply made a different set of tradeoffs than others might want to make.  On
  132. the other hand, knowing the level of Knuth's work, it made the tradeoffs
  133. knowingly.
  134.                                                         -- Jerry
  135.  
  136. ------------------------------
  137.  
  138. Date:    16 Nov 92 13:58:00 +0000
  139. From:    M.Piff@uk.ac.sheffield
  140. Subject: re: Bring back hanging
  141.  
  142. R A Reese asks:
  143.  
  144.    % Question - what causes the following command to not operate?
  145.    % From a quick reading of the TeXbook, I'd call it a bug - there's no
  146.    % reason for the begin-group to affect the change to horizontal mode.
  147.  
  148.    \everypar{\hang}
  149.  
  150.    This paragraph is a hanging paragraph. Each line after the first is
  151.    set in by the parindent. Since I didn't change the default, so is the
  152.    first line. In other words it's a rectangle.
  153.  
  154.    {\bf This} paragraph should be similar to the first, but it is not.
  155.    For some reason I don't understand, starting the paragraph with a
  156.    brace has stopped the everypar working. So this comes out as a
  157.    standard paragraph, first line indented, rest flush with left margin.
  158.    If I just put the font-change command at the start, not in a group,
  159.    the paragraph hangs again.
  160.  
  161.    This {\bf paragraph} does come out hanging, similar to the first. So
  162.    it is the group character at the point of switching to
  163.    horizontal mode that causes the problem.  Can anyone explain?
  164.  
  165.    \bye
  166.  
  167.  
  168. Consider the following:
  169.  
  170.  
  171. \everypar{\hang}\tracingrestores=10
  172. {a}
  173. \bye
  174.  
  175. \TeX\ only enters horizontal mode when it reads the ``a'', within the group.
  176. Thus "\hang" is only executed within that group, and its effect is
  177. forgotten by the time \TeX\ breaks the paragraph up into lines.
  178.  
  179. Look at the LOG file:
  180.  
  181. This is emTeX, Version 3.14 [3c-beta5] (preloaded format=plain 92.3.30)  16 NOV
  182.  1992 13:49
  183. **reese
  184. (reese.tex{restoring \hangindent=0.0pt}     %%%<--------------------
  185. {restoring \dimen0=0.0pt}
  186. {restoring \boxmaxdepth=16383.99998pt}
  187. {restoring current font=\tenrm}
  188. {restoring \baselineskip=12.0pt}
  189.  [1] )
  190. Output written on reese.dvi (1 page, 208 bytes).
  191.  
  192. I expect some would say this is a silly design decision in \TeX.
  193.  
  194. Mike Piff
  195. Dr M J Piff                        JANET:
  196. Department of Pure Mathematics     pm1mjp%hicks1.shef@sunc.shef.ac.uk
  197. University of Sheffield            M.Piff@pa.shef.ac.uk
  198. Hicks Building
  199. Hounsfield Road
  200. SHEFFIELD S3 7RH                   Telephone: SHEFFIELD (0742) 768555
  201. England                                       Ext. 4431
  202.  
  203. ------------------------------
  204.  
  205. Date:    Mon, 16 Nov 92 14:35:40 +0000
  206. From:    Philip Taylor (RHBNC) <P.Taylor@uk.ac.rhbnc.vax>
  207. Subject: RE: Bring back hanging
  208.  
  209. >% Question - what causes the following command to not operate?
  210. >% From a quick reading of the TeXbook, I'd call it a bug - there's no
  211. >% reason for the begin-group to affect the change to horizontal mode.
  212. >\everypar{\hang}
  213.  
  214. <etc>
  215.  
  216. >{\bf This} paragraph should be similar to the first, but it is not.
  217. >For some reason I don't understand, starting the paragraph with a
  218. >brace has stopped the everypar working. So this comes out as a
  219. >standard paragraph, first line indented, rest flush with left margin.
  220. >If I just put the font-change command at the start, not in a group,
  221. >the paragraph hangs again.
  222.  
  223. On the contrary, \everypar is working perfectly.  It is setting
  224. the values associated with \hang, and it is setting them within the
  225. group started by the open brace of {\bf ...}.  On leaving the group,
  226. the values are restored to those of the status ante bellum.  
  227. When the paragraph finally ends, and is set according to its current
  228. parameters, TeX has no recollection whatsoever that, for a short period,
  229. those values had changed.
  230.  
  231.                                         Philip Taylor, RHBNC.
  232.  
  233. ------------------------------
  234.  
  235. Date:    Mon, 16 Nov 92 14:00:48 +0000
  236. From:    Jeremy Henty <jch@upper.ist.co.uk>
  237. Subject: Re: Bring Back hanging
  238.  
  239.  
  240. R.A.Reese writes: 
  241.  
  242. |% Question - what causes the following command to not operate?
  243. |% From a quick reading of the TeXbook, I'd call it a bug - there's no
  244. |% reason for the begin-group to affect the change to horizontal mode.
  245. |
  246. |\everypar{\hang}
  247. |
  248. |This paragraph is a hanging paragraph. Each line after the first is
  249. |set in by the parindent. Since I didn't change the default, so is the
  250. |first line. In other words it's a rectangle.
  251. |
  252. |{\bf This} paragraph should be similar to the first, but it is not.
  253. |For some reason I don't understand, starting the paragraph with a
  254. |brace has stopped the everypar working. So this comes out as a
  255. |standard paragraph, first line indented, rest flush with left margin.
  256. |If I just put the font-change command at the start, not in a group,
  257. |the paragraph hangs again.
  258. |
  259. |This {\bf paragraph} does come out hanging, similar to the first. So
  260. |it is the group character at the point of switching to
  261. |horizontal mode that causes the problem.  Can anyone explain?
  262. |
  263. |\bye
  264. |
  265. |(R.) Allan Reese
  266.  
  267. This is not a bug, what is happening is this:
  268.  
  269.         When processing ordinary text, TeX does not enter horizontal mode 
  270.         until it encounters a letter. In your troublesome paragraph, 
  271.         the first letter is inside a group, so the \everypar instruction 
  272.         is executed *inside* this group. When the group ends, all local 
  273.         assignments are undone, and the \everypar instruction is forgotten. 
  274.  
  275. The solution is to type 
  276.  
  277.         \indent {\bf This} paragraph ...
  278.  
  279. because \indent forces TeX into horizontal mode (and gets the \everypar 
  280. instruction executed) *outside* the group. 
  281.  
  282. Jeremy C. Henty
  283.  
  284. ------------------------------
  285.  
  286. Date:    Mon, 16 Nov 92 16:54:40 +0000
  287. From:    SYSMGR@uk.ac.kcl.ph.ipg
  288. Subject: TeX variable scope rules (was: another gem)
  289.  
  290. Allan Reese wrote to point out that when
  291.  
  292. > you "declare a variable" it stays in scope for all inferior blocks unless
  293. > the name has been reused. 
  294.  
  295. TeX's variable scope rules are shared by several other interpreted languages,
  296. such as DCL (the command language on the VAX I'm using). This possibility arise
  297. s
  298. naturally whenever one has a language in which declarations are executable
  299. statements that can be conditionally executed or not at various levels of
  300. recursion. It can't happen in a compiled language like C, because a program
  301. can't choose to conditionally execute a declaration. 
  302.  
  303. Is it worth discussing?  Well, it can't be changed, because if it was the
  304. result wouldn't be TeX any more. If its a common gotcha, then doubtless
  305. raising it will help someone.
  306.  
  307.         Yours,
  308.                 Nigel Arnot
  309.  
  310.                 NRA%ipg.ph.kcl.ac.uk@nsfnet-relay.ac.uk   (internet)
  311.                 NRA%uk.ac.kcl.ph.ipg@ukacrl.bitnet        (bitnet)
  312.  
  313. ------------------------------
  314.  
  315. Date:    Thu, 19 Nov 92 11:33:05 +0000
  316. From:    vdm@le.ac.uk
  317. Subject: Double-sided printing and page-imposition in LaTeX
  318.  
  319. A query for (La)TeX experts:
  320.  
  321. Does anyone have modifications to the standard LateX twoside.sty macros for
  322. printing documents on a laser printer that does double sided printing. The
  323. problem is as follows: the document is large and is printed using
  324. \includeonly{...}. With twosided.sty LaTeX generates the extra pages needed
  325. to finish off the previous chapter correctly so that the next chapter
  326. starts correctly on an odd page (which is what I want). However the extra
  327. page goes on the front surface when printing out the chapter and the odd
  328. page goes on the back WHICH IS NOT WHAT I WANT. For those supplying solutions
  329.  
  330. 1. I don't wish to fiddle with DVIDVI DVIPS etc - I feel LaTeX should do
  331.    the work.
  332.  
  333. 2. The document cannot be printed at one go (each chapter uses a different
  334.    set of incompatible macros).
  335.  
  336. A solution which solves (2) would also be interesting/ welcome!.
  337.  
  338. A futher little challenge: I wish to print out a double sided A5 booklet
  339. using the above laser printer - the idea is to print 4 A5 pages per
  340. A4 sheet and just fold the result in half. There are two problems:
  341.  
  342. 1. How can dvidvi be made to produce the right re-arrangement.
  343.  
  344. 2. The laser printer prints the back two pages  on an A4 sheet upside down!
  345.  
  346. Please note that the printer is remote and belongs to the Computer Center
  347. so cannot be fiddled with!
  348.  
  349. Many thanks in advance to suppliers of solutions.
  350.  
  351.  
  352. From:  Derek Andrews
  353. Email: JANET : derek@mcs.le.ac.uk
  354. Smail: Department of Mathematics and Computer Science
  355.        University of Leicester
  356.        University Road
  357.        Leicester
  358.        LE1 7RH
  359.        UK
  360. Tel:   (+44) 533 523401
  361. Fax:   (+44) 533 523604
  362.  
  363. ------------------------------
  364.                                         
  365.                        UK TeX ARCHIVE at ASTON UNIVERSITY
  366.                               >>>  UK.AC.TEX  <<<
  367.                                         
  368.                   *** Interactive and file transfer access ***
  369.            JANET: Host: uk.ac.tex, Username: public, Password: public
  370.                               (DTE 000020120091)
  371.                     Internet: host tex.ac.uk [134.151.40.18]
  372.                For telnet access, login: public, password: public
  373.       For anonymous ftp, login: anonymous, password: <your-e-mail-address>
  374.                                         
  375.                               *** Mail server ***
  376.                     Send mail to TeXserver@uk.ac.tex (JANET)
  377.                    or TeXserver@tex.ac.uk (rest of the world)
  378.                    with message body containing the word HELP
  379.                                         
  380. \section FILES OF INTEREST
  381.  
  382.     [tex-archive]00readme.txt
  383.     [tex-archive]00directory.list        [tex-archive]00directory.size
  384.     [tex-archive]00directory_dates.list  [tex-archive]00last30days.files
  385.     [tex-archive.doc]TeX-FAQ.txt    (Frequently Asked Questions list)
  386.     [tex-archive.doc]FAQ-Supplement-*.txt    (FAQ supplement)
  387.  
  388. \section DIGESTS
  389.  
  390.     This year's UKTeX back issues are stored in the archive in directory
  391.       [tex-archive.digests.uktex.92]
  392.     This year's TeXhax back issues are stored in the archive in directory
  393.       [tex-archive.digests.texhax.92]
  394.       Latest TeXhax: V92 #20
  395.     TeXMaG back issues are stored in the archive in directory
  396.       [tex-archive.digests.tex-mag]
  397.       Latest TeXMaG: V5N3
  398.  
  399. \section MEDIA DISTRIBUTIONS
  400.     Postal addresses are given below.
  401.  
  402. \subsection Washington Unix TeX distribution tape
  403.     Latest copy of May/June 1991 contains:
  404.     TeX 3.14, LaTeX 2.09, Metafont 2.7, plus many utilities
  405.     suitable for Unix 4.2/4.3BSD & System V
  406.     tar format, 1600bpi, blockfactor 20, 1 file (36Mb)
  407.  
  408.     Copies available on:
  409.        One 2400ft 0.5" tape sent to Aston with return labels AND return postage
  410.    OR
  411.        One Quarter-Inch Cartridge, QIC-120 or QIC-150 format (DC600A or DC6150)
  412.        sent with envelope AND stamps for return postage to Nottingham
  413.          (Due to currency exchange, this service is offered only within the UK)
  414.  
  415. \subsection VMS tapes
  416.     VMS backup of the archive requires three 2400ft tapes at 6250bpi.
  417.     VMS backup of TeX 2.991 plus PSprint requires one 2400ft tape.
  418.  
  419. \subsection Exabyte 8mm tapes
  420.     Same contents available as 0.5" tapes.
  421.     Following tape types available: SONY Video 8 cassette P5 90MP,
  422.     MAXELL Video 8 cassette P5-90, TDK Video 8 cassette P5-90MPB
  423.  
  424. \section TeX IMPLEMENTATIONS FOR SMALL COMPUTERS
  425.  
  426. \subsection OzTeX V1.4 (for Macintosh)
  427.     Send 7 UNFORMATTED 800K disks to Aston with return postage.
  428.  
  429. \subsection emTeX (for OS/2, PC-DOS and MS-DOS)
  430.     The complete package (3.5" High density disk format ONLY)
  431.     is available from Aston at a cost of 15 pounds sterling,
  432.     including documentation, disks, post and packing (DO NOT SEND DISKS):
  433.       specify Set A.
  434.     Additional utilities including DVIPS, 5 pounds sterling:  specify Set B.
  435.     FLI files for FX, 5 pounds sterling:  specify Set C.
  436.     FLI files for P6M, 5 pounds sterling:  specify Set D.
  437.  
  438.     For general enquiries, and a free catalogue detailing other disk 
  439.     formats, precompiled fonts and lots of other goodies, contact:
  440.     Eigen PD Software, P.O. Box 722, Swindon SN2 6YB  (tel: 0793-611270)
  441.     (JANET e-mail address: kellett@uk.ac.cran.rmcs)
  442.  
  443. \subsection TeX for the Atari ST
  444.     All enquiries for disks etc. should be directed to:
  445.     The South West Software Library, P.O. Box 562, Wimborne, Dorset BH21 2YD
  446.     (JANET e-mail address: mdryden@uk.co.compulink.cix)
  447.  
  448. \section POSTAGE RATES
  449.     All prices in Pounds Sterling.
  450.     For Aston orders, make cheques payable to Aston University.
  451.  
  452.     0.5" tapes: UK: 2.50 (one tape),  5.00 (two tapes).
  453.             Europe: 5.00 (one tape),  9.00 (two tapes).
  454.             Outside Europe please enquire.
  455.     8mm tapes:
  456.             UK: 1.00,  Europe: 2.00.
  457.     Quarter-inch cartridges:
  458.             UK: 1.00,  Europe: 2.00.
  459.     Diskettes:
  460.     Quantity/Size   Europe   World    UK 1st   UK 2nd
  461.       18/3.5"        3.10     5.10     1.40     1.10
  462.       11/3.5"        1.80     2.90     0.80     0.65
  463.       18/5.25"       1.20     2.00     0.60     0.50
  464.       11/5.25"       0.80     1.30     0.50     0.35
  465.  
  466. \section POSTAL ADDRESSES
  467.     Please include SELF-ADDRESSED ADHESIVE LABELS for return postage.
  468.  
  469.     Peter Abbott
  470.     Information Systems, Aston University, Aston Triangle, Birmingham B4 7ET
  471.  
  472.     David Osborne
  473.     Cripps Computing Centre, University of Nottingham, Nottingham NG7 2RD
  474.     (for Quarter-inch cartridges ONLY -- must include stamps for return postage)
  475.  
  476. \section UK TeX USERS GROUP
  477.  
  478.     For details, contact:
  479.     David Penfold, Edgerton Publishing Services,
  480.     30 Edgerton Road, Edgerton, Huddersfield HD3 3AD (tel: 0484 519462)
  481.  or E McNeil-Sinclair, fax: 0272 236169
  482. \bye
  483.  
  484. End of UKTeX Digest [Volume 92 Issue 43]
  485. ****************************************
  486.