How can I tag all occurrences of a keyword then reference all the pages containing the same tag?

Course Queries Syllabus Queries 2 years ago

0 2 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Syllabus Queries related to Course Queries. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (2)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

 

I am writing a syllabus with specific curricular requirements. Activities are tagged with these requirements to demonstrate alignment. I want to use a labelling or indexing system to tag the instances of alignment and then refer to all of the pages were an instance of alignment occurs.

Is there a package that will reference all of the pages containing the same label, as in an index, but allow me to print the pages for that label at an arbitrary point in the document?

This need seems to have elements of \label - \ref and of \index.

I don't have a minimal working example but what I want would look something like this.

\documentclass{article}
\begin{document}
\begin{description}
\item[CR1] This is a description of a requirement. \\ See page 1>
\item[CR2] This is a description of another requirement. \\ See page 
\end{description}

\section{Section 1}
This is an activity aligned with CR1. (\label{CR1} or \index{CR1})

This is an activity aligned with CR2. (\label{CR2} or \index{CR2})
\section{Section 2}
This is another activity aligned with CR1. (\label{CR1} or \index{CR1})

\end{document}
profilepic.png
manpreet 2 years ago

I see Nicola just did a glossaries version but here's my barebones makeindex version.

enter image description here

You just want an index style that saves each page list in a definition rather than typesetting, say foo.ist:

preamble
"\n\\makeatletter{"
postamble
"}\n\\makeatother\n"

item_0 "}\n\\@namedef{"
delim_0 "}{"

Then

pdflatex file
makeindex -s foo.ist file
pdflatex file

should produce the above output from a document like

\documentclass{article}
\usepackage{makeidx}
\makeindex
\def\listfor#1{\csname #1\endcsname}
\begin{document}

\printindex

\begin{description}
\item[CR1] This is a description of a requirement. \\ See pages \listfor{CR1}
\item[CR2] This is a description of another requirement. \\ See pages \listfor{CR2}
\end{description}

\section{Section 1}
This is an activity aligned with CR1\index{CR1}.

aa
\clearpage

This is an activity aligned with CR2\index{CR2}.
\section{Section 2}
This is another activity aligned with CR1\index{CR1}.

\section{Section 3}
This is an activity aligned with CR1\index{CR1}.


aa
\clearpage

This is an activity aligned with CR2\index{CR2}.
\section{Section 4}
This is another activity aligned with CR1\index{CR1}.


aa
\clearpage

aa
\clearpage

This is an activity aligned with CR2\index{CR2}.
\section{Section 4}
This is another activity aligned with CR1\index{CR1}.

\end{document}

0 views   0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.