Skip to content

Instantly share code, notes, and snippets.

@Lenchik
Forked from ScumCoder/git.tex
Created August 7, 2016 19:27
Show Gist options
  • Save Lenchik/1cbb3933aeb58353deb82c932e45968f to your computer and use it in GitHub Desktop.
Save Lenchik/1cbb3933aeb58353deb82c932e45968f to your computer and use it in GitHub Desktop.
Код для печати git hash в колонтитуле
\usepackage{python}
%Добавляет на каждую страницу hash текущего git-коммита
\begin{python}
#! /usr/bin/python
import os, string
cmd = 'git rev-parse --verify HEAD'
fpipe = os.popen(cmd)
piperesult = fpipe.read()
fpipe.close()
filename='gitstatus.tex'
fout=open(filename,'w')
fout.write(piperesult)
fout.close()
\end{python}
\fancyfoot[R]{}
\fancyfoot[C]{\tiny Версия документа: \input{gitstatus}, компилирован \today}
\fancyfoot[L]{}
% Чтобы убрать полосу вверху страницы, отчёркивающую колонтитул от содержания страницы
\renewcommand{\headrulewidth}{0pt}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment