BibTeX, biblatex and biber ⇒ Parsing cite$ to replace "&" with "\&"
-
- Posts: 2
- Joined: Sun Oct 18, 2009 2:32 pm
Parsing cite$ to replace "&" with "\&"
The cite keys are 18 or 19 characters long. I want to be able to print the cite key in the reference and still include the '&' where it occurs.
Is it feasible to chop up and reassemble strings in Bibtex before outputting them?
Currently I have a line in my .bst file, in FUNCTION {article} (etc) that says (in simplified form):
cite$ output
This delivers the cite key string to the output, and, with a console error, the keys that contain '&', but with the & dropped.
I'm using Mac OS X, TexShop, Latex2e, the current Bibtex, and a Bibdesk database. I'm using the natbib package.
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
-
- Posts: 2
- Joined: Sun Oct 18, 2009 2:32 pm
Parsing cite$ to replace "&" with "\&"
It needed the package xstring and a \newcommand macro in the Latex file, called from within Bibtex.
This is what I used in the Latex file:
Code: Select all
\newcommand{\ampersandmacro}[1]{%
\IfSubStr{#1}{&}{\StrBefore{#1}{&}\&\StrBehind{#1}{&}}{[#1]}
}
Code: Select all
"\ampersandmacro{" cite$ *
"}" *
output
DN