TransWikia.com

How to display Git console logs(==colored text) beautifully in LaTeX?

TeX - LaTeX Asked by toogley on June 14, 2021

I basically want a similar output in a direct LaTeX format, like the picture below. The Background color is not important, but e.g. the different colors of the commit hashs, the commit message and the branches. are.

==> I have to admit, i haven’t tried yet experimenting with a “manual” approach – so i’m basically searching for tips on how to achieve the best result.

==> At the moment, i’m using just pictures like the one below – but it feels not effective to deal with them, in comparison with just text.

EDIT In Addition: Although, i haven’t tried a text output yet, i think, the stars and lines on the left side (which do show the branch structure) would make a lot of problems, because i can’t use any multicolumn thing. right?

Thanks

2nd EDIT: I just found this answer: How can I produce the history graph of a Git repository in LaTeX? which doesn’t fully answer my problem but helps a bit – at least i completly overlooked it. ==> sorry.

git log --oneline --graph --all --decorate=short

2 Answers

If you do

git log --color --graph --oneline > l.txt

then you get the history including the terminal colour codes in l.txt then you can copy that to a verbatim environment.

Here I just made ^^[ active and grab everything up to an m and typeout a warning of the terminal code used, so you just need to define a suitable definition in each case. You can look up the codes, i made some of these up rather than checking exact colours.

enter image description here

documentclass{article}
usepackage{color}
begin{document}

{
letXXegrouprelax
expandafterdefcsname XX[31endcsname{%
  bgroupletXXegroupegroupleavevmodecolor{red}}
expandafterdefcsname XX[1;31endcsname{%
  bgroupletXXegroupegroupleavevmodebfseriescolor{red}}
expandafterdefcsname XX[32endcsname{%
  bgroupletXXegroupegroupleavevmodecolor{green}}
expandafterdefcsname XX[1;32endcsname{%
  bgroupletXXegroupegroupleavevmodebfseriescolor{green}}
expandafterdefcsname XX[33endcsname{%
  bgroupletXXegroupegroupleavevmodecolor{yellow}}
expandafterdefcsname XX[1;33endcsname{%
  bgroupletXXegroupegroupleavevmodebfseriescolor{yellow}}
expandafterdefcsname XX[34endcsname{%
  bgroupletXXegroupegroupleavevmodecolor{cyan}}
expandafterdefcsname XX[1;34endcsname{%
  bgroupletXXegroupegroupleavevmodebfseriescolor{cyan}}
expandafterdefcsname XX[35endcsname{%
  bgroupletXXegroupegroupleavevmodecolor{magenta}}
expandafterdefcsname XX[1;35endcsname{%
  bgroupletXXegroupegroupleavevmodebfseriescolor{magenta}}
expandafterdefcsname XX[36endcsname{%
  bgroupletXXegroupegroupleavevmodecolor{blue}}
expandafterdefcsname XX[1;36endcsname{%
  bgroupletXXegroupegroupleavevmodebfseriescolor{blue}}


expandafterdefcsname XX[endcsname{XXegroup}
catcode`^^[=13
def^^[#1m{%
expandafterifxcsname XX#1endcsnamerelax
typeout{XX#1}%
else
csname XX#1endcsname
fi}

begin{verbatim}
* [33m5f31460[m modify newtoken usage
* [33m07278ee[m updates for luatex 0.87
*   [33m0f6cd3d[m Merge pull request #59 from dohyunkim/master
[32m|[m[33m[m  
[32m|[m * [33m05359e2[m adapt to luatex 2015/10/01; v2.11.1
[32m|[m * [33m8b907ae[m v2.11.1
[32m|[m * [33m2be8e99[m merge master
[32m|[m * [33m5de368e[m minor
[32m|[m * [33me145179[m revert parsing routine to 9d4c96b
[32m|[m * [33m9ebfce3[m minor
[32m|[m * [33macde0ca[m fix a bug of prev commit
[32m|[m * [33m0c69d64[m allow btex ... etex even under mplibverbatim
[32m|[m * [33m9d4c96b[m no mplibpreamble upon verbatim mode
* [33m|[m   [33m1aadbba[m Merge pull request #58 from dohyunkim/master
[34m|[m[33m[m [33m[m  
[34m|[m [33m|[m[33m/[m  
[34m|[m * [33mfb5ac2a[m mplibverbatim{enable}. v2.11.0
[34m|[m * [33m7289e85[m use newtoken for checking pgf package
[34m|[m * [33m8f3e229[m simpler approach to compatible-with-beamer issue
[34m|[m * [33mb5b18c1[m allow access to type1 fonts
[34m|[m * [33m93ff22d[m check the existence of pgf token list using allocation number
[34m|[m * [33m1915aa7[m tex.tprint for the argument of pdfliteral
[34m|[m * [33m2696417[m check luaotfload package
[34m|[m * [33m2200616[m respect pgf transparency
[34m|[m[34m/[m  
*   [33mdf701d3[m Merge pull request #57 from dohyunkim/master
[36m|[m[1;31m[m  
[36m|[m * [33m5eae346[m address #55 again
* [1;31m|[m   [33m9c13a7a[m Merge pull request #56 from dohyunkim/master
[1;32m|[m[1;31m[m [1;31m[m  
[1;32m|[m [1;31m|[m[1;31m/[m  
[1;32m|[m * [33m1b418b7[m fix bug #55 regarding hash token
* [1;33m|[m   [33m8c3b5a0[m Merge pull request #54 from dohyunkim/master
[1;34m|[m[1;33m[m [1;33m[m  
[1;34m|[m [1;33m|[m[1;33m/[m  
[1;34m|[m * [33mec9504b[m ver 2.10.0
[1;34m|[m * [33mf2fe56e[m minor
[1;34m|[m * [33mbde5bc5[m mpcolor now accepts optional argument
[1;34m|[m * [33m5670830[m minor
[1;34m|[m * [33mfca7581[m bug: divide by 0
[1;34m|[m * [33m11a6ab4[m do not ignore VerbatimTeX() between beginfig and endfig
[1;34m|[m * [33m7d77d39[m minor: reduce duplicates
* [1;35m|[m   [33m96f2718[m Merge pull request #53 from dohyunkim/master
[1;36m|[m[1;35m[m [1;35m[m  
[1;36m|[m [1;35m|[m[1;35m/[m  
[1;36m|[m * [33m8417f30[m fix a bug reported via luatex mailing
* [31m|[m   [33m82006b9[m Merge pull request #51 from dohyunkim/master
[32m|[m[31m[m [31m[m  
[32m|[m [31m|[m[31m/[m  
[32m|[m * [33mc90f93d[m add some note about mplibcodeinherit
* [33m|[m   [33ma0714f5[m Merge pull request #50 from dohyunkim/master
[34m|[m[33m[m [33m[m  
[34m|[m [33m|[m[33m/[m  
[34m|[m * [33mb455d84[m introduce mplibcodeinherit
* [35m|[m   [33md29da12[m Merge pull request #48 from dohyunkim/master
[36m|[m[35m[m [35m[m  
[36m|[m [35m|[m[35m/[m  
[36m|[m * [33mf038aeb[m fix failure at btex % etex
[36m|[m * [33me9d3abd[m color package on plain tex: test file
[36m|[m * [33mbbb2c11[m color package on plain tex
* [1;31m|[m   [33ma0a071c[m Merge pull request #47 from dohyunkim/master
[1;32m|[m[1;31m[m [1;31m[m  
[1;32m|[m [1;31m|[m[1;31m/[m  
[1;32m|[m * [33mc14cd6a[m withoutcolor in dvi mode
[1;32m|[m * [33madeac15[m dvipdfmx color special
[1;32m|[m * [33m3a4b9fd[m suport spotcolor as well
[1;32m|[m * [33m2599413[m remove redundancy; update news
[1;32m|[m * [33me3e3eac[m mpxcolor for xcolor support
[1;32m|[m * [33m33dac8c[m add mp-luas.mpiv to noneedtoreplace table
[1;32m|[m * [33mf5a6fb7[m default TEXMFDIR is now TEXMFHOME
* [1;33m|[m   [33m751db55[m Merge pull request #46 from dohyunkim/master
[1;34m|[m[1;33m[m [1;33m[m  
[1;34m|[m [1;33m|[m[1;33m/[m  
[1;34m|[m * [33maf0c6e0[m TEXMFVAR might not exist
[1;34m|[m * [33mfc3cdf8[m new default cache dir
[1;34m|[m * [33m843983b[m support luatexbase 0.7- as well
[1;34m|[m * [33mb80db8d[m reused box can have mplibcode
[1;34m|[m * [33ma13a14a[m support dvipdfmx
[1;34m|[m * [33m574cc79[m indent uniformity
[1;34m|[m * [33m735dc9f[m adapt to new luatex engine and future luatexbase
[1;34m|[m * [33m95c39c2[m fix luatex crash under decimal mode
* [1;35m|[m   [33m515b95c[m Merge pull request #44 from dohyunkim/master
[1;36m|[m[1;35m[m [1;35m[m  
[1;36m|[m [1;35m|[m[1;35m/[m  
[1;36m|[m * [33m161ac34[m respect show command
[1;36m|[m * [33mfdc08d7[m minor
[1;36m|[m * [33mc965f75[m delete redundancy
[1;36m|[m * [33m6334db8[m fix bug regarding color and %g
* [31m|[m   [33mdd0fefc[m Merge pull request #42 from dohyunkim/master
[32m|[m[31m[m [31m[m  
[32m|[m [31m|[m[31m/[m  
[32m|[m * [33md53dc9d[m random_seed is int type
[32m|[m * [33mbd73b20[m add randomseed to load()
[32m|[m * [33m864f690[m follow mp code convention
[32m|[m * [33mcb51d91[m fontsize too ignore font part
* [33m|[m   [33ma294373[m Merge pull request #41 from dohyunkim/master
[34m|[m[33m[m [33m[m  
[34m|[m [33m|[m[33m/[m  
[34m|[m * [33m349cb9e[m warn textext() anomaly
[34m|[m * [33m4fa622c[m ignore font part of infont; avoid outputbox
[34m|[m * [33mc0578d7[m mention MPllx etc
* [35m|[m   [33m6844fb5[m Merge pull request #40 from dohyunkim/master
[36m|[m[35m[m [35m[m  
[36m|[m [35m|[m[35m/[m  
[36m|[m * [33mebf594a[m detokenize rather than unexpanded for textext protection
* [1;31m|[m   [33m546dd44[m Merge pull request #38 from dohyunkim/master
[1;32m|[m[1;31m[m [1;31m[m  
[1;32m|[m [1;31m|[m[1;31m/[m  
[1;32m|[m * [33m2ade1c1[m redefine fontsize as well
* [1;33m|[m   [33mbbfb821[m Merge pull request #37 from dohyunkim/master
[1;34m|[m[1;33m[m [1;33m[m  
[1;34m|[m [1;33m|[m[1;33m/[m  
[1;34m|[m * [33mfd47c4a[m minor doc update
[1;34m|[m * [33me680e55[m simpler infont
* [1;35m|[m   [33m976e452[m Merge pull request #36 from dohyunkim/master
[1;36m|[m[1;35m[m [1;35m[m  
[1;36m|[m [1;35m|[m[1;35m/[m  
[1;36m|[m * [33m94a9a7c[m redefine infont instead of thelabel
[1;36m|[m * [33m5fcc187[m mplibtextextlabel{enable}
* [31m|[m   [33m7990d6b[m Merge pull request #34 from dohyunkim/master
[32m|[m[31m[m [31m[m  
[32m|[m [31m|[m[31m/[m  
[32m|[m * [33mca8fca2[m use lfs.touch to identify original input file
[32m|[m * [33ma661f8b[m respect -output-directory
[32m|[m * [33m6759215[m --safer prevents caching
[32m|[m * [33m8d83566[m minor
[32m|[m * [33m48997b9[m 2.5.3
[32m|[m * [33m285fc6b[m cachedir under
* [33m|[m   [33m9898207[m Merge pull request #33 from dohyunkim/master
[34m|[m[33m[m [33m[m  
[34m|[m [33m|[m[33m/[m  
[34m|[m * [33mca2d466[m v2.5.2
* [35m|[m   [33mcdb8bd8[m Merge pull request #32 from dohyunkim/master
[36m|[m[35m[m [35m[m  
[36m|[m [35m|[m[35m/[m  
[36m|[m * [33m804de35[m [fix] newline char after endmplibcode
* [1;31m|[m   [33m06efef0[m Merge pull request #31 from dohyunkim/master
[1;32m|[m[1;31m[m [1;31m[m  
[1;32m|[m [1;31m|[m[1;31m/[m  
[1;32m|[m * [33m97025d1[m [fix] everymplib{%^^M
* [1;33m|[m   [33m33a1f69[m Merge pull request #29 from dohyunkim/master
[1;34m|[m[1;33m[m [1;33m[m  
[1;34m|[m [1;33m|[m[1;33m/[m  
[1;34m|[m * [33mcc56dff[m minor typo in doc
[1;34m|[m * [33me393870[m cache should be newer than luamplib.lua as well
[1;34m|[m * [33m89aedee[m mplibmakenocache, mplibcancelnocache
* [1;35m|[m   [33mbaa825c[m Merge pull request #28 from dohyunkim/master
[1;36m|[m[1;35m[m [1;35m[m  
[1;36m|[m [1;35m|[m[1;35m/[m  
[1;36m|[m * [33mb87847d[m date
[1;36m|[m * [33ma6f1bb7[m replace lf with cr after mplibcode
* [31m|[m   [33m65ffb67[m Merge pull request #27 from dohyunkim/master
[32m|[m[31m[m [31m[m  
[32m|[m [31m|[m[31m/[m  
[32m|[m * [33m0e8204d[m revert to endlinechar
* [33m|[m   [33m66cb229[m Merge pull request #26 from dohyunkim/master
[34m|[m[33m[m [33m[m  
[34m|[m [33m|[m[33m/[m  
[34m|[m * [33m5291b7e[m use obeylines instead of endlinechar
[34m|[m * [33ma81fbcd[m tried graph.mp and fixed some bugs
* [35m|[m   [33m610ff68[m Merge pull request #25 from dohyunkim/master
[36m|[m[35m[m [35m[m  
[36m|[m [35m|[m[35m/[m  
[36m|[m * [33m34e68bd[m version minor upgrade
[36m|[m * [33m5e6c3d4[m reduce waste of resources
* [1;31m|[m   [33m274b124[m Merge pull request #24 from dohyunkim/master
[1;32m|[m[1;31m[m [1;31m[m  
[1;32m|[m [1;31m|[m[1;31m/[m  
[1;32m|[m * [33m78b1ec6[m update doc
[1;32m|[m * [33ma266f23[m we can replace input mp file in finder
[1;32m|[m * [33m7a57a4f[m input foo might be behind comment sign
[1;32m|[m * [33m7a2dcf7[m add notice on leavevmode; hack to allow input file in current dir
[1;32m|[m * [33mf50fab0[m finder can now find '.mf' file
[1;32m|[m * [33mcb1744d[m quasi-graphictext
* [1;33m|[m   [33m7300631[m Merge pull request #23 from dohyunkim/master
[1;34m|[m[1;33m[m [1;33m[m  
[1;34m|[m [1;33m|[m[1;33m/[m  
[1;34m|[m * [33m58f2f4d[m update doc
[1;34m|[m * [33m569d5a3[m TEXMFROOT -> TEXMFDIR in Makefile
[1;34m|[m * [33m880421c[m v2.4
* [1;35m|[m   [33ma091ffe[m Merge pull request #22 from dohyunkim/master
[1;36m|[m[1;35m[m [1;35m[m  
[1;36m|[m [1;35m|[m[1;35m/[m  
[1;36m|[m * [33m3145db1[m provides numbersystem option
* [31m|[m   [33m8d5d279[m Merge pull request #20 from dohyunkim/master
[32m|[m[31m[m [31m[m  
[32m|[m [31m|[m[31m/[m  
[32m|[m * [33m3a66817[m typo in doc
* [33m|[m   [33m0e66721[m Merge pull request #18 from dohyunkim/master
[34m|[m[33m[m [33m[m  
[34m|[m [33m|[m[33m/[m  
[34m|[m * [33mcad5ad7[m correct version
[34m|[m * [33m09806d0[m restore # which is doubled when expanded
* [35m|[m   [33mc82d9ea[m Merge pull request #17 from dohyunkim/master
[36m|[m[35m[m [35m[m  
[36m|[m [35m|[m[35m/[m  
[36m|[m * [33m5e5945d[m update doc
[36m|[m * [33mae6312a[m fix a bug in protexttextext()
* [1;31m|[m   [33mf06ddfb[m Merge pull request #16 from dohyunkim/master
[1;32m|[m[1;31m[m [1;31m[m  
[1;32m|[m [1;31m|[m[1;31m/[m  
[1;32m|[m * [33mf8e6afc[m minor
[1;32m|[m * [33m7ef55a1[m update news; minor fix
[1;32m|[m * [33m8fd1b45[m allow raw tex commands esp. mpdim
[1;32m|[m * [33me02c7bb[m everymplib / everyendmplib
* [1;33m|[m   [33m796ff04[m Merge pull request #14 from dohyunkim/master
[1;34m|[m[1;33m[m [1;33m[m  
[1;34m|[m [1;33m|[m[1;33m/[m  
[1;34m|[m * [33maf45002[m fix bug of prescript parsing
[1;34m|[m * [33m1fea3ce[m repect only one verbatimtex before beginfig
* [1;35m|[m   [33m55b8656[m Merge pull request #13 from dohyunkim/master
[1;36m|[m[1;35m[m [1;35m[m  
[1;36m|[m [1;35m|[m[1;35m/[m  
[1;36m|[m * [33m0e61997[m update news
[1;36m|[m * [33m7f2b407[m do not ignore verbatimtex ... etex before beginfig()
[1;36m|[m * [33mde9c70d[m a little smaller pdf file
[1;36m|[m * [33macce6ae[m btex ... etex should be converted to rawtextext
[1;36m|[m * [33mfd1f451[m minor
[1;36m|[m * [33m3b4c198[m reverse order of transparency and shading
[1;36m|[m * [33mb4ed015[m %.3g instead of %.3f
[1;36m|[m * [33m3bc6a65[m metafun's transparency and shading
* [31m|[m   [33mf825ac0[m Merge pull request #11 from dohyunkim/master
[32m|[m[31m[m [31m[m  
[32m|[m [31m|[m[31m/[m  
[32m|[m * [33m6c4309a[m repect suffix of textext in metafun
[32m|[m * [33m67fe8af[m ignore fontmapfile primitive
[32m|[m * [33m188cebc[m rudimentary support of metafun format
[32m|[m * [33mf953ce9[m fix a bug regarding char <num> infont <font>
[32m|[m * [33md564c02[m fix a bug wrt withoutcolor option
* [33m|[m   [33m0c19957[m Merge pull request #10 from dohyunkim/master
[34m|[m[33m[m [33m[m  
[34m|[m [33m|[m[33m/[m  
[34m|[m * [33m2047fe9[m avoid error wrt 'withoutcolor'
* [35m|[m   [33m2a91178[m Merge pull request #9 from dohyunkim/master
[36m|[m[35m[m [35m[m  
[36m|[m [35m|[m[35m/[m  
[36m|[m * [33m17a6414[m recognize withcolor option for normal text as well
[36m|[m * [33m61810e4[m do not ignore 'withcolor' option
[36m|[m * [33m65f9ebd[m add some more test figs
[36m|[m * [33mb87ca4b[m mpfun seems to be a typo
[36m|[m * [33m5d85ab4[m making doc needs lualatex not pdflatex
[36m|[m * [33md564223[m more robust btex ... etex parsing
[36m|[m * [33mecbb950[m begingroup/endgroup is better than bgroup/egroup
[36m|[m * [33m6fabc67[m plain tex's mplibcode too is now local
* [1;31m|[m   [33mbc9f420[m Merge pull request #8 from dohyunkim/master
[1;32m|[m[1;31m[m [1;31m[m  
[1;32m|[m [1;31m|[m[1;31m/[m  
[1;32m|[m * [33m7dc700c[m v2.03
[1;32m|[m * [33m9a25014[m impl. textext(), TEX()
[1;32m|[m * [33m97ddbce[m minor change to latexmk options
[1;32m|[m * [33m11525df[m fix a bug regarding tex-text box inside for loop
[1;32m|[m * [33m33f7013[m ctan requires luamplib subdir
* [1;33m|[m   [33me5f985c[m Merge pull request #7 from dohyunkim/master
[1;34m|[m[1;33m[m [1;33m[m  
[1;34m|[m [1;33m|[m[1;33m/[m  
[1;34m|[m * [33mb61f744[m v2.01
* [1;35m|[m   [33m093d63a[m Merge pull request #6 from dohyunkim/master
[1;36m|[m[1;35m[m [1;35m[m  
[1;36m|[m [1;35m|[m[1;35m/[m  
[1;36m|[m * [33m5a84aae[m more fix about wrong baseline
[1;36m|[m * [33meea378c[m revert previous four commits
[1;36m|[m * [33mf791161[m allow mplibcode option [nopreamble]
[1;36m|[m * [33ma3cc88d[m mplibpreamble environment instead of simple command
[1;36m|[m * [33m1badcd9[m no unexpanded in user preamble
[1;36m|[m * [33maa12596[m implemented mplibpreamble
* [31m|[m   [33m87db82e[m Merge pull request #5 from dohyunkim/master
[32m|[m[31m[m [31m[m  
[32m|[m [31m|[m[31m/[m  
[32m|[m * [33me77087c[m wrong baseline of textext box
[32m|[m[32m/[m  
*   [33me14235b[m Merge pull request #4 from phi-gamma/master
[34m|[m[35m[m  
[34m|[m * [33m864159a[m comment trailing eol in LaTeX test
* [35m|[m   [33m7fbdb82[m Merge pull request #2 from phi-gamma/master
[36m|[m[35m[m [35m[m  
[36m|[m [35m|[m[35m/[m  
[36m|[m * [33m940c7ad[m Updating TODO
[36m|[m * [33m8ab7bd2[m Remove unneccessary dependencies
[36m|[m * [33meab41d2[m Adding a little more doc
[36m|[m * [33m5e9c09a[m Adding a test in plain too
[36m|[m * [33m02730f1[m Removing dead code from the old environment
[36m|[m * [33mb4cec06[m Document changes by Kim in the context code
[36m|[m * [33macd0bc3[m Readme update
[36m|[m * [33m1ad7746[m GPLv2 instead of CC0
[36m|[m * [33m4f1be99[m Minor doc update
[36m|[m * [33m333e511[m Minor dtx fix
[36m|[m * [33ma3a03c0[m Update doc style and Makefile (pdflatex -> lualatex)
[36m|[m * [33mfc11100[m A few more locals
[36m|[m * [33m12643df[m Using luatexbase info, log and err
[36m|[m * [33m37d6401[m Add test file for LaTeX
[36m|[m * [33m0736d9f[m Fixing minor errors
[36m|[m * [33mc3950c2[m use mplib catcodes for both Latex and Plain
[36m|[m * [33me08e168[m fix missing upvalues
[36m|[m * [33ma4c9bd8[m import Kim’s patch to luatex-mplib.tex
[36m|[m * [33m36b31ae[m import Kim’s patch to luatex-mplib.lua
[36m|[m * [33m6c9f5e2[m keep % as comment char
[36m|[m * [33m67d5417[m sync with current luatex-mplib as of 2013-05-07
[36m|[m[36m/[m  
* [33maeb2380[m 1.09
* [33m2acbb2b[m Apply patch by Paul Vojta, fixing spurious spaces.
* [33m94d5d08[m Add test file for spurious spaces.
* [33m366c021[m don't git-ignore test files, not generated here
* [33m209aa02[m Make: clean more thoroughly
* [33md41326c[m update todo
* [33m8271a0d[m Bump version for bugfix release.
* [33mce98ddf[m Fix bug with some characters in {luamplib}.
* [33m6e8471b[m fix Makefile
* [33m130e879[m Bump version and update NEWS.
* [33mac37021[m dump a few ideas in a todo file
* [33m1e3cee4[m Rm mem files support.
* [33mec5e2a5[m No need to repeat the namespace all over the place
* [33m36708be[m rationalize error functions
* [33m688b66a[m gitignore a few files
* [33me2e8815[m Makefile: add a "check" target!
* [33m5bf11ef[m Change author/maint/contact info.
* [33m6a112d8[m fix make clean & typo in readme
* [33m47a432c[m update support adress
* [33m0589dea[m version & news
* [33m77a123a[m Bugfix per Hans.
* [33ma61b0ad[m Adapt to luatexbase v0.3. Now v1.05.
* [33me2addb8[m bumping date and version number
* [33m4738e08[m adding two test files
* [33mc4a735c[m fixing a bug in LaTeX's detection
* [33m5aaeb7d[m renaming the .mem file into mplib-luatex.mem, which should be present in TeXLive 2010.
* [33m9bd9429[m replacing luadirect by directlua
* [33m5ad7ee6[m Adding a NEWS file
* [33mb61538e[m Using the new luatexbase system and bumping version
* [33mc2c43a6[m A very french typo
* [33m02dc8f2[m adapting luamplib to TeXLive 2009, the .mem file is no longer needed (though used in TeXLive 2009)
* [33mc05d9c9[m very small adaptation to the new luatextra
* [33m06e0753[m Update URI in the Readme.
* [33m126ba5f[m Minimale code reformating.
* [33mcb10fa7[m Rename TEXMF to TEXMFROOT in Makefile.
* [33md2c0a94[m New target `install TEXMF=/path/to/root'.
* [33mc44d4d3[m Fix the `manifest' target.
* [33me3cde74[m Luamplib's README: install, manifest, licence.
* [33m79af410[m Makefile's: new 'manifest' target.
* [33md602d78[m Makefile: adapt CTAN distribution, clean up.
* [33ma28a3e3[m harmonizing the version numbers and dates (sometimes several were present in the .dtx
* [33m911f6ac[m Packaging: no .drv, Makefile with a 'ctan' target.
* [33m23c342b[m adding the README files for some packages
* [33m94254cc[m loading luaotfload by default in pdf mode, adding a missing ProvidesPackage in luamplib, and precising an error
* [33m733b00c[m some small code formatting, and copyright clarification on luainputenc.sty
* [33m7e7c67e[m first working version of luainputenc, and directlua0 renaming in luamplib
* [33m711e324[m first working version of luaminimalotf and minimal corrections in luamplib
* [33md927dd3[m a first working version of luamplib
* [33m85410ad[m An extra function for luatextra.lua, a dirty bug fix, and almost finishing luamplib.
* [33mcbb73e0[m commit of the current state of the packages
end{verbatim}
}
end{document}

Correct answer by David Carlisle on June 14, 2021

There are a few tools that can do this conversion process automatically. My preference is ansifilter.

To use ansifilter, first, install by following the instructions here.

Now, pipe the command of interest through ansifilter. For your example you would run:

git log --color --graph --oneline | ansifilter --latex > log.tex

The resulting log.tex is a LaTeX-compatible, with the appropriate colours. For example: enter image description here

ansifilter also supports a colour map if you want to use custom colours. Refer to the manual: https://gitlab.com/saalen/ansifilter#user-content-color-mapping.

Answered by Migwell on June 14, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP