dcpurton / biblatex-sbl

Society of Biblical Literature (SBL) style files for biblatex
24 stars 5 forks source link

autocite within footnote #49

Closed folofjc closed 6 years ago

folofjc commented 7 years ago

The SBL style is that when citing in a footnote, the parentheses are used around the citation. The manual for the package states that if \autocite is used inside the \footnote command, it will put the citation in parentheses. However, all it does it place a new footnote superscript and does not place the actual citation anywhere. I used sbl-paper.tex as a starting point, and simply encapsulated one of the citations in the CITATIONS section inside a footnote to show the effect (footnote 3). See the attached file (change the extension from txt to tex). I also attached the pdf. sbl-paper.txt sbl-paper.pdf

For reference, I am using XeLaTeX and biber. I ran xelatex, followed by biber, followed by xelatex two more times to get the references right.

dcpurton commented 7 years ago

Thanks. I suspect this is because of this biblatex bug: https://github.com/plk/biblatex/issues/412

I'll have to see if I can fix it on the biblatex side. You can avoid it by not loading Hebrew support or using lualatex instead of xelatex. But be aware that bibi support for lualatex is a bit dodgy. I've tried to work around some problems, but there may be others.

folofjc commented 7 years ago

Ah, I didn't think about that. I really like xelatex and use Hebrew a lot, so doing \parencite isn't that big of a problem for me until they fix this. Thanks!

dcpurton commented 7 years ago

Actually.... I'm not sure about this. I need to test some more. It should work. And does with a basic document not using sbl-paper.sty

dcpurton commented 7 years ago

No, definitely a biblatex bug. This is enough to trigger it:

\documentclass{article}
\usepackage[style=verbose]{biblatex}
\usepackage{bidi}
\addbibresource{biblatex-examples.bib}
\begin{document}
Filler text.\footnote{Filler text \autocite{cotton}.}
\end{document}
dcpurton commented 7 years ago

Can you please check if adding this to your preamble (after loading sbl-paper.sty) fixes this issue and issue #48?

\makeatletter
\pretocmd{\@footnotetext}{\toggletrue{blx@footnote}}{}{}
\makeatother
folofjc commented 7 years ago

@dcpurton yep, that fixes both! Is this going to be added to the style, or do I need to put this after the loading sbl-paper.sty from now on?

folofjc commented 7 years ago

I spoke too soon on this one as well. The above does indeed fix the issue of parenthetical citations on the footnotes; however, that was all I was looking at when I posted the above comments. The downside is that it messes up any \autocite command that is not in a footnote. It puts them in parenthetical citation in the body of the text as well.

dcpurton commented 7 years ago

This still has problems, but can you please try this:

\makeatletter
\patchcmd\@footnotetext
  {#1}
  {\toggletrue{blx@footnote}#1}
  {\togglefalse{blx@tempa}}
  {}
\makeatother
folofjc commented 7 years ago

I haven't done extensive testing, but it appears to work. autocite outside a footnote makes a footnote, and within a footnote is parenthetical. I haven't tried autocites. However, as you noticed, this does not fix #48. Thanks!

dcpurton commented 7 years ago

I'm reasonable confident that this is the right solution. I'll leave it until the weekend until I create the pull request to biblatex in case you find problems.

lyndondrake commented 7 years ago

I've run into the same issue, and can confirm that the patchcmd fix above works for me.

Any idea when this will make its way out into a released version?

lyndondrake commented 7 years ago

Actually, it doesn't work properly after all. If I use \textcite in a footnote, which is what Pandoc generates quite frequently, I get parentheses around the citation, and the author name preceding the parentheses. \autocite in a footnote does what it's supposed to (i.e. puts the citation in parentheses). Without the patchcmd fix above, I get another superscript and the citation goes missing, so it's making some difference to the outcome. If I change the \textcite to just be \cite, it works as expected (i.e. citation text with no parentheses).

And I'm using Hebrew, polyglossia, and bidi, but no way to avoid any of it as that's kind of the point of what I'm doing

Any way I can hack things to make it work now would be much appreciated, even if a proper fix is further in the future.

folofjc commented 7 years ago

@lyndondrake If you look in the biblatex documentation, \textcite is supposed to print the author or editor outside the parentheses, with the citation label in parentheses after that. That is what it is supposed to do. Can you get pandoc to generate something other than textcite? Or can you just do a global find and replace for it, if you don't like it?

lyndondrake commented 7 years ago

@folofjc that's a good point - so long since I used latex that I'd forgotten. So actually it's more of a Pandoc issue (and thinking about it, might even need some extra syntax as the case I'm considering is hard to distinguish from an actual request for a \textcite with the current Pandoc syntax). Thanks for pointing it out.

So the patchcmd fix does actually work fine.

dcpurton commented 7 years ago

Actually, I find the behaviour of \textcite in the biblatex verbose styles (after which biblatex-sbl is modelled) a little unsatisfactory anyway. I don't really love the footnote mark coming immediately after the author. I'd prefer to use \citeauthor and then \autocite at the end of the sentence instead of \textcite in the body of the text.

For \textcite within a footnote, I think the author should be suppressed, e.g., ¹Author (Title, etc.) notes…. Perhaps it would make sense to suppress the author within the footnote when \textcite is used in the body of the document too. I'm not sure.

dcpurton commented 7 years ago

I'm not sure when this fix will make it into a release of bibatex, but I'd say one is due fairly soon, since the last one was in December last year. It's easy to use the development version though. Just make sure you are also using a development version of biber. Head over to the biblatex github page for instructions on how to use the development version.

lyndondrake commented 7 years ago

Agree with you on the suppression of the author for \textcite — I think in both cases would be most useful, but I guess divergence from the normal biblatex usage is problematic.

And I'll have a go with the development version, but won't be for a few weeks, as I have a deadline shortly and don't want to risk my toolchain this close to it.

Nhapsie commented 6 years ago

\autocite and \autocites appear to be working inside \footnote with proper parenthesis and brackets. We're using biblatex 3.7

dcpurton commented 6 years ago

@Nhapsie , are you sure? This issue isn't fixed until biblatex 3.8 which still isn't released. It only occurs in documents containing Hebrew (or other RTL scripts). The MWE in the fifth comment on this thread still fails for me.

Nhapsie commented 6 years ago

Got some unrelated warnings on your MWE, but it worked. I use xelatex. This mock example \footnote{Testing first one \autocite[5-10]{Muilenburg1969}. Testing second one \autocite[9-11]{Lofthouse1933}.} produces this amid the Hebrew:

screen shot 2017-10-19 at 9 03 39 pm

Nhapsie commented 6 years ago

When I use a MWE it does not work yet, as you say (I don't know how I got it to work above in my long project)

dcpurton commented 6 years ago

Perhaps you have the work around in your code somewhere.

dcpurton commented 6 years ago

biblatex 3.8 has now been released which fixes this issue. I've also released biblatex-sbl 0.8.2 which supports (and requires) biblatex 3.8. This is just a minor release and does not include the large number of changes and bug fixes in the development version.

lyndondrake commented 6 years ago

Wonderful, thanks for this

dcpurton commented 6 years ago

The biblatex-sbl update should be up on CTAN shortly and in TeXLive and MikTeX in a few days time.