I hv a .ltx file with some section/sub/subsub and text.
In one part of the document I include it per usual.
I'd like to include it as an appendix but show none of the body text. I thought I'd solved this, but searching fails. Is there a canonical way of doing this?
Page Layout ⇒ Show/hide all but section / subsection / etc. in body
NEW: TikZ book now 40% off at Amazon.com for a short time.

Show/hide all but section / subsection / etc. in body
Hi,
I am not sure what kind of .ltx format are you talking about. In a standard LaTeX document you can use some of the features provided by the comment package. A little example:
I am not sure what kind of .ltx format are you talking about. In a standard LaTeX document you can use some of the features provided by the comment package. A little example:
Code: Select all
Code, edit and compile here:
\documentclass{article}\usepackage{comment}\usepackage{lipsum} % just to generate some text\begin{document}\section{Test section}\begin{comment}\lipsum[1-10]\end{comment}\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Show/hide all but section / subsection / etc. in body
Sorry for being unclear. What I have is a file, say supplies.ltx, which contains something like:
In the main corpus I include this file, with the expected result.
I'd like to include it as an appendix later on but show only the section/subsections, without the intervening text, to make a shopping list of sorts.
Code: Select all
Code, edit and compile here:
\section{Supplies}\subsection{Food}Some words about food.\subsection{Drink}Some words about drink.
I'd like to include it as an appendix later on but show only the section/subsections, without the intervening text, to make a shopping list of sorts.
Show/hide all but section / subsection / etc. in body
Then as I said, use the comment package (link provided before). An example:
the file main.tex:
the subsidiary file b.tex:
The first inclusion of the file b.tex writes all of its contents; the second inclusion only writes the sectional unit titles (only material outside a comappend environment will be included this time).
By the way, I still don't know what you mean with .ltx format. Is it some kind of format produced by an editor?
the file main.tex:
Code: Select all
Code, edit and compile here:
\documentclass{article}\usepackage{comment}\usepackage{lipsum} % just to generate some text\begin{document}% we include all the contents of the file b.tex\includecomment{comappend}\include{b}% now only the sectional unit titles of file b.tex will be included\setcounter{section}{0}\excludecomment{comappend}\include{b}\end{document}
Code: Select all
Code, edit and compile here:
\section{Supplies}\begin{comappend}\lipsum[1-2]\end{comappend}\subsection{Food}\begin{comappend}\lipsum[1-2]\end{comappend}\subsection{Drinks}\begin{comappend}\lipsum[1-2]\end{comappend}
By the way, I still don't know what you mean with .ltx format. Is it some kind of format produced by an editor?
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Re: Show/hide all but section / subsection / etc. in body
Thank you; that was fabulous. I learned something new.
Now I'm trying to work out why the minimal TeX case works but migrating this into LaTeX fails; specifically the second inclusion contains all the prose, and the TOC for the second inclusion shows line numbers to the first include, and I'm pretty sure the URL package gets completely confusied (making in-document jumps wrong).
I'm also wondering why I chose LaTeX as my default, when perhaps TeX would work for this rather simple (albeit lengthy) document....
Now I'm trying to work out why the minimal TeX case works but migrating this into LaTeX fails; specifically the second inclusion contains all the prose, and the TOC for the second inclusion shows line numbers to the first include, and I'm pretty sure the URL package gets completely confusied (making in-document jumps wrong).
I'm also wondering why I chose LaTeX as my default, when perhaps TeX would work for this rather simple (albeit lengthy) document....