GeneralAutomatic back References

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
elektryk
Posts: 3
Joined: Mon Jun 18, 2012 10:00 pm

Automatic back References

Post by elektryk »

Hi, I am not sure how to name my problem, I will just describe situation. I have one big document describing whole system.

Code: Select all

\chapter{Database}
\section{Query 1}
\label{sql1}
\section{Query 2}
\label{sql2}
\section{Query 3}
\label{sql3}

\chapter{Applications}
\section{Application1}
in case of foo query described in \ref{sql1} is executed
in case of foo query described in \ref{sql2} is executed
\section{Application2}
in case of foo query described in \ref{sql2} is executed
in case of foo query described in \ref{sql3} is executed
I am using pdflatex and want to have something like this in my document

Code: Select all

Database:
Query 1:
used in:
* Application 1 <reference link>
Query 2:
used in:
* Application 1 <reference link>
* Application 2 <reference link>
Query 3:
used in:
* Application 1 <reference link>
How can I do this?
I have tried to do something like this:
  1. \@starttoc{sqllist}
  2. define command \sqlref which:
    1. make label from counter
    2. pass counter, current section name and destination label to \addtocontents{sqllist}
  3. at every \ref use \sqlref
After execute of pdflatex I get new file xxx.sqllist which is mainly formated like this

Code: Select all

\sqlrefitem {Query label}{Chapter name}{Chapter label}
The problem is when I want to use this additional file to search all accurance of <Query label>. I made some code which is working but this additional file is cleared at the beginning of latex processing and I need to manually copy it to another location and use this copy. This behaviour seems to be logic, but kills my solution.

I am think there may be another solution, the additional output file should be generated following. Then parsing this file single time at the begining will generate one new command for each query. This is draft some details are missing and I am aware this renewcommand will hang on recursion.

Code: Select all

\renewcommand{\<Query label>index}{
\<Query label>index} \item Chapter name \ref{Chapter label}
}
So each time some kind of "Query Label" is detected new \item will be added to this command. The usage of this command will be:

Code: Select all

\begin{itemize}
\<Query label>index
\end{itemize}
I have few questions:
  1. Is there a simpler way to do generate automatic reverse references?
  2. How to save a copy of "own" TOC at the start of tex script?
  3. Is there a simpler way to get data from TOC file in many places of particular file?
  4. Is there a way to call command by dynamically generating
the name of command like \<Query label>index, where <Query label> is store in command parameter ie. #1?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Post Reply