[texhax] Information about document in the document

Tom Backer Johnsen backer at psych.uib.no
Wed Oct 8 08:41:57 CEST 2008


E. Krishnan wrote:
> 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

This one did not work on a Windows system using MikTex, but I'll have a 
look at it later today and see if I can find out why.  Thanks!

Tom




More information about the texhax mailing list