The Context: I am writing a multi-chapter scientific report with many numbered hypotheses. I have created a custom hypothesis environment in the preamble:

\newtheorem{hypothesis}{Hypothesis}[chapter]

An example of a hypothesis in the body of the document is:

\begin{hypothesis}
\label{HXonY}
There is a positive relationship between X and Y.
\end{hypothesis}


My Question: How can I create a custom List of Hypotheses like a Table of Contents that lists:

• the hypothesis number (e.g.,1.1, 1.2, 2.1, etc.)
• the text of each hypothesis in the document
• the page number where it is recorded

E.g.,

 List of Hypotheses
1.1 There is a positive relationship between X and Y .................. 32
1.2 There is a negative relationship between something and Z........... 43


etc.

I couldn't get any of the theorem packages to produce such a list directly. So the following produces its own list using the tools provided by ntheorem. It works by adding lines directly to the list of hypolist theorems.

\documentclass{book}

\usepackage{ntheorem}
\newtheorem{hypo}{Hypothesis}[chapter]
\newtheorem{hypolist}{Hypothesis}[chapter]

\newcommand*\hypothesis[1]{%
\stepcounter{hypolist}%
\begin{hypo}#1\end{hypo}
}

\begin{document}

\chapter*{List of Hypotheses}
\listtheorems{hypolist}

\chapter{foo}

\hypothesis{There is a positive relationship between $X$ and $Y$.}

\chapter{bar}

\hypothesis{There is a positive relationship between $X$ and $Z$.}
\hypothesis{There is a positive relationship between $Z$ and $Y$.}

\end{document}


I defined a command instead of an environment, because it is simpler and you can't use multi-paragraph entries in the list anyway.

The ntheorem package can do this:

\listtheorems{hypothesis}

• Thanks. This is helpful. However, by default it does not print the hypothesis text in the list. It only prints the hypothesis number and the page number. I'm having a read through the documentation to see if it supports printing the text. – Jeromy Anglim Aug 29 '10 at 14:48
• It seems to take the list text from any text in square brackets: e..g., \begin{hypothesis}[This text is displayed in list]This text is not\end{hypothesis}. While I would be willing to type the text twice if necessary, the text in the square brackets also appears in my document, which prevents it from being a solution. – Jeromy Anglim Aug 29 '10 at 15:18

You may use the thmtools package (note the different syntax for creating new theorems).

\documentclass{book}

\usepackage{amsthm}
\usepackage{thmtools}
\declaretheorem[numberwithin=chapter]{hypothesis}
\declaretheorem[numberwithin=chapter]{theorem}

\begin{document}

\renewcommand{\listtheoremname}{List of Hypotheses}
\listoftheorems[ignoreall,show={hypothesis}]

\chapter{foo}

\begin{hypothesis}[X-Y-relationship]
There is a positive relationship between X and Y.
\end{hypothesis}

\begin{theorem}
Some text.
\end{theorem}

\end{document}

• This produces “X-Y-relationship” in the list, while the OP wanted “There is a positive relationship between X and Y.” – Caramdir Dec 11 '10 at 17:30

In the end I decided to use Sweave. I.e., I have an Rnw file with tex and R code chunks which acts as a pre-processor for a LaTeX document.

I have a csv file which stores the hypotheses with one hypothesis per row:

  hypotheses <- read.csv("hypotheses.csv")


The following R function outputs the latex for the hypothesis environment:

outputHypothesis <- function(label, data = hypotheses) {
result <- c("\\begin{hypothesis}",
paste("\\label{", label, "}"),
data[data$label==label, "text"], "\\end{hypothesis}") cat(result, sep="\n") }  Then the Rnw file has an R code chunk which inserts the tex: <<results=tex>>= outputHypothesis("H1XcausesY") @  I still have to finalise the next step of actually creating the table of hypotheses, but I think I'll implement it as an R code chunk in Sweave. One thing I've already done is use the database to display a table in the discussion section that uses the database of hypotheses as the source and shows (based on the database) whether the hypotheses were supported in a each of a set of studies: \begin{landscape} \singlespacing \begin{longtable}[p]{p{2cm}p{10cm}p{2.5cm}p{2.5cm}p{2.5cm}} \caption{Summary of Support for Hypotheses} \label{discussionhypotheses}\\ \toprule Number & Hypothesis & Study 1 & Study 2 & Study 3\\ \midrule \endfirsthead \toprule Number & Hypothesis & Study 1 & Study 2 & Study 3\\ \midrule \endhead \multicolumn{5}{r}{\emph{Table continues on next page}} \\ \endfoot \bottomrule \endlastfoot <<hypothesis_table, results=tex>>= discussionHypotheses <- paste("\\ref{", hypotheses$label, "}",
"& ", hypotheses$text, " & ", hypotheses$support_study1,
" & ", hypotheses$support_study2, " & ", hypotheses$support_study3,
"\\\\")
cat(discussionHypotheses, sep ="\n")
@
\end{longtable}
\end{landscape}