groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Groff] Unexpected String Variable Interpolation in MS Document


From: Andrew J. Piziali
Subject: [Groff] Unexpected String Variable Interpolation in MS Document
Date: Wed, 3 Mar 2004 17:54:00 -0600 (CST)

   I am trying to figure the proper number of escapes required to store
the section number of a numbered heading in an MS document in a file to
resolve a forward reference.  When the document is formatted on the
first pass, I store the definition of a string variable in a file.  The
string variable is supposed to capture the current value of \*(SN, the
MS section number.  When the document is formatted on the second pass,
the file is sourced, defining the string variable with the value
captured earlier.

   The problem is while formatting the MS document using:

    $ groff -rFormatterPass=2 -e -p -t -ms -Tps -U ...

groff displays:

    ...:352: warning: escape character ignored before `7'

Line 352 of the input file is:

    ... analysis is the subject of section \*[CASection].

The string variable CASection is defined and used as follows in the
document:

    :
    .ie \n[FormatterPass]=1 \{\#       On the first pass, ...
    .  open SecondPassFile /tmp/book
    .  ds CASection 0
    .\}
    .el .if \n[FormatterPass]=2 \{\#   On the second pass, ...
    .  so /tmp/book
    .  sy rm -f /tmp/book
    .\}
    :
    :
    ... analysis is the subject of section \*[CASection].
    :
    :
    .NH 2
    Section Title
    .if \n[FormatterPass]=1 \{\
    .  write SecondPassFile ".ds CASection \\\*(SN
    .\}
    .PP
    :
    :

I empirically derived the three backslashes on the .write request and,
although the proper section number is stored in /tmp/book, it is
prefaced by a backslash:

    $ cat /tmp/book
    .ds CovAnalysisSectNumber \7.5.

If I remove one backslash on the .write request:

    .write SecondPassFile ".ds CASection \\*(SN

\*(SN is not interpolated in the string variable definition in
/tmp/book:

    .ds CovAnalysisSectNumber \*(SN

What am I doing wrong?

Thank you.



-- 
                                                        |
address@hidden                       ________------+------________
                                                       / \
                                                      *---*


reply via email to

[Prev in Thread] Current Thread [Next in Thread]