summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/rcs-multi/example.tex
blob: 827d7949b4a02b83017cc0750e3b7e7d78a1982c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
\documentclass[12pt]{report}
\usepackage{rcs-multi}
% Version control information:
\rcsid{$Id: example.tex,v 1.2 2009/03/23 19:07:46 martin Exp martin $}
% or, alternatively, with full path:
\rcsid{$Header: /home/martin/src/latex/rcs-multi/dev/example.tex,v 1.2 2009/03/23 19:07:46 martin Exp martin $}

% Other keywords can be read using:
\rcskwsave{$Author: martin $}
\rcskwsave{$Date: 2009/03/23 19:07:46 $}
\rcskwsave{$Name:  $}
% The `Log' keyword is not supported.
\rcskwsave{$Locker: martin $}
\rcskwsave{$RCSfile: example.tex,v $}
\rcskwsave{$Revision: 1.2 $}
\rcskwsave{$Source: /home/martin/src/latex/rcs-multi/dev/example.tex,v $}
\rcskwsave{$State: Exp $}
% Their values can be typeset using \rcskw{Author}, \rcskw{Date}, etc.

\usepackage{hyperref}
%\usepackage{url}

\usepackage{fancyhdr}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\setlength{\headheight}{14.5pt}
% This will display the last changed date and revision of the current chapter.
% Change to `\rcsdate -- \rcsrev' if you like to have the document revision.
\newcommand{\rcsfooter}{Last Changed: \rcsfiledate -- r\rcsfilerev}

\pdfinfo{%
  /CreationDate (D:\rcspdfdate)
}

\rcsRegisterAuthor{johnd}{John Doe}
\rcsRegisterAuthor{maryd}{Mary Doe}
\rcsRegisterAuthor{martin}{Martin S.}
\rcsRegisterRevision{1.2}{Version~1}


%% The two 'filecontents' environments are used to produce two example chapters.
%% Normally they are separated files from the beginning but they are packed into 
%% this main file to only have one example TeX file in the CTAN ZIP file.
\begin{filecontents}{example_chap1.tex}
% Version control information:
\rcsid{$Header: /home/martin/src/latex/rcs-multi/dev/example_chap1.tex,v 1.3 2009/03/23 19:20:18 martin Exp $}

\chapter{Example Chapter 1}

\section*{Version}
\subsection*{This chapter}
% \url is needed because there is an underscore in the name
% The package 'underscore' seems not to work properly, so the 'hyperref'
% package is used which is not the best solution. Avoid underscore in LaTeX filenames.
Filename: \rcsnolinkurl{\rcsfilename}\\*
URL: \url{\rcsfileurl}\\*
% Something like \href{\rcskw{HeadURL}}{Download} works also!
\textbf{Last change}\\*
Revision: \rcsfilerev\\*
Date: \rcsfiledate\\*
Year: \rcsfileyear\\*
Time: \rcsfilehour:\rcsfileminute:\rcsfilesecond\\*
Author: \rcsfileauthor\\*

\enlargethispage{\baselineskip}
\subsection*{Whole document}
Main Filename: \rcsnolinkurl{\rcsmainfilename}\\*
Main URL: \url{\rcsmainurl}\\*
\textbf{Last change}\\*
Filename: \rcsnolinkurl{\rcsname}\\*
URL: \url{\rcsurl}\\*
Revision: \rcsrev\\*
Date: \rcsdate\\*
Year: \rcsyear\\*
Time: \rcshour:\rcsminute:\rcssecond\\*
Author: \rcsauthor\\*
% [...]

\section{Tests}
\rcsRegisterRevision{2.1}{Test}

Registered author name: \rcsFullAuthor{\rcsfileauthor}\\*
Registered revision name: \rcsFullRevision{\rcsfilerev}\\*
Registered author name (*): \rcsFullAuthor*{\rcsfileauthor}\\*
Registered revision name (*): \rcsFullRevision*{\rcsfilerev}\\*

\subsubsection*{Behaviour if value is not registered:}
Not registered user name: \rcsFullAuthor{someusername}\\*
Not registered revision name: \rcsFullRevision{1.4}\\*
Not registered user name (*): \rcsFullAuthor*{someusername}\\*
Not registered revision name (*): \rcsFullRevision*{1.4}\\*


\end{filecontents}

\begin{filecontents}{example_chap2.tex}
% Version control information:
\rcsid{$Header: /home/martin/src/latex/rcs-multi/dev/example_chap2.tex,v 1.2 2009/03/23 19:10:56 martin Exp martin $}

\chapter{Example Chapter 2}

\section*{Version}
\subsection*{This chapter}
% \url is needed because there is an underscore in the name
% The package 'underscore' seems not to work properly, so the 'hyperref'
% package is used which is not the best solution. Avoid underscore in LaTeX filenames.
Filename: \rcsnolinkurl{\rcsfilename}\\
URL: \url{\rcsfileurl}\\
% Something like \href{\rcskw{HeadURL}}{Download} works also!
\textbf{Last change}\\
Revision: \rcsfilerev\\
Date: \rcsfiledate\\
Year: \rcsfileyear\\
Time: \rcsfilehour:\rcsfileminute:\rcsfilesecond\\
Author: \rcsfileauthor\\

\enlargethispage{\baselineskip}
\subsection*{Whole document}
Main Filename: \rcsnolinkurl{\rcsmainfilename}\\
Main URL: \url{\rcsmainurl}\\
\textbf{Last change}\\
Filename: \rcsnolinkurl{\rcsname}\\
URL: \url{\rcsurl}\\
Revision: \rcsrev\\
Date: \rcsdate\\
Year: \rcsyear\\
Time: \rcshour:\rcsminute:\rcssecond\\
Author: \rcsauthor
\end{filecontents}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\listfiles
\begin{document}

\begin{titlepage}
 \hbox{}
 \pdfbookmark{Title Page}{titlepage}
 \vspace{8ex}
 {\huge Title\par}
 \vspace{2ex}
 {\large \noindent This is an example document for the \texttt{rcs-multi}
  package. Please also look at the LaTeX source code of this
 document.}
 \vfill
 \flushleft\sffamily
 Version control information:\\
 Head Filename: \rcsnolinkurl{\rcsmainfilename}\\
 Head URL: \rcsnolinkurl{\rcsmainfileurl}\\
 Last changed file (name): \rcsnolinkurl{\rcsname}\\
 Last changed file (URL): \rcsnolinkurl{\rcsurl}\\
 Last changed date: \rcsdate\\
 Last changes revision: \rcsrev\\
 Version: \rcsFullRevision*{\rcsrev}\\
 Last changed by: \rcsFullAuthor*{\rcsauthor}\\
\end{titlepage}

% Include chapters
\include{example_chap1}
\include{example_chap2}
%\include{example_chap3}

\end{document}