Tag Info

New answers tagged

0

here is my solution: use \write18 to write a temp.dat file which contains 2 commands: \gdef\GITHash{...} \gedf\GITDate{...} then input that file, the \GITxxx will get defined. We can use it anywhere, e.g. running title. \makeatletter \immediate\write18{git log -1 --pretty=format:"\@backslashchar gdef\@backslashchar GITHash{\@percentchar h}\@percentchar n ...


3

If I were to do without any package, this would be something in the following style. It assumes something like $name$ or $name:<space>stuff<space>$. If spaces were optional, the code would have to be correspondingly adapted, which is not hard (for someone versed in TeX's macro language!). \documentclass[12pt]{article} \makeatletter \def\hg ...


2

I find it convenient using xparse and expl3 features, which avoid complicated cases. \documentclass[12pt]{article} \usepackage{xparse} \NewDocumentCommand{\hg}{>{\SplitArgument{1}{:}}r$$} {% \processhg#1% } \ExplSyntaxOn \NewDocumentCommand{\processhg}{mm} { \IfNoValueTF{#2} {\hg_define_hg:nn { #1 } { None } } {\hg_define_hg:nn { #1 } { #2 ...



Top 50 recent answers are included