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?


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.

| improve this answer | |
  • 2
    \include tends to produce page breaks in the usual classes; '\input' doesn't. – Mariano Suárez-Álvarez 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
  • 1
    @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

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.

| 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

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.