[texhax] Information about document in the document

E. Krishnan ekmath at asianetindia.com
Wed Oct 8 01:19:50 CEST 2008


On Tue, 7 Oct 2008, Tom Backer Johnsen wrote:

> For some of the documents I write I would like to include a line in the
> upper left corner of the first page containing (a) the directory and
> name of the main file, and (b) the date and the time the document was
> printed.  At the same time I would like to drop the date that appears by
> default when using the \maketitle command.

This is one way of doing it in a linux system


\documentclass{article}
\usepackage{calc}
\usepackage{fancyhdr}


\fancyhead[L]{%
   \makebox[\taglen-4cm][r]{%
     \small\ttfamily
     \printfilename \today\ \printtime}}
\renewcommand{\headrulewidth}{0pt}

\newcommand{\filename}{\jobname.tex}
\newcommand{\printfilename}{%
    \immediate\write18{pwd > path.tex}{\input{path}\llap/\filename}}

\newcounter{hours}
\newcounter{minutes}
\setcounter{hours}{\time/60}
\setcounter{minutes}{\time-\value{hours}*60}
\newcommand{\printtime}{\thehours:\theminutes}

\newlength{\taglen}
\settowidth{\taglen}{\printfilename\ \today\ \printtime}



\begin{document}


\title{An experiment}
\author{E.~Krishnan}
\date{}
\maketitle
\thispagestyle{fancy}


This is a test

\clearpage

This is a test


\end{document}


You may have to compile by

   latex -shell-escape  filename




-- 
Krishnan


More information about the texhax mailing list