2

My .bib file has a number of entries in the Title field which are double bracketed. This preserves lower-case letters in the title which I don't want. I want my bibliography style to sort out the capitalization. Here's an abbreviated entry which illustrates the problem.

@Article{     Widerker2013,
  Author    = {Widerker, D. and Goetz, S.},
  Title     = {{Fischer against the dilemma defence: the defence
          prevails}}
}

What I'm trying to get is something like this:

@Article{     Widerker2013,
  Author    = {Widerker, D. and Goetz, S.},
  Title     = {Fischer against the dilemma defence: the defence
          prevails},
}

I have been using BibTool's rewrite.rule command to try and fix this. I've been using regular expressions to specify the desired output format. But it's not working and I have no idea why. Here is the command I've been using in a .rsc file.

rewrite.rule { Title # "^\{\{(.*)\}\}$" # "^\{\1\}$" }

Running BibTool with this command doesn't return an error. But it also seems to do absolutely nothing. The Title field is exactly the same.

I have been running BibTool in a directory on my desktop, but I can't imagine that's the source of the problem. Here's what I'm doing in the command line:

./bibtool -r lib/myresource -i old.bib -o new.bib

What gives?

  • I'm not familiar with the exact flavour of RegEx bibtool uses, but are you sure about the $ in \{(.$)\}? – moewe Feb 5 '18 at 8:12
  • Welcome to TeX.SX! Please help us (and also you) and add a minimal working example with bibliography (MWEB), that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass and ending with \end{document}. – Bobyandbob Feb 5 '18 at 8:18
  • @meowe Good call on the $. I mistyped. I intended *. I changed the mistake in the original post. @Bobyandbob This is primarily a BibLaTeX question. I'm using the software BibTool on a .bib file in order to clean up the bibliography. I'm not typesetting anything - there is no PDF output, nor do I ever run pdflatex in the process. I input a .bib and output a .bib. So, I'm not sure how to respond to your request for more code. – ndsmith Feb 5 '18 at 12:53
2

You can use Biber and its tool mode instead of bibtool (which I have never used).

Create a file called stripbraces.conf with the contents

<?xml version="1.0" encoding="UTF-8"?>
<config>
  <output_align>true</output_align>
  <output_fieldcase>lower</output_fieldcase>
  <sourcemap>
    <maps datatype="bibtex" level="user">
      <map>
        <map_step map_field_source="title" map_match="\A\{(.*)\}\Z" map_replace="$1"/>
      </map>
    </maps>
  </sourcemap>
</config>

in the same directory as your .bib file.

Then run

biber --tool --configfile=stripbraces.conf <yourbibfile>.bib

Biber will then process the .bib file and produce a file called <yourbibfile>_bibertool.bib in which the braces of title fields have been stripped.

The regular expression \A\{(.*)\}\Z might be too eager in some cases, so could try \A\{([^\}\{]*)\}\Z which is not eager enough in some cases.

| improve this answer | |
  • This did the trick. I tried the "less eager" regular expression string you suggested first, and that didn't work. But the Biber fix solved the issue. Thanks! – ndsmith Feb 6 '18 at 6:29

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.