# Where can I put biblatex style modifications?

Finally, assuming that I'll want to use my style adjustments in a multitude of documents: Where do I put the relevant macro stuff?

The recommended answer is a copy of biblatex.cfg in one's local texmf tree. However, going away from above precondition:

What are all the places, i.e. file types and respective locations, where I can put `biblatex` style modifications?

I know you can write your own bbx and cbx styles, and there's probably a way to put modifications directly in a tex file? What are the limitations, advantages and disadvantages of each of these, which kind of modification typically goes where, which overrule others ...?

-

I am not sure to correctly understand your questions, but the BibLaTeX style files can be put in:

``````/texmf/tex/latex/biblatex/bbx ---> .bbx files (= bibliographies)
/texmf/tex/latex/biblatex/cbx ---> .cbx files (= in text citations)
/texmf/tex/latex/biblatex/lbx ---> .lbx files (= language strings)
/texmf/tex/latex/biblatex/    ---> other files (.cfg for instance)
``````

You can put most modifications directly in a `.cls`, `.sty` or `.tex` file as well (I say "most" to be on the safe side, I have not tried extensively but so far everything I have modified in a `.tex` file has worked).

The last modification overrides the previous ones as usual. Indeed, if you are writing in a `.tex` file, you must input your modifications after loading BibLaTeX, because it creates the macros and commands you will be using.

If you have somewhat significant modifications to make, it is better to put them in a dedicated style file in `texmf`, so as not to clutter your other files. Also, you can load any style file as an option to the `biblatex` package – which seems more appropriate than inputing / loading a separate file. (But nothing prevents you from making shortcuts to your style files if you are lazy to navigate `texmf` every time you want to change them.)

Whenever you make a style file, whatever method you pick, you run the risk that a BibLaTeX update may cause some errors (although it is very rare).

Edit (trying to make my answer more complete)

As regards writing style files, I would suggest finding the one that is closest to your needs in the `texmf-dist` folder, duplicating it to `texmf` and then modifying it. This way you can learn from the style, and you have something to start from.

As regards `.bbx` files, as hinted above they are used for typesetting the entire bibliography. Many styles eventually load `standard.bbx`. A typical file will contain some information about formatting fields (`\DeclareFieldFormat`), some information about formatting entries (`\DeclareBibliographyDriver`) and various user (re)defined macros.

In `.cbx` files, you will find some information about formatting fields (`\DeclareFieldFormat`) and the definition of various citation commands (`\DeclareCiteCommand` and `\DeclareMultiCiteCommand`). The latter are also implemented through macros.

The `.lbx` files contain language related information, which typically includes some typographic settings for the specific language, and the strings that BibLaTeX will use when printing citations and bibliographies (`\DeclareBibliographyStrings`).

-

The using of `biblatex.cfg` is recommend to get a clear main file and to get a structured header.

The place of the `cfg`-file depends of the using. If the `cfg`-file is relevant for only one or two projects you should put the `cfg`-file in the working directory.

If you create your own `cfg`-file for your daily work I recommend the local texmf tree. The easiest way to find the predefined folder is to use the following command:

``````kpsewhich --var-value TEXMFHOME
``````

In my case the result is `/home/marco/texmf`. It seems that this input doesn't work with MikTeX.

`TEXMFHOME`, like all trees, must be organized according to the TDS, or files may not be found.

The limitation of the `cfg` file is equal to `cbx` and `bbx` files. Commands which are defined for `lbx` files (language) don't work inside the `cfg`-files.

-
Is `kpsexpand` perhaps Linux-specific? It doesn't work in my Win 7 command line. –  doncherry Jan 7 '12 at 15:11
@doncherry `kpsexpand` is a deprecated command; its "modern" form is `kpsewhich --var-value TEXMFHOME`. `kpsewhich` is surely available with TeX Live, but I'm afraid it isn't with MiKTeX (at least with the full power it has on TeX Live). –  egreg Jan 7 '12 at 15:52
@doncherry: I'm running TeX Live 2011 on Windows 7 which allows `kpsewhich -expand-var '\$TEXMFHOME'`. Does that work? –  Werner Jan 7 '12 at 16:02
I'm using MiKTeX 2.9, and `kpsewhich` usually works, e.g. `kpsewhich geometry.sty`. @egreg's suggestion doesn't return anything, @Werner's returns `'\$TEXMFHOME'`. –  doncherry Jan 7 '12 at 16:20
@doncherry: I have a wild guess: for some reason, `TEXMFHOME` is not set at all. I get the same behaviour with MiKTeX 2.9 in one of my machines - an empty `TEXMFHOME`. If I ask `kpsewhich` to expand some of my environment variables, say, `kpsewhich --var-value \$HOME`, I get a proper output for that variable. –  Paulo Cereda Jan 7 '12 at 16:34