MiKTeX / miktex

the MiKTeX source code
https://miktex.org
Other
793 stars 94 forks source link

Problem with \smartand option with spanish-apa of biblatex #371

Closed mihdicaballero closed 5 years ago

mihdicaballero commented 5 years ago

Hi! This questión might seem very specific, but I'm having an issue making a change of the smartand command using MiKTeX in windows 10 when I try to process my references with the spanish-apa style of the BibTeX package. I tried to compile this with Tex Live or Overleaf and it worked, so I don't know what is wrong with Miktex. I have all the latest packages updated.

What I want to do is to change the ampersand & in references to a "y" for Spanish, but the change doesn't occur in my document. I send attached an example file showing this issue.

Thanks in advance!

Biblatex and biber.zip

edocevoli commented 5 years ago

Thank you. It works for me (see attached PDF). Biblatex_and_biber.pdf

edocevoli commented 5 years ago

If you still have an issue: please attach your broken PDF.

mihdicaballero commented 5 years ago

The PDF is not broken, it just doesn't compile right. For my example to work you need to compile with Biber and not BibTeX, because the backend of biblatex package is biber. What happens is that the ampersand & is showing in the "Referencias" when there are several authors and not the letter "y" to separate the las author.

I don't consider this issue resolved at all by your answer, so please remove the "closed" status.

I attach two images: how it looks with MikTeX and how it should look. How it looks with MikTeX How it looks

How it should look (image from Overleaf) How it should look

edocevoli commented 5 years ago

If you want progress on this issue, then please explain the steps necessary to reproduce the issue. Please read and understand the contribution guidelines.

edocevoli commented 5 years ago

I can reproduce your output PDF by running pdflatex/biber/pdflatex. I don't thing that this is a MiKTeX specific issue because I get a similarf PDF with TeX Live. See attached PDFs.

miktex.pdf texlive.pdf

mihdicaballero commented 5 years ago

Hi! Thank you for your answers. I missed the part of pdflatex-biber-pdflatex-pdflatex procedure for compiling.

The thing is that the PDF result you are getting doesn't represent the change made by the following code:

\makeatletter \DefineBibliographyExtras{spanish} {\setcounter{smartand}{1}% or some other value \let\lbx@finallistdelim=\lbx@es@smartand \let\lbx@finalnamedelim=\lbx@es@smartand} \makeatother

That code is what changes the "&" for a "y" in Spanish in the References. I've seen in forums how they apply that code and works for them, and the only difference is the MikTeX compiler. Running the same code in Overleaf (with Tex Live) does give the correct result as I showed in the previous post. So I don't think your Tex Live is up to date or something.

Thanks!

edocevoli commented 5 years ago

But I have a fresh TeX Live installation on Windows.

jorgepz commented 5 years ago

Hello, I hope my test and comment help to figure this out.

I understand that @mihdicaballero wants to obtain a "y" as separator using MikTeX and biber in Windows.

He produced a code (zip) which produces that separator in overleaf but not in MikTeX.

@edocevoli posted a pdf where the separator "&" is produced, thus, the problem that @mihdicaballero stated seems to be reproduced.

I use linux and did this other tests:

I compiled the zip using texlive in linux (pdflatex version 3.14159265-2.6-1.40.18 ) and obtained the "y" as separator in "... J. E. y Ratiu..." (see my pdf attached). I am using Texstudio (version 2.12.6) with Biber as bibliography command. This is the expected behavior that @mihdicaballero wants to obtain using also MikTex in windows.

Ubuntu_Texlive.pdf

On the other hand, @edocevoli attached the texlive.pdf ( https://github.com/MiKTeX/miktex/files/3632642/texlive.pdf ) where the "&" is shown as separator in "...J. E. & Ratiu..." .

There seems to be a few non-neglectable differences in the outputs obtained using MikTeX/texlive using windows/linux.

Best, Jorge

moewew commented 5 years ago

This has nothing to do with MikTeX as such, the fact that you could reproduce the issue with MikTeX but not on TeX live or Overleaf is only due to different package versions. Presumably your MikTeX systems are fairly up to date. On the other hand Overleaf is known for running an outdated TeX live (though I hear they will switch to a slightly newer TeX live soon) and 3.14159265-2.6-1.40.18 that @jorgepz reports is also older, which suggests his TeX live is not quite up to date either (note that 3.14159265-2.6-1.40.18 is the pdfTeX version which need not correspond to a specific TeX live or biblatex or biblatex-apa version, as most of these are largely independent, but it can give us ballpark figures).

There were some changes in biblatex-apa, which mean that the code from the first post needs some additional help with. I should note that biblatex-apa was specifically written to implement the requirements of the APA, there is only very limited (read: no) support for deviations from that style.

You can try

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

\makeatletter
\DefineBibliographyExtras{spanish}{%
  \setcounter{smartand}{1}%
  \renewbibmacro*{name:delim:apa:family-given}[1]{%
    \ifnumgreater{\value{listcount}}{\value{liststart}}
      {\ifboolexpr{
         test {\ifnumless{\value{listcount}}{\value{liststop}}}
         or
         test \ifmorenames
       }
         {\printdelim{multinamedelim}}
         {\lbx@finallistdelim{#1}}}
      {}}%
}
\makeatother

\DefineBibliographyStrings{spanish}{%
  andothers = {et al\adddot},
}

\addbibresource{biblatex-examples.bib}

\begin{document}
\nocite{sigfridsson,kowalik}
\cite{sigfridsson}
\printbibliography
\end{document}

which produces

Kowalik, F. e Isard, M. (1995, 11 de enero). Estimateur d’un défaut de fonctionnement d’un modulateur en quadrature et étage de modulation l’utilisant. 9500261.

Sigfridsson, E. y Ryde, U. (1998). Comparison of methods for deriving atomic charges from the electrostatic potential and moments. Journal of Computational Chemistry, 19(4), 377-395. doi:10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P

screenshot of the entries above

on an up-to-date MikTeX for me (it will also work on a current TeX live, but may not work correctly on an outdated installation as run on Overleaf).

jorgepz commented 5 years ago

Hi, thank you very much @moewew . I compiled the .tex you posted in with a slightly more updated Arch Linux texlive 3.14159265-2.6-1.40.20, and in a Win 10 updated MikTeX and both produced the correct output using "y". Thank you also @edocevoli and the rest of the contributors for your great work!