Hightor / gitlog

Typeset git logs as bibliographies
2 stars 1 forks source link

Other bibliographies in the same document #2

Open longborough opened 9 years ago

longborough commented 9 years ago

How do we allow for the git change log to inhabit the same document as other, more conventional bibliographies?

moewew commented 8 years ago

Maybe When/How should a class load biblatex over at TeX.SX can give you some pointers.

One problem is that once you start rolling your own .bbx/.cbx style and use that, the user cannot chose their own preferred style with style=... or bibstyle=.../citestyle=.... In your case one could probably work around that by simply not writing a new .bbx and putting your definitions into the .sty.

(Further) Clashes can be avoided by not using the standard environment bibliography, but instead something like \defbibenvironment{gitbib}, you then need \printbibliography[env=gitbib] to use that environment. Also you can give your macros such as date+author a prefix: gitlog:date+author to make sure they don't clash with other standard macros.

The \DeclareFieldFormats can be made type-specific using the optional argument: \DeclareFieldFormat[gitcommit]{entrykey}{\ttfamily[#1]}.

Note that normally one would write \setunit*{\addcomma\space} instead of \setunit*{, }.

longborough commented 8 years ago

Thank you so much for your valuable contribution. For the moment, I'm a bit overpowered with Real Work, and all this is going to need some study, but I promise I'll take all these ideas on board. Happy New Year!

PTNobel commented 8 years ago

I'm working on this problem by trying to implement @moewew suggestions.

The only issue I'm encountering is a way to get bibLaTeX to load the .dbx file.

Any ideas on how to use an existing Entrytype? Or how to tell bibLaTeX to load a .dbx?

PTNobel commented 8 years ago

I switched to using @customa for the entry type and usera for storing the commit hash.

moewew commented 8 years ago

You should be able to load a .dbx file with the datamodel option. One can however only load one datamodel file (besides the standard and the style's .dbx), if you want to allow the user to do more, you could have a look at biblatex-multiple-dm (the package is inspired by TeX.SX: Datamodel distribution with biblatex).

PTNobel commented 8 years ago

@moewew Well I think the way I ended up implementing it should work, but I'll look through the webpages you linked.

moewew commented 8 years ago

Yep, I think it should work, too. But it looks nicer if you have customise type names and such (especially since a user now wouldn't be able to use usera), although since most of the stuff is created automatically that might not be that big an issue.

PTNobel commented 8 years ago

@moewew disregard my now-deleted comment, I hadn't seen you're latest comment. The user can still usera, just not in customa. usera is the field. However your criticism is valid against the customa, though I've never seen it used.

moewew commented 8 years ago

Oh yes I got the two mixed up.

I agree that I haven't seen customa out in the wild (luckily nowadays people are advised to roll their own datamodel). But it could be that some older biblatex styles use this internally (not sure, I certainly know of styles that use usera and stuff, but I'm not sure if they define new entrytypes).

longborough commented 8 years ago

I have merged the pull request, and then reverted it. This is only temporary, as I wanted to make it into a feature branch, and am suffering from a bit of github incompetence. I'll sort this out properly in the next few days, I hope. Thank you for the contribution.

PTNobel commented 8 years ago

Any idea when this will be pushed to CTAN?

PTNobel commented 8 years ago

Anything I can do to help get this feature on CTAN?