I use revision control (Subversion, to be exact) to keep track of the edits to my LaTeX documents. Is there a LaTeX package that interfaces with revision control? Specifically, it would be nice to see the revision number and time and date inside the document. (Obviously, I'd turn this off in the final version.) Also, it might be nice to get a PDF showing what was added and removed in a given revision.
[Tex/LaTex] LaTeX packages for use with revision control
automationpackagesrevision controltools
Related Solutions
As you can't comment yet, here's a proposition using the tufte-latex
class and a custom environment. This is just what I made up, you could edit your question to specify what format and features you would like. The lipsum
package is just used for some dummy text.
\documentclass{tufte-book}
\usepackage{lipsum}
\newenvironment{loggentry}[2]% date, heading
{\noindent\textbf{#2}\marginnote{#1}\\}{\vspace{0.5cm}}
\begin{document}
\begin{loggentry}{2009-Oct-31}{Snow}
\lipsum[1]
\end{loggentry}
\begin{loggentry}{2010-Dez-31}{Water of Life}
\lipsum[2]
\end{loggentry}
\begin{loggentry}{2011-Nov-15}{Cold}
\lipsum[3-5]
\end{loggentry}
\begin{loggentry}{2012-Aug-24}{Sunrise}
\lipsum[6-7]
\end{loggentry}
\end{document}
Edit 1: Here's an automated version. It assumes your directory to be of the form /Year/Month/Day.tex
, formatted as e.g. 2012/Aug/24.tex
, so the month is just the first three letters. The individual .tex
files have only the requirement to have the first line as \mytitle{<The actual title here>}
.
This solutions makes use of Peter Grill's answer to "How to iterate through the name of files in a folder".
The main file:
\documentclass{tufte-book}
\usepackage{lipsum}
\usepackage{tikz}
\usepackage{xifthen}
\newenvironment{loggentry}[2]% date, heading
{\noindent\textbf{#2}\marginnote{#1}\par}{\vspace{0.5cm}}
\def\?#1{}
\pgfmathtruncatemacro{\StartYear}{2008}
\pgfmathtruncatemacro{\EndYear}{2012}
\newcommand{\writetitle}{0}
\newcommand{\mytitle}[1]
{ \ifthenelse{\writetitle=1}{#1}{}
}
\newread\mysource
\begin{document}
\foreach \Year in {\StartYear,...,\EndYear}
{ \foreach \Month in {Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec}
{ \foreach \Day in {1,...,31}
{ \IfFileExists{\Year/\Month/\Day}
{ \openin\mysource=\Year/\Month/\Day.tex
\read\mysource to \firstline
\closein\mysource
\xdef\writetitle{1}
\begin{loggentry}{\Year - \Month - \Day}{\firstline}
\xdef\writetitle{0}
\input{\Year/\Month/\Day}
\end{loggentry}
}
{ % files does not exist, so nothing to do
}
}
}
}
\end{document}
A sample log entry file:
\mytitle{Something happened}
\lipsum[3-5]
The Output:
Did you try a asking a search engine? One of the first links mentions svn-multi
, which can do exactly what you want to achieve.
You can get the info from your repository by adding this to your document.
\svnidlong
{$HeadURL$}
{$LastChangedDate$}
{$LastChangedRevision$}
{$LastChangedBy$}
after setting the svn:keywords
to HeadURL LastChangedDate LastChangedRevision LastChangedBy
.
With \usepackage{fancyhdr}
you can then add the info (Repository URL, last revision and time of last commit) like so
\pagestyle{fancy}
\fancyfoot{}
\fancyfoot[OR]{\tiny \href{\svnkw{HeadURL}}{Revision \svnkw{LastChangedRevision}} --- last commit on \svnkw{LastChangedDate} --- page \thepage}
\fancyfoot[EL]{\tiny page \thepage\ --- \href{\svnkw{HeadURL}}{Revision \svnkw{LastChangedRevision}} --- last commit on \svnkw{LastChangedDate}}
Take a look at this article by Mark Eli Kalderon in a PracTeX Journal from 2007, which explains everything nicely.
Best Answer
Yes, there are packages called
svn
andsvninfo
, as well as a few for other version-control systems. See the UK TeX FAQ: you can have something like\SVNdate $Date$
which will use the value of theDate
SVN variable in your document, or have footers containing the date and version number in the document. I don't think either of them shows diffs, though.