ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Joel via ntg-context <ntg-context@ntg.nl>
To: Mailing List for ConTeXt Users <ntg-context@ntg.nl>
Cc: Joel <uaru99@yahoo.com>
Subject: [NTG-context] How to print the book title and section title where \reference is located?
Date: Wed, 7 Feb 2024 03:47:33 +0000 (UTC)	[thread overview]
Message-ID: <1304025475.3496876.1707277653314@mail.yahoo.com> (raw)
In-Reply-To: <1304025475.3496876.1707277653314.ref@mail.yahoo.com>


[-- Attachment #1.1: Type: text/plain, Size: 2415 bytes --]

I have an extensive multi-book project. Each book has a nickname, like TB for "Textbook", "WB 1" for the "Workbook, Vol. 1":

TB -- 01_textbook.texWB 1 -- 03_workbook.texWB 2 -- 04_workbook.texWB 3 -- 05_workbook.tex
WB 4 -- 06_workbook.tex
TG -- 08_teachersguide.tex
I have to prove to a government agency that the content meets several requirements, so I'm giving them a simple file that says something like "Requirement A is met in TB, "Cats", p. 11" basically letting the reader know its in the textbook, section called "Cats", on p. 11. To mark the pages, I'm simply dropping in macros called "\requirementA" "\requirementB" on whichever page of whichever book demonstrates it meets the requirement, then the file will aquatically list the book, section, and page number by searching for that macro.

\define\requirementA{
    \reference[markerA]{This is a comment.}
}

\define\requirementB{
    \reference[markerB]{This is a comment.}
}

\define\requirementC{
    \reference[markerC]{This is a comment.}
}

\starttext

    \section{Cats}
        \requirementA
        \input knuth
        \requirementC
        \requirementB
    
    \pagebreak
    
    \section{Fish}
        \input knuth
        \input knuth
        \input knuth
        \input knuth
        \requirementC
        \requirementB
    
    \pagebreak
    
    \section{Frogs}
        \input knuth
        \requirementB
    
    \pagebreak
    
    \section{Markers}
    
        \startitemize
            \item Requirement A is met \at{page}[markerA].
            \item Requirement B is met \at{page}[markerB].
            \item Requirement C is met \at{page}[markerC].
        \stopitemize    
    
\stoptext



I have this sample code, but it only works for a single document, and only displays page number. I tried looking at the \about and other related command, but that requires giving a reference name and referring to the titles, not my dropped macro. How can I modify this to display a message like below, plus also scans the other files. *It only needs to reference the first found occurrence.*
Here is a sample message what the output should give:
"Requirement A is met in WB 3, "Bears", p. 33."
--Joel

[-- Attachment #1.2: Type: text/html, Size: 4309 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

       reply	other threads:[~2024-02-07  3:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1304025475.3496876.1707277653314.ref@mail.yahoo.com>
2024-02-07  3:47 ` Joel via ntg-context [this message]
2024-02-09 15:13   ` [NTG-context] " Bruce Horrocks

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1304025475.3496876.1707277653314@mail.yahoo.com \
    --to=ntg-context@ntg.nl \
    --cc=uaru99@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).