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 have a CV I've created in LaTeX (using the moderncv package).

I'm trying to create flavors of the CV based on variables. What I would like to do is to generate the sections in a different order.

e.g. I currently have:




So the PDF generated right now has this order:

  • Education
  • Experience
  • References

I'd like, say, flavor_A to render as :

  • Experience
  • Education
  • References

and flavor_B to render as:

  • Experience
  • Education

and flavor_C to render as:

  • Education
  • Experience
  • References

Is something like this possible?

share|improve this question
Welcome to Tex.SX! –  Umar Kalim Feb 17 '13 at 2:53
add comment

2 Answers

up vote 11 down vote accepted

Without exploring more complex options, you could simply put each section in a separate file (say education.tex, experience.tex and references.tex) and include those in you main file (as Mariano correctly points out in his comment, using input is preferable to include in order to avoid page breaks):


Generating different flavors of your resume will then be a simple matter of reordering those three lines. To drop a section altogether, you can simply comment the line with %.

You could code a function to do the reordening based on a variable automatically (as your question suggested), but except if you are really going to generate lots and lots of flavors (which probably mean you should rethink your resume in my opinion), it's going to be less efficient than simply swapping the input lines.

share|improve this answer
\include tends to produce page breaks in the usual classes; '\input' doesn't. –  Mariano Suárez-Alvarez Feb 17 '13 at 5:00
My bad indeed; I've updated the answer accordingly. –  Xavier Feb 17 '13 at 5:46
Thank you, that works fine for me. I just need to keep/drop/change the order of some sections. –  hide0 Feb 17 '13 at 6:03
@hide0 To drop a section, you cans imply comment the line with %. I've added that to the answer. –  Xavier Feb 17 '13 at 16:28
add comment

In case splitting the CV into different files is unfeasible, here's a possibility: we absorb each section in a macro and use it when we want.

The example is drawn from the template in the documentation of moderncv.



% a helper macro

% the main environment

% the command for printing the information

% personal data
\title{Resumé title}
\address{street and number}{postcode city}{country}
\extrainfo{additional information}
\quote{Some quote}



\begin{cvsection}[MT]{Master thesis}
\cvitem{description}{Short thesis abstract}

\cventry{year--year}{Job title}{Employer}{City}{}{General description no longer than 1--2 lines.\newline{}%
Detailed achievements:%
\item Achievement 1;
\item Achievement 2, with sub-achievements:
  \item Sub-achievement (a);
  \item Sub-achievement (b), with sub-sub-achievements (don't do this!);
    \item Sub-sub-achievement i;
    \item Sub-sub-achievement ii;
    \item Sub-sub-achievement iii;
  \item Sub-achievement (c);
\item Achievement 3.
\cventry{year--year}{Job title}{Employer}{City}{}{Description line 1\newline{}Description line 2}
\cventry{year--year}{Job title}{Employer}{City}{}{Description}



Each section appears in a cvsection environment that has an optional argument which should be used in case the section title does not consist only of plain ASCII characters. I've used it for "Master Thesis" although it wouldn't be necessary in this case.

After defining the various sections, you can print them in the order you prefer, using the section title or the key if the optional argument has been used for a particular section.

share|improve this answer
Thanks, this looks useful as well! I don't think I need it for this, but I'm pretty sure I have some other documents I can simplify with something like this :) –  hide0 Feb 17 '13 at 23:36
add comment

Your Answer


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.