# Best practices for “factoring” relatively small snippets of shared code

My particular use case is that I have a long academic CV, and a short résumé. The two of them share a reasonable amount of textual content, but, for example, the order of the content varies, some content is included selectively in one but not the other, etc.

I would like to factor the shared content out. The ways that I can see to do this are:

• Create, e.g., PositionName.tex, UniversityName.tex, and \input them as desired. This has the disadvantage that it's hard to configure the \input, for example, to include or not the name of your advisor from university.
• Create, e.g., one big SharedCode.tex, which defines macros to render/display/whatever all of the shared portions of the two (or more) documents. Even if I took this route, it's not totally clear to me how to most cleanly set up the "configurability" I describe in the previous point.

I think that if I were working with snippets sized on the order of a book/thesis chapter, the first option would be better. But what about when the snippets are much smaller? Is it somehow bad practice to have a dozen little 10-line .tex files lying around?

Edit:

Very concretely, I have the files mishchea-resume.tex and mishchea-cv.tex here https://github.com/mishchea/cv, and their outputs are at http://www.mishchea.com/mishchea-cv.pdf and http://www.mishchea.com/mishchea-resume.pdf. Much of the tex files is copy-pasted across them, and I would like to factor the copy-pasted portions out.

Edit:

For example, in my résumé, I have something like:

\item \textbf{University of Michigan}, Ann Arbor\hfill 2007--2012
\begin{itemize}
\item Won millions of awards, here's a long list: best haircut, ...
\end{itemize}


And in my CV, I have something like:

\item \textbf{University of Michigan}, Ann Arbor\hfill 2007--2012
\begin{itemize}
\item Won millions of awards, here's a long list: best haircut, ...
\item Advisor: Dr. John Smith
\end{itemize}

• I don't know for other but i didn't get the whole idea, maybe summarazing what are you trying to achieve in a short example of different source files would help to understand better. – SAM Jul 5 '16 at 20:05
• I've added an edit that links to the actual files I'm working with. – Andrey Mishchenko Jul 5 '16 at 20:20
• You might look at \newif, \@ifundefined, the ifthen package and \pgfkeys from (tikz or pgfkeyx). – John Kormylo Jul 5 '16 at 21:03
• Make an example small enough to include here. Most people won't bother to follow links and links die, so your question will be easily deprecated and answers of little use to others. People don't want, in any case, to figure out the problem from your entire project. They want to see the problem immediately from the code in the question. – cfr Jul 6 '16 at 0:38
• I use L3 to set up template-type things. I then configure defaults in a file. Some of this is also conditional, depending on an option passed to the class. I can't really tell if this is the kind of thing you are trying to do or not. It works nicely if it is what you need, though. That is, it works nicely for me. (And I'm sharing it between way more than 2 documents.) – cfr Jul 6 '16 at 0:40