[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference vaxuum::document_ft

Title:DOCUMENT T1.0
Notice:**New notesfile (DOCUMENT.NOTE) now available (see note 897)**
Moderator:CLOSET::ADLER
Created:Mon Feb 09 1987
Last Modified:Thu Oct 31 1991
Last Successful Update:Fri Jun 06 1997
Number of topics:897
Total number of notes:4397

848.0. "Simulating LaTeX's "\newtheorem" feature" by CASEE::CLARK (Ward Clark) Tue Aug 25 1987 07:23

    I'm converting a document from LaTeX to DOCUMENT.  This document makes
    extensive use of LaTeX's "\newtheorem" feature that produces
    automatically numbered entries that look something like this:

	Axiom 3.1  All axioms are very dull.

	Axiom 3.2  Some axioms are duller than others.

    The interesting aspects are these:

	-  The "3" is the current section (or chapter) number.
	-  The ".n" is automatically incremented, restarting at 1 for
	   each section (or chapter).
	-  "Axiom 3.n" begins a new paragraph and is bolded.
	-  The theorem text is italicized.

    How can I achieve the same results using VAX DOCUMENT?

    I'm currently hard-coding both the formatting and numbering, but this
    is proving to be very tedious, especially when revisions require
    renumbering a bunch of entries.

    I'm assuming that I need to do some document designing and/or TeX
    wizardry, but a quick scan of the Doctype Designer's Guide doesn't seem
    to provide any pointers.

    -- Ward
T.RTitleUserPersonal
Name
DateLines
848.1Starter kitCLOSET::ANKLAMTue Aug 25 1987 10:4776
    
    You need to design some tags. Most of the information you need is
    in the Tag Designer's Guide, which is currently in a draft review
    stage. (There is a pointer to this somewhere earlier in this NOTES
    file.)
    
    The following will give you the idea. Note I don't guarantee that
    it's fully debugged, nor do I guarantee support for it. I did it
    merely because I was interested to see how many of the concepts
    needed to do this sort of thing are documented. In fact, the only
    information used in the following that is not in the current draft
    of the designer's guide is the reference to <_pagecap_prefix>, an
    internal tag (which will be documented).
    <set>(retain_spacing\false)
<comment>******************************
* File: AXIOM.GDX
*
* Definitions for automatically numbered Axioms
*
* This file must be included via /SYMBOLS on the command line. It
* must not be included via <INCLUDE> or /INCLUDE
*
* All names used internally in these definitions are prefixed with 
* 'lcl_' to ensure that there will be no conflict with SDML internal
* names.
******************************<endcomment>

<define>(AXIOM\|<eol>

   <comment>(* Increment counter *)<eol>
  <COUNTER>(LCL_AXIOM_NUMBER\+1)<eol>

   <comment>(* Text 'Axiom' followed by chapter/appendix number/letter.
               If there is no chapter or appendix, only the current
               number is output. *)

  <p>Axiom <ifdef>(_pagecap_prefix\|<_pagecap_prefix>.&\)<eol>
       <counter>(lcl_axiom_number)<eol>

       tietie<comment>(Leaves 2 fixed spaces; preserve CTRL/X characters)<EOL>

        <comment>(* Arg 1 is the text specified in the argument to the
                    <AXIOM> tag. *)<eol>
      <EMPHASIS>($1)&)

<comment>(* To Reset the numbers at the beginning of each chapter,
            you need to copy the <chapter> tag and add the change. *)

<copy_tag>(CHAPTER\lcl_chapter_for_axioms)

<define>(CHAPTER\|<eol>
  <comment>(* Pass 2, invoke copied chapter tag with its arguments, then
              reset the axiom counter  *)<eol>
  
    <lcl_chapter_for_axioms>($1\$2)<eol>
    <counter>(lcl_axiom_number\=0)&\\\\\|
  
  <comment>(* Pass 1, just invoke copied appendix tag. *)<eol>
    <lcl_chapter_for_axioms>($1\$2)&)

<comment>(* Do the same for <APPENDIX> *)
                                                                          
<copy_tag>(APPENDIX\lcl_appendix_for_axioms)

<define>(APPENDIX\|<eol>
  <comment>(* Pass 2 *)<eol>

    <lcl_appendix_for_axioms>($1\$2)<eol>
    <counter>(lcl_axiom_number\=0)&\\\\\|
  
  <comment>(* Pass 1 *)<eol>
    <lcl_appendix_for_axioms>($1\$2)&)


<set>(retain_spacing/true)

848.2more funVAXUUM::KOHLBRENNERTue Aug 25 1987 11:5412
    Patti's tag definition for <axiom>(text) takes only one argument,
    which is the theorem text.  If you have a lot of theorems and you
    want to discuss them, then you will want to add a theorem symbol
    as the second argument and be able to make reference to it in the
    discussion:
    
     <axiom>(All axioms are dull\all_dull)
    
    ... as shown in <reference>(all_dull). ...
    
    That part is left as an exercise for the reader of the Tag
    Designer's Manual...          ;-)
848.3Pointer to the Tag Designer's Guide rough draft.VAXUUM::CORMANTue Aug 25 1987 13:342
    See note 780.
    -Barbara
848.4So close and yet so farCASEE::CLARKWard ClarkWed Sep 02 1987 10:0839
    The <AXIOM> definition that Patti supplied in .1 requires that the
    axiom counter be reset at the beginning of each chapter or appendix.
    This is done by redefining the <CHAPTER> and <APPENDIX> tags as
    follows:

	<copy_tag>(APPENDIX\lcl_appendix_for_axioms)

	<define>(APPENDIX\|<eol>
	  <comment>(* Pass 2 *)<eol>

	    <lcl_appendix_for_axioms>($1\$2)<eol>
	    <counter>(lcl_axiom_number\=0)&\\\\\|
	  
	  <comment>(* Pass 1 *)<eol>
	    <lcl_appendix_for_axioms>($1\$2)&)

    Unfortunately, this definition has a fatal flaw -- it requires that
    every use of the <APPENDIX> tag include a symbol name (optional 2nd
    parameter).  Otherwise, pass 1 of tag processing complains that "" is
    not a valid symbol name, the same error that the following tag
    generates:

	<HEAD2>(This is a heading\)

    After a number of *hours* of experimentation with various combinations
    of the following constructs, I was not able to get a redefinition that
    had a optional 2nd parameter: 

	<COMPARE>
	<COMPARE_NUMERIC>
	<IFVAL>
	$#, $2

    As best I understand it, using these tags and arguments requires the
    "|" and "&" quoting characters, resulting in $1 and $2 not being
    expanded.  Thus, <DEFINE_SYMBOL> winds up complaining that "$2" is not
    a valid symbol name (which is true).

    -- Ward