Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to discard the entire document and have only the index remaining.

Note:

My naive attempt below does not produce any output. I want Page 2 of the document that gets generated if the \usebox{\DiscardBox} line is un-commented, but not Page 1.

Code:

\documentclass{article}
\usepackage{imakeidx}
\usepackage{hyperref}

\makeindex[columns=1]

\newsavebox{\DiscardBox}

\begin{document}
  \savebox{\DiscardBox}{%
    Test\index{foo}
    Testing\index{bar}
  }%
  %\usebox{\DiscardBox}

  \printindex
\end{document}
share|improve this question
    
Index writing is performed at \shipout time, so if nothing is shipped out no index is produced. –  egreg Dec 19 '12 at 22:02
2  
why not just have a new document which inputs the .ind file of the first (and does nothing else) –  David Carlisle Dec 19 '12 at 22:06
    
@DavidCarlisle: WOW!! That is pure genius... Never occurred to me. Seems to work fine. What do I need to do get only a one column index? Using just \input{<file>.ind} produces a two column output. –  Peter Grill Dec 19 '12 at 22:14
    
look in chat:-) –  David Carlisle Dec 19 '12 at 22:14
    
Are you talking visually remove everything but the index? That is, if you have a document of 10 pages with 1 page dedicated to the index, then you can delete pages 1-9 and only be left with "page 10"? –  Werner Dec 19 '12 at 22:36
show 1 more comment

2 Answers

up vote 5 down vote accepted

imakeidx sets the number of columns with \imki@columns; so you can simply build another document with the following format:

\documentclass{article}
\usepackage{imakeidx}
\usepackage{hyperref}

\begin{document}
\makeatletter
\def\imki@columns{1}
\def\indexname{External index}
\makeatother
\input{mainfile.ind}

\end{document}

leaving to the class the rest.

share|improve this answer
add comment

Just have a new document which inputs the .ind file of the first (and does nothing else) .

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.