Is it possible, while including a file, to pass some parameters to that file and get included file rendered differently depending on those parameters? My particular case is, I have two documents, which will have the same title page except for one string – the title of the document itself. So my idea, instead of creating two separate title page .tex
files would be to make one parameterized one. Here's a rough sketch of the idea:
title_page_template.tex
:
% assign parameter, let's call it NAME
% create the top of the page, logos, etc.
\large NAME
% create the bottom of the page, authors, footer, etc.
document1.tex
:
% initialization, usepackage, etc.
\include {title_page_template, Document1}
% the rest of the document
document2.tex
:
% initialization, usepackage, etc.
\include {title_page_template, Document2}
% the rest of the document
I would like both documents to have the same title page included except for this one string that is passed as a parameter. Can you do something like that in Latex?
Best Answer
Yes, this is possible, but a more generic approach would be to create your template with the title having the form (in
title_page_template.tex
):and then call (in
document1.tex
):and (in
document2.tex
):This leaves some of the structured commands like
\input
untouched, since you might want to use them in a different instance without passing parameters.