14

Is there a way to create a single document that will process a LaTeX file in two different ways (different preambles) and produce two different outputs.

Specifically, I want to produce a set of classroom slides, one for my use and one to be made available to the students.

The student version would have the overlays flattened and place 4 slides to the page. I hope this makes sense.

7
  • 1
    Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – texenthusiast Aug 12 '13 at 14:39
  • 4
    The simplest way is to put your preamble in a separate .tex file, then \input{preamblex} at the start of your document before compiling. Here x is 1 or 2 or a name of your choice. There are more complex ways, using a switch or a command line argument, but this might solve your problem. – Ethan Bolker Aug 12 '13 at 14:43
  • 2
    Here is an example of doing it from the command line, which could be adapted to your needs. – jon Aug 12 '13 at 14:50
  • When it comes to printing, (a) the students can specify slides per page from the printing set up (b) if you are handing them out, you can specify the slides per page from the printing set up options. – dustin Aug 12 '13 at 18:57
  • How committed are you to beamer? There are other packages out there that do that sort of thing routinely. Personally, I don't print copies of slides. I rewrite them. – John Kormylo Aug 14 '13 at 20:34
1

This answer doesn't address your particular beamer problem, but rather discusses the general problem: developing a method for conditionally compiling a source document in two vastly different ways.

We do this with my organization's report stencil. It allows, with the change of a single word, to change from an organizational report, with Covers, mandatory government forms, distribution lists, figures and tables in the text, into a manuscript form that eliminates the cover, cuts out the forms and distribution list, while retaining things like keywords (which were part of the government forms too), with tables and figures collected at the end of the report. Naturally, the margins, fonts, etc. are all different, as well.

The basic structure of the stencil would be something like this, which provides conditional compilation, depending on which of two settings is specified by \PREPARETYPE:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Choose desired document format HERE!:
\def\PREPARETYPE{\DOCTYPEA}%            choices: {\DOCTYPEA} or {\DOCTYPEB}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Set up for possible DOCTYPEA format:
\newcommand\DOCTYPEA{
  \documentclass{MyOrgClass}
  \usepackage{packages for DOCTYPEA}
  \def{settings peculiar to DOCTYPEA}
  \macros peculiar to initializing DOCTYPEA
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Set up for possible DOCTYPEB format:
\newcommand\DOCTYPEB{
  \documentclass{article or whatever class is desired for DOCTYPEB}
  \usepackage{TYPEA2TYPEB} % <--- ESSENTIAL TO INTERCEPT/INTERPRET MyOrgClass MACROS
  \usepackage{packages for DOCTYPEB}
  \def{settings peculiar to DOCTYPEB}
  \macros peculiar to initializing DOCTYPEB
}
\PREPARETYPE
%...common preamble commands
\begin {document}
%... document text, figures, tables, etc.
\end {document}

The key, however, to making such an arrangement work, is a style you need to develop that, in this MWE, is called TYPEA2TYPEB.sty. In particular, it's sole function is to create macros with the same non-standard names as occur in MyOrgClass and provide the manner in which they should be interpreted by \DOCTYPEB. In many cases, it may be a null definition {}, as would be the case for features of \DOCTYPEA that are eliminated by \DOCTYPEB. In other cases, a new non-null definition must be provided.

While we don't need it for our situation, I suppose one might also need a TYPEB2TYPEA.sty style to be included in the \DOCTYPEA macro definition, if the class employed by \DOCTYPEB also uses non-standard macros.

While this answer does not solve your problem for you, it lays out a method of producing two documents with vastly different formatting, that can be brought about by changing a single word in the source file.

I attach a figure, for what its worth, showing two documents from the same source. On the left is a manuscript form, on the right is an organizational report form. I do this just to emphasize the vastness of difference in results that is possible using this approach.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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