How to print the book title and section title where \reference is located?
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
On 7 Feb 2024, at 03:47, Joel via ntg-context
wrote: 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.tex WB 1 -- 03_workbook.tex WB 2 -- 04_workbook.tex WB 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.
[snip]
Here is a sample message what the output should give:
"Requirement A is met in WB 3, "Bears", p. 33."
Taking you literally in that you want a *file* listing the occurences and not a typeset page listing the occurrences then you could try using the following in your document at the places where you currently put \requirementA etc: \writestatus{RequirementMet}{Requirement A is met in section \fetchmark[section][current], p. \pagenumber} This will write the current section title and page number to the console listing, prefixed by the word "RequirementMet". To produce the file for your customer all you have to do is filter these lines out of the .log file that is produced when you compile your book. In Unix-like systems that is a simple: grep RequirementMet file.log Regards, — Bruce Horrocks Hampshire, UK
participants (2)
-
Bruce Horrocks
-
Joel