Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Any suggestions how to allow UTF-8 @string macros in the mwe.bib file? [lines 537-539]

@string{          Uà   =   {Università} #.                           }
@string{        Uàdi   =   Uà#di                                     }
@string{      UàdSdi   =   Uà#degli# {Studi} #di                     }

@PhdThesis{mwe,
  author =   {Some Guy},
  title =    {On something},
  school =   Uàdi# {Padova},
  %school =      UàdSdi# {Bologna},
  year =     2010,
}

I have this setup:

\RequirePackage[T1]{fontenc}
\RequirePackage[utf8]{inputenc}
\RequirePackage{newunicodechar}
\RequirePackage[backend=biber%
,bibencoding=utf8,texencoding=utf8,style=numeric-comp%
,sorting=none,sortcites=true,block=none,indexing=false%
,citereset=none,isbn=true,url=true,doi=true]{biblatex}%

and use this in mwe.tex:

\addglobalbib[datatype=bibtex,type=file]{mwe.bib}
\begin{document}
\cite{mwe}
\printbibliography
\end{document}

then run:

biber mwe

and get:

WARN - BibTeX subsystem: /tmp/I5WGNx_9Fe/mwe.bib_16327.utf8, line 537, warning: overriding existing definition of macro "u"
ERROR - BibTeX subsystem: /tmp/I5WGNx_9Fe/mwe.bib_16327.utf8, line 538, syntax error: found "di", expected "="
share|improve this question
2  
Don't use accented characters for the string name. Then write Universit\`a, which is completely equivalent to the "accented character" version. –  egreg Sep 25 '12 at 13:55
    
@egreg: i might as well revert to stock /usr/bin/bibtex; i had in mind some biber.conf with perhaps "sourcemap" tricks: say, a preparse that would map "Uà" to "Ua_it" and then match/replace everywhere (not within "", '') Ua_it for , in a temporary file? –  sjbiaga Sep 25 '12 at 14:09
1  
This would need hacking in btparse. I already did this for names and entry keys. I would have to look at it. –  PLK Sep 25 '12 at 17:30
1  
I think (private communication) because of your hacked scan.c from btparse you used to allow "~" and "@" in names (which we should allow really as bibtex allows it), you reverse the manual changes I made for UTF-8 a couple of years ago. I bet this works with vanilla Text::BibTeX 0.64 –  PLK Sep 25 '12 at 18:07
    
This should be possible with biber as the backend - can you confirm this? I believe that the problem was a side-effect of your testing with custom btparse to fix another issue? –  PLK Sep 26 '12 at 9:23

1 Answer 1

Your given MWE has several errors, so I tried to correct it. As @egreg mentioned in his comment don't use special characters in string names. If you use something like di in a string (see your MWE) it is interpreted as macro. So define a string di or just use {...} to make clear it should be inserted as normal text. Please see the changed string definitions in my MWE.

I do not know the used language so I just guessed to build the following without an error or warning (the warning that mwe.bib (\jobname.bib gives mwe.bib, if your texfile is stored as mwe.tex) is overwritten is correct and can be ignored) compiling:

%http://tex.stackexchange.com/questions/74037/a-way-to-use-bibliography-utf8-string-entry-keys
\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@string{          Ua = {Universit\`a } #.             }
@string{        Uadi = Ua#{ di }                      }
@string{      UadSdi = Ua#{ degli }# { Studi } #{ di }}

@PhdThesis{mwe,
  author = {Some Guy},
  title  = {On something},
  school = Uadi# {Padova},
  year   = 2010,
}
@PhdThesis{mwe1,
  author = {Some Guy},
  title  = {On something},
  school = UadSdi# {Bologna},
  year   = 2010,
}
\end{filecontents*}

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{newunicodechar}
\usepackage[%
  backend=biber
 ,bibencoding=utf8
 ,texencoding=utf8
 ,style=numeric-comp
 ,sorting=none
 ,sortcites=true
 ,block=none
 ,indexing=false
 ,citereset=none
 ,isbn=true
 ,url=true
 ,doi=true
]{biblatex}%

\addglobalbib[%
   datatype=bibtex
  ,type=file
  ,backend=biber
]{\jobname.bib}
\begin{document}
\cite{mwe} \cite{mwe1}
\printbibliography
\end{document} 

If I missunderstood you please feel free to change my given MWE.

share|improve this answer
    
@sjbiaga There is no reaction of you, so may I ask if my MWE helped you? –  Kurt Jun 10 '13 at 12:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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