Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ibid. and idem support #5

Open
jjmccollum opened this issue Sep 20, 2021 · 11 comments
Open

Ibid. and idem support #5

jjmccollum opened this issue Sep 20, 2021 · 11 comments

Comments

@jjmccollum
Copy link
Owner

Ibid. (shorthand for a subsequent in-text citation of the last source cited in the text) and idem (shorthand for an author identical to the last author cited in the text) should be supported as optional citation style parameters. I suggest using the argument names useibid and useidem, following biblatex-sbl. These should be added to mult-def.lua as language-dependent parameter names as follows:

["useibid"]={
 ["en"]="useibid",
},
["useidem"]={
 ["en"]="useidem",
},

(I have only added their English names at this time). They should default to no in publ-imp-sbl.mkvi:

% General rules to be inherited or excepted by other types of citations
\definebtx
  [sbl:\s!cite]
  [sbl]
  [
  ...
   \c!useibid=\v!no, % useibid=yes will enable abbreviation of consecutive citations of the same entry as "ibid."
   \c!useidem=\v!no, % useidem=yes will enable abbreviation of an author cited multiple times consecutively as "idem"
   ...
   ]

They can be set by the user using the \setupbtx command:

\setupbtx[sbl:cite][
  useibid=yes,
  useidem=yes
]

Ideally, we would then use a similar setup to the one used by Chicago (and inherited by SBL) to handle the same author in subsequent list entries, using the \btxdoifsameaspreviouselse macro. Unfortunately, the \btxdoifsameaspreviouselse macro only works in the bibliographic list, as it uses existing indices in the list to determine what the "previous" entry is. For inline citations, we do not have such a structure that we can query. I have attempted to accomplish the desired functionality using a variable that is updated each time an inline or short citation is invoked, as follows:

% Define a helper for previous author handling
\let\btx_sbl_previousinlinetag\empty% the tag of last entry cited inline

% Define handlers for idem handling in inline citations
\startsetups sbl:inline:idem
  \doifelse{\btxparameter\c!useidem} {\v!yes} {
    \doifelse{\btxdirect{\btxfoundname{author}}\btxdirect{withauthor}}{\clf_btxdirect{\currentbtxdataset}{\btx_sbl_previousinlinetag}{\btxdirect{\btxfoundname{author}}}\clf_btxdirect{\currentbtxdataset}{\btx_sbl_previousinlinetag}{withauthor}} {
      \btxlabeltext{sbl:idem}
      \btxcomma
    } {
      \texdefinition{btx:sbl:inline:author}
    }
  } {
    \texdefinition{btx:sbl:inline:author}
  }
\stopsetups

\startsetups sbl:short:idem
  \doifelse{\btxparameter\c!useidem} {\v!yes} {
    \doifelse{\btxdirect{\btxfoundname{author}}\btxdirect{withauthor}}{\clf_btxdirect{\currentbtxdataset}{\btx_sbl_previousinlinetag}{\btxdirect{\btxfoundname{author}}}\clf_btxdirect{\currentbtxdataset}{\btx_sbl_previousinlinetag}{withauthor}} {
      \btxlabeltext{sbl:idem}
      \btxcomma
    } {
      \texdefinition{btx:sbl:short:author}
    }
  } {
    \texdefinition{btx:sbl:short:author}
  }
\stopsetups

...

% Inline citation setup
\startsetups btx:sbl:cite:inline
  \fastsetup{\s!btx:\s!cite:concat}
  \fastsetup{\s!btx:\s!cite:left}
  \begingroup
  % This gets cleared in cites, so set it here
  \def\currentbtxcategory{\btxfield{category}}
  % Reset variables for new citation
  \let\btx_sbl_parenttag\currentbtxtag
  % Then invoke the appropriate setup
  \doifelse {\btxflush{type}} {inlineshort} {
    \fastsetup{btx:sbl:short:\currentbtxcategory}
  } {
    \fastsetup{btx:sbl:inline:\currentbtxcategory}
  }
  \endgroup
  \fastsetup{\s!btx:\s!cite:right}
  % Finally, update the global variable for the previous inline citation
  \let\btx_sbl_previousinlinetag\currentbtxtag
\stopsetups

% Short citations setup
\startsetups btx:sbl:cite:short
  \fastsetup{\s!btx:\s!cite:concat}
  \fastsetup{\s!btx:\s!cite:left}
  \begingroup
  \def\currentbtxcategory{\btxfield{category}}
  \fastsetup{btx:sbl:short:\currentbtxcategory}
  \endgroup
  \removeunwantedspaces
  \removepunctuation
  \fastsetup{\s!btx:\s!cite:right}
  % Finally, update the global variable for the previous inline citation
  \let\btx_sbl_previousinlinetag\currentbtxtag
\stopsetups

But this doesn't work. The \btx_sbl_previousinlinetag macro appears to revert to \empty each time I make a new citation.

@jjmccollum
Copy link
Owner Author

As we might expect, this works fine if we make \btx_sbl_previousinlinetag a global variable via

\setxvariables[btx:sbl][previousinlinetag=\empty]

initially, and

\setxvariables[btx:sbl][previousinlinetag=\currentbtxtag]

at the end of each inline or short citation. Then we just have to retrive the variable via the getvariable{btx:sbl}{previousinlinetag} command.

So I should be able to close this issue. But is it a bad idea to use global variables here? And why does the local variable \btx_sbl_previousinlinetag (whose scope should be the scope of the entire specification) get reset each time \cite is invoked?

@denismaier
Copy link

As said on the mailing list: you might want to make sure that references in the notes and in the body text don't interfere with each other.

And, while you're at it: Commands like biblatex's \mancite might be a good idea. (But, of course, all of this can come later...)

@denismaier
Copy link

Oh, and one thing to think about: some of this should maybe be standardized. As I've said before, users should be able to switch styles without to much hassle...

@jjmccollum
Copy link
Owner Author

We should avoid any interference between list and in-text entries, as the ibid. and idem checks are only done in the btx:sbl:inline and btx:sbl:short setups, while list entries are always printed using the btx:sbl:list setups.

If I understand correctly, \mancite should just reset the previousinlinetag variable to be empty and then call \cite, correct?

My hope is that Hans (or others on the ConTeXt development team) will implement a general macro (probably in publ-ini.lua and publ-ini.mkiv) for retrieving the last entry referenced. (That was my hope when I sent the e-mail to the mailing list, anyway.) That way, I can switch to using that macro in publ-imp-sbl.mkvi, and other specifications that allow for ibid. and idem substitutions can implement them using the same rule. My main concern is the SBL specification, so I intend to leave those implementations to others.

@denismaier
Copy link

We should avoid any interference between list and in-text entries, as the ibid. and idem checks are only done in the btx:sbl:inline and btx:sbl:short setups, while list entries are always printed using the btx:sbl:list setups.

As per my message on the list, this isn't about list vs notes. Consider just this :

\cite[alternative=inline][doe]
\footnote{\cite[alternative=inline][foo]}
\cite[alternative=inline][doe]

The citation in the footnote should not interupt the ibid-tracking in this case. The second doe-citation should trigger the ibid-mechanism. But:

\cite[alternative=inline][doe]
\footnote{\cite[alternative=inline][foo]}
\cite[alternative=inline][foo]

In this case, you wouldn’t want an ibid. for the foo-citation outside of the footnote.

As it turns out, ConTeXt has a mode for checking whether you're in a footnote or not: \doifmodeelse{*footnote}

If I understand correctly, \mancite should just reset the previousinlinetag variable to be empty and then call \cite, correct?

\mancite won't call \cite; it just resets the "last citation" variable. It's intended for cases where you mix automatic citations with manual citations. Say, you have this:

A sentence with a citation \cite[doe]. A sentence with a manual citation, e.g. to the Bible (Gen 1:1). Another sentence with a citation \cite[doe].

The second doe citation will result in an incorrect "ibid.", but a \mancite could suppress it.

A sentence with a citation \cite[doe]. A sentence with a manual citation, e.g. to the Bible \mancite(Gen 1:1). Another sentence with a citation \cite[doe].

@denismaier
Copy link

To make things more complex: Have a look at the options for biblatex's ibidtracker (manual p. 64):

ibidtracker=true, false, context, strict, constrict default: false

This option controls the ‘ibidem’ tracker which is required by the \ifciteibid
test from § 4.6.2. The possible choices are:

true Enable the tracker in global mode.

false Disable the tracker.

context Enable the tracker in context-sensitive mode. In this mode, citations
in footnotes and in the body text are tracked separately.

strict Enable the tracker in strict mode. In this mode, potentially ambiguous
references are suppressed. A reference is considered ambiguous if
either the current citation (the one including the ‘ibidem’) or the
previous citation (the one the ‘ibidem’ refers to) consists of a list of
references.

constrict This mode combines the features of context and strict . It also
keeps track of footnote numbers and detects potentially ambiguous
references in footnotes in a stricter way than the strict option. In
addition to the conditions imposed by the strict option, areference
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.

In my experience, one will mostly want to use "constrict".

Anyway, these are probably things that should be provided by publ-ini.mkiv.

@jjmccollum
Copy link
Owner Author

jjmccollum commented Sep 22, 2021

Ah, I see. So \mancite just resets the previously cited tag field (in the text/footnote environment in which it is invoked) and then prints its input as-is.

I agree that all of this tracking should be implemented in publ-ini.mkiv. Between this and the various options available for ibid tracking, I think you may want to add this to the "Ibid. and idem support for bibliographies (and variable scope more generally)" e-mail thread on the ConTeXt mailing list, since somebody other than me may end up implementing it.

@denismaier
Copy link

Ah, I see. So \mancite just resets the previously cited tag field (in the text/footnote environment in which it is invoked) and then prints its input as-is.

Actually, in biblatex it doesn't print anything. All it does is really just resetting the "previously cited tag field".

@jjmccollum
Copy link
Owner Author

Oh, right! I read your example \mancite(Gen 1:1) too quickly and thought that Gen 1:1 was in braces, not parentheses. So \mancite doesn't expect an argument at all.

@denismaier
Copy link

Another useful addition: useidem and useibid should have a parameters like perpage, persection etc. Or a way to reset ibid after certain boundaries (paragraphs, pages, sections).

@jjmccollum
Copy link
Owner Author

Agreed. My hope is that Hans or Alan could implement this through common helper functions in publ-ini.lua or publ-ini.mkiv.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants