[texhax] creating a summary document

Niall Mansfield texhax at uit.co.uk
Sun Feb 19 12:17:51 CET 2012


  > Date: Sat, 18 Feb 2012 14:35:16 +0100
  > From: "Neal H. Walfield" <neal at walfield.org>
  > To: texhax <texhax at tug.org>
  > Subject: [texhax] creating a summary document
  > Message-ID: <877gzki7sb.wl%neal at walfield.org>
  > Content-Type: text/plain; charset=US-ASCII
  > 
  > Hi,
  > 
  > I'm working on my thesis.  A common pattern has emerged: I make a
  > claim, I support the claim, repeat.  I'd like to create a summary
  > document, which includes the claims and an enumeration of the
  > arguments, but without all of the rationale.  I want to develop this
  > document inline, so it is easy to keep both consistent, if I, e.g.,
  > move text around.  I could imagine using a macro to indicate what text
  > is for the summary document, but I don't want to use a macro for the
  > rest of the text, because this will clutter the document.  I guess
  > this is possible, because it is essentially what the "List of Figures"
  > is.  Is there a package to help me with this?

Here's an earlier post of mine that shows how you can do
what you want very easily.  In your case you could use

	#ifdef SUMMARY
	<summary-only stuff>
	#else
	<full-document-only stuff>
	#endif
	<stuff common to both>

Rgds,
Niall

------------------------------------------------------------

To: texhax at tug.org
CC: Arno.Trautmann at gmx.de
Subject: Re: multiple pdfs from one dtx (Arno Trautmann)
From: "Niall Mansfield" <texhax at uit.co.uk>
Date: Thu, 30 Dec 2010 15:25:25 +0000

  On Sat, Dec 25, 2010 at 11:03:11PM +0100, Arno Trautmann wrote:
  > I want to produce two different sty files and
  > corresponding documentations (pdfs). As the
  > sty files belong together (say, an internal
  > and external version), I want to keep
  > maintainance as easy as possible and therefore
  > use one dtx file for everything. Now, is there
  > a possibility to produce two pdfs from one dtx
  > file?

We had a related requirement -- how to produce two different
versions of a book from the same source files.  We tried
(La)TeX-specific approaches but abandoned these because the
syntax was too messy and it was too hard (for us at least)
to make sure that the conditional code was handled
correctly, and not changed by the if/else mechanism and that
we wouldn't have to worry about when expressions were
evaluated, escaped, etc.

So instead we pre-process the LaTeX files:

- source file is, say, simple.texpp
  (where 'pp' stands for 'preprocessor').

- use 'unifdef' to handle the conditionals.  unifdef is
  very basic which is great -- it leaves just about
  everything completely untouched apart from handling
  if/else.  Here's an example:

	\documentclass[12pt]{article}
	\begin{document}

	First
	#ifdef MME
	Second
	Third
	#else
	Fourth
	Fifth
	#endif
	Sixth
	\end{document}

  If we are producing the "mass market edition" (MME) we get
  one output tex file; on the other hand if MME is undefined we get a
  different variant -- the "normal" version of the book.

  We send the output of unifdef to simple.tex in this
  example, which we then process as normal.

- A full example, with Makefile, is at

	http://uit.co.uk/files/tex-and-latex/unifdef-example.tgz

  (size is 0.5K).

	Regards,
	Niall



More information about the texhax mailing list