1

I have read that the spanish-apa.lbx file contains the command \setcounter{smartand}{0} to prevent the ampersand from showing up and uses y instead. However, I can't seem to manage to get this right when using \parencite, or actually any other citation for more than one author while using the Spanish biblatex-apa style.

MWE:

\documentclass{article}
\usepackage[english,spanish]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[style=apa,backend=biber]{biblatex}
\DeclareLanguageMapping{spanish}{spanish-apa}
\usepackage{csquotes}

\begin{filecontents}{refs.bib}
@book{Guy2010,
Author = {Some Guy and Another Dude},
Publisher = {A Publisher},
Title = {A reference book to everything},
Year = {2010}
}
\end{filecontents}

\addbibresource{refs.bib}

\begin{document}
Localisation is a headache. \parencite{Guy2010}
\printbibliography
\end{document}

The Spanish lbx file is up to date, and everything in general works as expected.

edit:

I followed the instructions given below (refer to Alan Munn's answer) but it turns out I was doing in the wrong place. After I created the proper local texmf structure to host the renewed file where it should be, everything is working as expected. Thank you very much for the expertise!

  • Welcome to TeX.sx and thanks for adding a nice minimal example. What happens if you add \setcounter{smartand}{0} after the \DeclareLanguageMapping{spanish-apa} declaration? – Alan Munn Jul 5 '15 at 1:16
  • Nothing changes, no matter where I place it. – absay Jul 5 '15 at 1:23
  • Ok, but actually the setting that spanish-apa.lbx uses is 0 which means all 'y' and 'e' get replaced by '&'. So this is the expected behaviour. Do you want to get 'y' and 'e' instead? – Alan Munn Jul 5 '15 at 1:32
1

The default setting for the spanish-apa style is that all 'and' gets replaced by &, i.e., it will not be realized as 'y' or 'e'.

For reasons I don't quite understand, changing the value of the counter anywhere has no effect. I think this is due to the following description in the biblatex documentation about how localization files are loaded:

All localization modules are loaded on demand in the document body.

So if I make a local copy of spanish-apa.lbx and comment out the \setcounter{smartand}{0} line, I can then change the value of the counter in the preamble and things work as expected (0= always '&', 1= 'y' or 'e' depending on context, 2=always 'y', 3=always 'e').

Simple solution

The simple solution in Ulrike's answer is probably the easiest to implement:

\begin{document}
\setcounter{smartand}{1}
\selectlanguage{spanish}

More permanent solution

So for the moment (unless someone can explain how to overcome the behaviour) you will need to make a local copy of spanish-apa.lbx with the \setcounter line commented out and then set the value of smartand yourself in the preamble.

To make a local copy of the .lbx file, it's preferable to rename it to something else so that you remain aware that you are using a modified copy of it. The copied file should reside either in the same folder as your .tex file (if you are only doing this once), or in your local texmf folder, inside texmf/tex/latex/biblatex. Then instead of loading spanish-apa you load your renamed copy. Here's an example of what your document would look like. I've named the local copy smartand-spanish-apa.

\documentclass{article}
\usepackage[english,spanish]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[style=apa,backend=biber]{biblatex}

\DeclareLanguageMapping{spanish}{smartand-spanish-apa}
\setcounter{smartand}{3} % 0, 1, 2 or 3

\usepackage{csquotes}

\begin{filecontents}{\jobname.bib}
@book{Guy2010,
Author = {Some Guy and Another Dude},
Publisher = {A Publisher},
Title = {A reference book to everything},
Year = {2010}
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

Localisation is a headache. \parencite{Guy2010}
\printbibliography
\end{document}
  • Thank you. Unfortunately, while setting the value to 1, 2 or 3 works for the citation, the reference is duplicating the surname of the last author. – absay Jul 5 '15 at 1:56
  • Yes, I got that once, but can't reproduce it. Try deleting all your aux files and recompiling. – Alan Munn Jul 5 '15 at 2:06
  • Done. Problem persists on my end. – absay Jul 5 '15 at 2:17
  • @absay Strange. I have changed the counter to all the values and it works fine. – Alan Munn Jul 5 '15 at 2:24
  • Sorry for the question but when you say "make a local copy" you mean I have to copy the contents of spanish-apa.lbx into the preamble of my tex file? – absay Jul 5 '15 at 2:31
2

The smartand value is used in spanish.lbx which is loaded by spanish-apa.lbx. So you don't have a chance to change it. But you can do this:

\documentclass{article}
\usepackage[english,spanish]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[style=apa,backend=biber]{biblatex}
\DeclareLanguageMapping{spanish}{spanish-apa}
 %reactivate smartand:
\makeatletter
\DefineBibliographyExtras{spanish}
    {\setcounter{smartand}{1}% or some other value
     \let\lbx@finalnamedelim=\lbx@es@smartand
     \let\lbx@finallistdelim=\lbx@es@smartand}
\makeatother     
\usepackage{csquotes}

\begin{filecontents}{refs.bib}
@book{Guy2010,
Author = {Some Guy and Another Dude},
Publisher = {A Publisher},
Title = {A reference book to everything},
Year = {2010}
}
\end{filecontents}

\addbibresource{refs.bib}

\begin{document}
Localisation is a headache. \parencite{Guy2010}
\printbibliography
\end{document}

Edit

An alternative is to change the value after the begin of the document and trigger the reevaluation of the language settings:

\begin{document}
\setcounter{smartand}{1}
\selectlanguage{spanish}

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.