Skip to content

Commit

Permalink
Allow citation tracking/back references in floats (#916)
Browse files Browse the repository at this point in the history
  • Loading branch information
moewew committed Mar 6, 2020
1 parent 5df79eb commit 18e39d5
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 13 deletions.
5 changes: 5 additions & 0 deletions doc/latex/biblatex/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
`\printunit` is needed instead of `\setunit` to stop subsequent
`\setunit`s from overriding `\intitlepunct` in case of missing
fields.
- Added options `backreffloats` and `trackfloats` to enable/disable
citation tracking and back references in floats.
Note that citation tracking in floats can lead to undesirable
results in case the float objects floats too far from its "natural"
position.
- Added `\mautocite` and `\Mautocite`.
- Added `\NumsCheckSetup` and `\PagesCheckSetup` for finer control
of the `\ifnumerals` and `\ifpages` checks.
Expand Down
24 changes: 17 additions & 7 deletions doc/latex/biblatex/biblatex.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2254,6 +2254,11 @@ \subsubsection{Preamble Options}

\end{valuelist}

\boolitem[true]{backreffloats}

Whether to enable back references to citations in floats.


\optitem[false]{indexing}{\opt{true}, \opt{false}, \opt{cite}, \opt{bib}}

This option controls indexing in citations and in the bibliography. More precisely, it affects the \cmd{ifciteindex} and \cmd{ifbibindex} commands from \secref{aut:aux:tst}. The option is settable on a global, a per-type, or on a per-entry basis. The possible choices are:
Expand Down Expand Up @@ -2671,7 +2676,7 @@ \subsubsection{Preamble Options}
\item[spread] Enable the tracker in spread mode. In this mode, tracking works on a per"=spread (double page) basis.
\end{valuelist}

Note that this tracker is disabled in all floats, see \secref{aut:cav:flt}.
Note that this tracker is disabled in all floats unless explicitly requested with \opt{trackfloats}, see \secref{aut:cav:flt}.

\optitem[false]{citecounter}{\opt{true}, \opt{false}, \opt{context}}

Expand All @@ -2695,7 +2700,7 @@ \subsubsection{Preamble Options}
\item[constrict] This mode combines the features of \opt{context} and \opt{strict}.
\end{valuelist}

Note that this tracker is disabled in all floats, see \secref{aut:cav:flt}.
Note that this tracker is disabled in all floats unless explicitly requested with \opt{trackfloats}, see \secref{aut:cav:flt}.
This option is also settable on a per-type or per-entry basis.

\optitem[false]{ibidtracker}{\opt{true}, \opt{false}, \opt{context}, \opt{strict}, \opt{constrict}}
Expand All @@ -2710,7 +2715,7 @@ \subsubsection{Preamble Options}
\item[constrict] This mode combines the features of \opt{context} and \opt{strict}. It also keeps track of footnote numbers and detects potentially ambiguous references in footnotes in a stricter way than the \opt{strict} option. In addition to the conditions imposed by the \opt{strict} option, a reference in a footnote will only be considered as unambiguous if the current citation and the previous citation are given in the same footnote or in immediately consecutive footnotes.
\end{valuelist}

Note that this tracker is disabled in all floats, see \secref{aut:cav:flt}.
Note that this tracker is disabled in all floats unless explicitly requested with \opt{trackfloats}, see \secref{aut:cav:flt}.
This option is also settable on a per-type or per-entry basis.

\optitem[false]{opcittracker}{\opt{true}, \opt{false}, \opt{context}, \opt{strict}, \opt{constrict}}
Expand All @@ -2725,7 +2730,7 @@ \subsubsection{Preamble Options}
\item[constrict] This mode combines the features of \opt{context} and \opt{strict}. See the explanation of \kvopt{ibidtracker}{constrict} for details.
\end{valuelist}

Note that this tracker is disabled in all floats, see \secref{aut:cav:flt}.
Note that this tracker is disabled in all floats unless explicitly requested with \opt{trackfloats}, see \secref{aut:cav:flt}.
This option is also settable on a per-type or per-entry basis.

\optitem[false]{loccittracker}{\opt{true}, \opt{false}, \opt{context}, \opt{strict}, \opt{constrict}}
Expand All @@ -2740,7 +2745,7 @@ \subsubsection{Preamble Options}
\item[constrict] This mode combines the features of \opt{context} and \opt{strict}. See the explanation of \kvopt{ibidtracker}{constrict} for details. In addition to that, this mode also checks if the \prm{postnote} argument is numerical (based on \cmd{ifnumerals} from \secref{aut:aux:tst}).
\end{valuelist}

Note that this tracker is disabled in all floats, see \secref{aut:cav:flt}.
Note that this tracker is disabled in all floats unless explicitly requested with \opt{trackfloats}, see \secref{aut:cav:flt}.
This option is also settable on a per-type or per-entry basis.

\optitem[false]{idemtracker}{\opt{true}, \opt{false}, \opt{context}, \opt{strict}, \opt{constrict}}
Expand All @@ -2755,9 +2760,13 @@ \subsubsection{Preamble Options}
\item[constrict] This mode is similar to \opt{context} with one additional condition: a reference in a footnote will only be considered as unambiguous if the current citation and the previous citation are given in the same footnote or in immediately consecutive footnotes.
\end{valuelist}

Note that this tracker is disabled in all floats, see \secref{aut:cav:flt}.
Note that this tracker is disabled in all floats unless explicitly requested with \opt{trackfloats}, see \secref{aut:cav:flt}.
This option is also settable on a per-type or per-entry basis.

\boolitem[false]{trackfloats}

Whether to enable citation tracking in floats. Citation tracking in floats can be tricky, so this option should only be enabled if absolutely necessary and the output should be scrutinised carefully, see also \secref{aut:cav:flt}.

\boolitem[true]{parentracker}

This option controls the parenthesis tracker which keeps track of nested parentheses and brackets. This information is used by \cmd{parentext} and \cmd{brackettext} from \secref{use:cit:txt}, \cmd{mkbibparens} and \cmd{mkbibbrackets} from \secref{aut:fmt:ich} and \cmd{bibopenparen}, \cmd{bibcloseparen}, \cmd{bibopenbracket}, \cmd{bibclosebracket} (also \secref{aut:fmt:ich}).
Expand Down Expand Up @@ -13189,7 +13198,7 @@ \subsubsection{External Abstracts and Annotations}
\subsubsection{Trackers in Floats and \acr{TOC}/\acr{LOT}/\acr{LOF}}
\label{aut:cav:flt}

If a citation is given in a float (typically in the caption of a figure or table), scholarly back references like <ibidem> or back references based on the page tracker get ambiguous because floats are objects which are (physically and logically) placed outside the flow of text, hence the logic of such references applies poorly to them. To avoid any such ambiguities, the citation and page trackers are temporarily disabled in all floats. In addition to that, these trackers plus the back reference tracker (\opt{backref}) are temporarily disabled in the table of contents, the list of figures, and the list of tables.
If a citation is given in a float (typically in the caption of a figure or table), scholarly back references like <ibidem> or back references based on the page tracker get ambiguous because floats are objects which are (physically and logically) placed outside the flow of text, hence the logic of such references applies poorly to them. To avoid any such ambiguities, the citation and page trackers are temporarily disabled in all floats unless explicitly requested with \opt{trackfloats}. In addition to that, these trackers plus the back reference tracker (\opt{backref}) are temporarily disabled in the table of contents, the list of figures, and the list of tables.

\subsubsection{Mixing Programming Interfaces}
\label{aut:cav:mif}
Expand Down Expand Up @@ -14203,6 +14212,7 @@ \section{Revision History}

\begin{changelog}
\begin{release}{3.15}{20??-??-??}
\item Added \opt{trackfloats} and \opt{backreffloats}\see{use:opt:pre:gen}
\item Added \cmd{mautocite} and \cmd{Mautocite}\see{use:cit:mct}
\item Added \cmd{NumsCheckSetup} and \cmd{PagesCheckSetup}\see{aut:aux:msc}
\item Added \cmd{AtEveryEntrykey}\see{aut:fmt:hok}
Expand Down
31 changes: 25 additions & 6 deletions tex/latex/biblatex/biblatex.sty
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,19 @@
{}}
{}}
{}%
\apptocmd\@floatboxreset
{\boolfalse{citetracker}%
\boolfalse{pagetracker}}
\iftoggle{blx@trackfloats}
{}
{\blx@err@patch{floats}}%
{\apptocmd\@floatboxreset
{\boolfalse{citetracker}%
\boolfalse{pagetracker}}
{}
{\blx@err@patch{floats}}}%
\iftoggle{blx@backreffloats}
{}
{\apptocmd\@floatboxreset
{\boolfalse{backtracker}}
{}
{\blx@err@patch{floats}}}%
\ifdef\TX@endtabularx % tabularx/memoir
{\pretocmd\TX@endtabularx
{\addtocounter{tabx@nest}{1}}% track nested tabularx environments
Expand Down Expand Up @@ -14485,6 +14493,10 @@
\def\blx@opt@backrefsetstyle@memandset{4}
\def\blx@opt@backrefsetstyle@setplusmem{5}
\newtoggle{blx@backreffloats}
\DeclareBibliographyOption[boolean]{backreffloats}[true]{%
\settoggle{blx@backreffloats}{#1}}
\appto\blx@mkhyperref{%
\ifHy@plainpages
\blx@warning@noline{%
Expand Down Expand Up @@ -14738,6 +14750,11 @@
\let\blx@loccitreset\blx@loccitreset@context
\booltrue{citetracker}}
\newtoggle{blx@trackfloats}
\DeclareBibliographyOption[boolean]{trackfloats}[true]{%
\settoggle{blx@trackfloats}{#1}}
\DeclareBibliographyOption[boolean]{parentracker}[true]{%
\ifstrequal{#1}{true}
{\let\bibopenparen\blx@bibopenparen
Expand Down Expand Up @@ -15217,8 +15234,10 @@
maxnames=3,minnames=1,maxalphanames=3,minalphanames=1,
maxitems=3,minitems=1,mincrossrefs=2,minxrefs=2,useauthor=true,useeditor=true,
usetranslator=false,indexing=false,abbreviate=true,dateabbrev=true,dateera=astronomical,
backref=false,backrefsetstyle=setonly,pagetracker=false,ibidtracker=false,
idemtracker=false,opcittracker=false,loccittracker=false,citetracker=false,
backref=false,backrefsetstyle=setonly,backreffloats=true,
pagetracker=false,
ibidtracker=false,idemtracker=false,opcittracker=false,loccittracker=false,
citetracker=false,trackfloats=false,
citecounter=false,block=none,language=autobib,clearlang=true,autolang=none,
date=comp,labeldate=year,origdate=comp,eventdate=comp,urldate=short,
autopunct=true,punctfont=false,defernumbers=false,timezeros=true,
Expand Down

0 comments on commit 18e39d5

Please sign in to comment.