Latex / Lyx preamble for document metadata and styling

The Latex (or Lyx, a GUI for Latex) "preamble" can be used to set document metadata, like the title, author and date, and add styling, such as headers/footers.

To re-use metadata, create your own variables and reference these wherever you'd like, either in the preamble or in the document itself.

Example preamble:

\newcommand\mytitle{Brighternet Services}
\newcommand\myauthor{Brighternet Ltd.}
\newcommand\myurl{http://brighternet.com}
\newcommand\mydate{01/08/2008}
\title{\mytitle}
\author{\myauthor\space\myurl}
\date{\mydate}
\lhead{Section \thesection}
\chead{}
\rhead{Page \thepage}
\lfoot{\mytitle.\space\myauthor}
\cfoot{}
\rfoot{\mydate} 
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\renewcommand{\abstract}{\flushleft}

The example creates 4 variables, called mytitle, myauthor, myurl and mydate. These are reused in the title, author and date metadata declarations and in the footer.

In addition, the preamble sets the header/footer line rule and makes the abstract text left aligned.

Note the use of \space to get a space character.

The custom variables can be referenced elsewhere in your document using the same code as in the preamble. In Lyx, this would be done by inserting via Insert -> Tex Code.

Last modified: 18/08/2008 Tags: (none)

Go to top

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top