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.

Possible Duplicate:
Guide to managing multiple resume with one LaTeX?

I would like to make a combined résumé & CV document class that can be used to generate two documents with some content shared and some content unique to one of the documents. Is there a way to do this with a single LaTeX file? If not, what do you recommend doing instead?

share|improve this question

marked as duplicate by jtbandes, Guido, Thorsten, Martin Schröder, ienissei Dec 27 '12 at 8:30

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

You can define your own documentclass that sets the style accourding to some class options and/or key-value pairs. The pgfkeys package is excellent for parsing key-value pairs and the pgfopts package lets you use pgfkeys at the document class level. As to the style, thst's up to yourself. For example, you could load class X if option A is passed, load class Y if option B is passed, and so on. –  Marc van Dongen Dec 26 '12 at 8:15
@MarcvanDongen Is there a way I could actually produce two PDF files? –  jtbandes Dec 26 '12 at 8:29
In general, it's always simpler to have separate (main) input files for each output PDF that you need, but this doesn't mean duplicating a lot of text. Take a look at this question, and also this answer. –  Brent.Longborough Dec 26 '12 at 9:38
Can you please expand on the common parts with example headings, i.e., short-bio (you may have it on both a resume and a CV). –  Yiannis Lazarides Dec 26 '12 at 10:23
You can easily produce two pdf files, then combine them using pdfpages package –  smh Dec 26 '12 at 10:49
show 1 more comment

1 Answer

The best idea (aka poor man's solution)

will be to have two main files (say first.tex and second.tex) which will have content unique to them. The shared content may be in a third file (say shared.tex) which can be \inputed inside first.tex and second.tex. Hence you will have totally three files.

If you want all the three files inside a single file and want to compile (click the pdflatex button ,-)) only once, you may use the filecontents and \write facility:

(name this file as first.tex)

\documentclass{article} %% The output of this file is the first document.
%% The shared content
This content is shared by both the files -- \verb|first.tex| and \verb|second.tex|
%% This is the second document
This is the unique content for the second file. Next comes the shared content.
\section{shared content}

Again some unique content for second file.
%create the second.pdf.
\immediate\write18{pdflatex second}

 This will appear only in the first file. I am going crazy!
 \section{shared content}

Again this is only for first file.


You will get two pdf files - first.pdf and second.pdf. The contents of first.pdf are

enter image description here

and the second.pdf reads:

enter image description here

share|improve this answer
This works but it is not easy to share many different bits of generated text between the two output files. –  Marc van Dongen Dec 26 '12 at 17:10
add comment

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