# How to see dependencies between theorems [duplicate]

I have a paper that uses \label for naming theorems, propositions and etc.

We say that a theorem, proposition and etc X depends on the theorem, proposition and etc Y if Y is mentioned in the closest proof environment that goes right after X.

I wonder if there exists a tool that takes my .tex source and builds a graph of dependencies between theorems, proposition and etc.

EDIT. Requested by Andrew

Here is a working example

\documentclass[12pt]{article}
\usepackage[left=2cm,right=2cm,
top=2cm,bottom=2cm,bindingoffset=0cm]{geometry}
\usepackage{amssymb,amsmath}
\usepackage[utf8]{inputenc}
\usepackage[matrix,arrow,curve]{xy}
\usepackage[russian]{babel}
\usepackage[final]{graphicx}
\usepackage{mathrsfs}

\newtheorem{theorem}{Theorem}[subsection]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{remark}[theorem]{Remark}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}

\newenvironment{proof}{\par $\triangleleft$}{$\triangleright$}

\begin{document}
\begin{proposition}\label{Prop1}
bla bla follows from bla
\end{proposition}
\begin{proof}
Obvious.
\end{proof}

\begin{theorem}\label{Prop2}
bla bla bla follows from bla bla
\end{theorem}
\begin{proof} Apply \ref{Prop1}, the rest is clear
\end{proof}

\begin{remark}\label{Rem1} % remarks have no proofs, so they shouldn't be parsed
\ref{Prop2} is harder than \ref{Prop1}.
\end{remark}

\end{document}


The output should be in format of Graphviz (or anything else publicly avaliable).

• Cross-referencing is much more overloaded term than the desription I gave above. I don't understand what you mean. Aug 26, 2014 at 21:50
• I understand what do you want. AFAIK, there's no such tool.
– yo'
Aug 26, 2014 at 21:53
• Although I don't know of a tool for doing this I think that it would be fairly straightforward using the datatool package. Can you please add a full minimal working example with some mock theorems and references together with the expected output -- do you want a graph, a list, a table...? Adding this information would make it much easier for people to help you. If no one else provides an answer I'll try in a few days when I have time.
– user30471
Aug 26, 2014 at 22:21
• @Andrew, thank you! See edits to my question. Aug 26, 2014 at 22:39
• @SvendTveskæg, if it bothers you so much just close this tab. Aug 26, 2014 at 23:31