TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Suppose you have a title page layout that you like and want to use it for many different projects.

Thus the only change you will make to it will be the project name, subtitle, date, author, ... etc

How would I create a function that generates a title page layout from some variables and then inputs it into my project file?


share|improve this question
With the environment titlepage you can use \maketitle. Define your variables and use them in titlepage. – Kurt Sep 4 '12 at 22:17
up vote 12 down vote accepted

One possibility is to write a little package, say titlepage.sty; in this package you can define some commands to provide the information that you will use for the titlepage and define a command to effectively produce the titlepage.

A little example: since standard LaTeX provides \author, \title, and \date, in the folowing example I only defined \subtitle and \institute in a way completley analogous to the definition of \author.

Once all the preparations have been done, you define your command to produce the titlepage, using the desired formatting for the elements that will be used.

Here's a very simple version of mytitlepage.sty:


\def\@subtitle{\@latex@warning@no@line{No \noexpand\subtitle given}}
\def\@institute{\@latex@warning@no@line{No \noexpand\institute given}}



You can save this file in your local tree and then all you have to do is to load the package in the preamble of your document, use the commands to provide the fields and invoke \mytitlepage:


\title{The Title}
\subtitle{The Subtitle}
\author{The Author}
\institute{The Institute}
\date{The date}



share|improve this answer
That's exactly what i wanted. Thank you so much. – Fawkes5 Sep 6 '12 at 22:49

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.