I'm having a bit of trouble to use a custom style found on CTAN. This is the biblatex-swiss-legal. In my MWE, it basically produces no output, especially not in the expected format. The default style works fine (commented line).

Goal & requirements

MY target is to use Latex to automate the production of a set of documents. The processing needs to be semi-automated to produce a final PDF using some scripts in an other language. The end goals is then to (1) retrieve the separate code, (2) merge them and then (3) generate the full PDF using latex.

My constraint is that it needs to follow the Swiss Legal requirements in terms of citations. Consequently, the formatting of the quote is really tricky, and this is my final steps to produce a working prototype.

From some other questions here, I can deduce that this biblatex style package is slightly outdated. I've got basically no experience with the creation of custom style for biblatex. Moreover, I've got some further constraints, as my end document needs to be:

  1. In french or german, hence using polyglossia & csquotes
  2. Custom font, hence compiled using xelatex
  3. Using abbreviation (not here in MWE), hence using glossaries

Question 1 - Effort to update the full package ?

What would be the effort to update the package ? Is there any documentation on how to port an entire package into the “new” biblatex format ?

Question 2 - How could I only take the relevant part ?

Most of the code from this style will not be used. There are plenty of other function which I don't need.

Hence, how could I only take the “article” part and then plug it in a separate style ? I'm not sure what is needed and my first tryouts created a lot of errors.

Final note

This is my very first post on SO and TeX board. Hence please let me know if/how I could improve my future submissions. Thanks!

MWE Code

% MweBiblatex Swiss Legal

% Needed by Biblatex

\usepackage[style=biblatex-swiss-legal-general, backend=biber, bibencoding=UTF8]{biblatex}
% \usepackage[backend=biber, bibencoding=UTF8]{biblatex}

    author      = {Druey, Jean-Nicolas},
    title       = {Grundriss des Erbrechts, 6e ed.},
    publisher   = {Aucun},
    date        = {2016},
    location    = {Berne},

En matière de successions, le CC offre aux héritiers plusieurs façons de procéder \cite{druey}.

My goal as a real citation and as pseudo-code in the reference table  and in a citation
\textsc{Druey} Jean-Nicolas, \textit{Grundriss des Erbrechts, 6e ed}, Berne 2016

And this should be cited as : "\textsc{Druey}"
  • 2
    This is an object-lesson in how to ask a question. I suspect the trouble is that the style has not been updated to reflect the change in the way names are handled. This is probably not a very difficult fix, but I don't have time to look at it until later this evening. – Paul Stanley Apr 12 '18 at 10:16
  • 1
    I did a preliminary check and I believe there's plenty of deprecated code in the style, unfortunately. Including names, as noted by Paul Stanley, but not only. As far as I can tell, at least all the name formatting directives and sorting templates would have to be redefined. That's probably doable (it usually is), but I'd like to suggest you to consider something else. (continues...) – gusbrs Apr 12 '18 at 12:35
  • 1
    (...continued) Given this lagging behind of the style in maintenance, and as it appears you are trying to set a proper workflow on this, you have to ponder whether you wish to rely on it on longer term. An alternative would be to choose another (standard?) style which comes close to the one you want, and then customize it to reach the desired results. It might require more initial effort, but may be worth in the longer term. I'm not acquainted with the Swiss legal style, is there any standard style that comes close to it? – gusbrs Apr 12 '18 at 12:41
  • @gusbrs, thanks for your comment. You're right, there is plenty of deprecated code. I'll still need to. In short, my requirement for citing is that its should output a list of the authors family name, all in Small caps and separated by a "/". The last 2 parts are settings that I can easily change in a style, but any recommendation on the standard style to choose ? – XaWin Apr 13 '18 at 7:22
  • You received sound recommendations from moewe. As to what style you should choose as base, you have two kinds of alternatives, either biblatex's standard styles or the contributed ones based on biblatex. The standard styles are usually more customizable/flexible. Other styles are frequently made in order to meet one or another style guide and, sometimes, go through great lengths to achieve the style specifications, eventually making them less flexible. So there is this tradeoff between flexibility and proximity to your end results. (continues...) – gusbrs Apr 13 '18 at 10:41

The latest version of biblatex-swiss-legal dates back to January 2014. Primary development seems to have happened in 2012, with a bug fix release in 2013. The 2014 release seems to have added a few new features. So that style is more than four years old.

In general one can't give a cut-off point at which older styles go bad and can't or shouldn't be used any more. There is no 'old' and 'new' biblatex, the progress happens one version at a time.

There is, however, one major biblatex change that impacted many styles: biblatex 3.3 significantly changed the name handling in a backwards incompatible way. See Biblatex 3.3 name formatting. Many styles that were written before version 3.3 came out in March 2016 will have problems with that. Depending on how deep these styles went into the internals of the name macros they could get away fine because the compatibility code that is in place works for them, they could give undesired output in certain situations if the compatibility code catches some but not all cases, or they cause errors because they use outdated macros for which there is no compatibility code.

There were several other (smaller) changes to internals: Most recently in version 3.8, where a few field names and macros were renamed. https://github.com/plk/biblatex/wiki/Name-Changes

Care is taken[citation needed] that only necessary changes are made to internals and that there are at least some measures in place to provide backwards compatibility. But it simply is not always possible to not break existing styles if the package is to move forward.

Additionally, newer versions sometimes implement more elegant or more stable ways to do certain things, and styles can greatly benefit from using the new methods. But this does not make the older styles fail. It just means that when adapting older styles one should always look for new commands that make the life easier than it was a few years ago.

To answer your questions:

How much work is it going to be?

One can't really tell from the outset how much work getting the package up and running again would be. But I expect it would involve considerable effort if one does not simply want to patch up the bits that don't work, but modernise the style to be use new features. You don't only need to know your biblatex, you also need to have a good understanding of the expected output. Modernising a package only from the code without explicit guidance on what the output should be like is quite tricky (you never know if unusual code was used to implement a particular quirk of the expected output, because simpler code was not available when the package was first written or for other reasons entirely).

Is there documentation?

There is no documentation to port something to the 'new biblatex format', because there is no such thing. For many particular changes you will find a question on this site that helps you Biblatex 3.3 name formatting, comments in the biblatex CHANGES.md or the version history in the documentation. The warning and error messages you receive when you run an outdated style can often already give a hint what is going on.

From what I can see from the package code, your main problem is the new name format. A good 120 lines deal with names and most of that needs to be modernised. The sort schemes (now sort templates) also need to be changed. Most bits of the rest of the code look quite solid even though it does not always follow best practices established after the package was written. Very few bits look a bit weird (some have a comment saying that the author was aware of that fact).

How can I surgically remove only @article and implant it somewhere else?

If you only want to preserve certain parts of the style, you need to copy what you are interested in. Then you need to follow and examine the definitions of the commands and macros used in the interesting bits. You will have to copy every macro and definition that the code you are interested in could possibly use. You will also have to copy code that is not explicitly called by the lines you want, but only implicitly. I'm guessing here, but I would say if only wanted to copy the code for @book and @article in biblatex-swiss-legal, you could easily end up copying about two thirds of the original code.

While an approach taking only the parts of the code you expect to need might work for styles that are sufficiently similar to biblatex's standard styles, I doubt it would be a viable option here.

So what are your options here?

Your first step should be to try to contact the maintainer(s) of biblatex-swiss-legal. Development of the package has stalled, but maybe they are still using it or developing it privately, you might be lucky. Don't get your hopes up too high, though.

If you can't reach the maintainers or they can't help you getting the package back on track, you have two options:

  1. Try to modernise the package (ideally with permission from the original maintainers, you could become the new maintainer of the package, the LPPL allows to take over maintenance if the current maintainer does not respond).
  2. Write a new package from scratch.

My money would be on the second approach. Restarting from scratch has the huge advantage that you are not forced to adopt the same strategy as biblatex-swiss-legal, but you can get inspired by their code if you are stuck.

  • Thanks for this really developed answer, as it not only answers my question but also provide a lot of insights in the process of creating a new style and the evolution of biblatex. Even before I contacted the maintainer and I'll see what happen. But as you mentioned, this style is not compatible with the most recent version of biblatex and it would require time, also for the maintainer. I'll try to refine my requirements and make a simple new style. But my deadline do not allow a lot of time. – XaWin Apr 13 '18 at 7:18
  • 1
    @XaWi Maybe gist.github.com/moewew/c15dcbe6a7a23e007a9ed65b7d7aa567 is a start. – moewe Apr 13 '18 at 7:44
  • thanks for the example, I could "diff" it with the original file I had. However, the file cannot produce an output. I only get cryptic error. So after refining my need, I'll go for the approach "Write a new package from scratch.". I tried this, but I failed to manage the first basic steps. But this is a topic for another question, I guess. – XaWin Apr 13 '18 at 14:36
  • @XaWi What was the cryptic error if I may ask? Maybe some of the other files of the bundle need to be modified as well, I didn't check. Butk writing a new style from scratch is definitely the better idea. For a gentle introduction to what you can do you'll want to read tex.stackexchange.com/q/12806/35864 (maybe you already knew that). Some of the guides linked in tex.stackexchange.com/q/13509/35864 also cover more involved topics so could be of help as well. You'll also find many questions on this site. If you work step by step I'm sure you'll find great help here. – moewe Apr 13 '18 at 14:42
  • @XaWi From your punctuation I guess you speak French as your first language, but if you are Swiss chances are you know a little German. There was a great two-part article in the journal of the German TeX users group (biblatex.dominik-wassenhoven.de/dtk.shtml). The articles are almost 10 years old now and a few things have changed, but the general approach is still the same. There are also texwelt.de/blog/modifizieren-eines-biblatex-stils and texwelt.de/blog/hilfe-zu-biblatex – moewe Apr 13 '18 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.