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

Support related:quotedin #103

Open
dcpurton opened this issue Jun 30, 2019 · 1 comment
Open

Support related:quotedin #103

dcpurton opened this issue Jun 30, 2019 · 1 comment

Comments

@dcpurton
Copy link
Owner

dcpurton commented Jun 30, 2019

See https://sblhs2.com/2019/03/28/snippet-text-collections/

These kind of entries could be supported using a related entry.

Something like this MWE:

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@series{ACCS,
  series = {Ancient Christian Commentary on Scripture},
  shortseries = {ACCS},
  options = {skipbib}
}
@book{edwards:1999,
  editor = {Edwards, Mark J.},
  title = {Galatians, Ephesians, Philippians},
  series = {\citeseries{ACCS} New Testament},
  number = {8},
  location = {Downers Grove, IL},
  publisher = {InterVarsity Press},
  date = {1999}
}
@classictext{victorinus:ephesians,
  author = {Victorinus, Marius},
  title = {Epistle to the Ephesians},
  related = {edwards:1999},
  relatedtype = {quotedin}
}
@classictext{theodoret:galatians,
  author = {Theodoret},
  title = {Epistle to the Galatians},
  related = {edwards:1999},
  relatedtype = {quotedin},
}
\end{filecontents}
\usepackage[style=sbl]{biblatex}
\usepackage[colorlinks]{hyperref}
\addbibresource{\jobname.bib}
\newcommand*{\begrelateddelimquotedin}{\addcomma\space}

\makeatletter

% Handle options

\pretocmd{\blx@opt@citetracker@true}
  {\def\blx@entrytracker{\blx@xsanitizeafter\blx@entrytracker@global}}{}{}
\pretocmd{\blx@opt@citetracker@false}
  {\let\blx@entrytracker\relax}{}{}
\pretocmd{\blx@opt@citetracker@context}
  {\def\blx@entrytracker{\blx@xsanitizeafter\blx@entrytracker@context}}{}{}
\pretocmd{\blx@opt@citetracker@strict}
  {\def\blx@entrytracker{%
     \blx@ifcitesingle{\blx@xsanitizeafter\blx@entrytracker@global}{}}}{}{}
\pretocmd{\blx@opt@citetracker@constrict}
  {\def\blx@entrytracker{%
     \blx@ifcitesingle{\blx@xsanitizeafter\blx@citetracker@context}{}}}{}{}

% Macros

\def\blx@entrytracker@global#1{%
  \ifbool{citetracker}
    {\edef\blx@tempa{#1}%
     \xifinlistcs\blx@tempa{blx@bsee@\the\c@refsection}
       {}
       {\listcsxadd{blx@bsee@\the\c@refsection}\blx@tempa}}
    {}}

\def\blx@entrytracker@context#1{%
  \ifbool{citetracker}
    {\edef\blx@tempa{#1}%
     \iftoggle{blx@footnote}
       {\xifinlistcs\blx@tempa{blx@fsee@\the\c@refsection}
          {}
          {\listcsxadd{blx@fsee@\the\c@refsection}\blx@tempa}}
       {\xifinlistcs\abx@temp@entrykey{blx@bsee@\the\c@refsection}
          {}
          {\listcsxadd{blx@bsee@\the\c@refsection}\blx@tempa}}}
    {}}

\def\blx@citetracker@global{%
  \blx@xsanitizeafter\blx@entrytracker@global{\abx@field@entrykey}}

\def\blx@citetracker@context{%
  \blx@xsanitizeafter\blx@entrytracker@context{\abx@field@entrykey}}


\newbibmacro*{related:quotedin}[1]{%
  \entrydata*{#1}{%
    \edef\abx@field@setkey{\thefield{clonesourcekey}}%
    \ifentryseen{\thefield{clonesourcekey}}
      {\blx@citetracker}
      {\bibhypertarget{\thefield{clonesourcekey}}{}%
       \blx@entrytracker{\thefield{clonesourcekey}}}%
    \usedriver
      {\renewbibmacro*{related:init}{}}
      {\ifbibliography
         {\thefield{entrytype}}
         {cite:\thefield{entrytype}}}%
  \blx@citetracker}%
  \newunit
  \printfield{postnote}}
\renewbibmacro*{cite}{%
  \boolfalse{suppresspostnote}%
  \boolfalse{usevolpostnotedelim}%
  \global\togglefalse{usingibid}%
  \global\togglefalse{inentrytype}%
  \global\toggletrue{blx@testpostnotedelim}%
  \ifciteseen
    {\iffieldequalstr{relatedtype}{quotedin}
       {}
       {\global\toggletrue{relatedseen}}}
    {\global\togglefalse{relatedseen}}%
  \ifciteseen{}{\iffieldundef{pages}{}{\booltrue{suppresspostnote}}}%
  \iffieldundef{shorthand}
    {\ifciteseen{}{\bibhypertarget{\thefield{entrykey}}{}}}
    {}%
  \printtext{%
    \ifboolexpr{%
        test {\ifciteibid}
        and
        not test {\iffirstonpage}
    }
      {\usebibmacro{cite:ibid}}
      {\usebibmacro{ifciteuseshorthand}
         {\usebibmacro{cite:shorthand}}
         {\usedriver{%
            \ifboolexpr{
              togl {bbx:related}
              and
              test {\iffieldequalstr{relatedtype}{quotedin}}
            }
              {\savefield{postnote}{\blx@tempa}%
               \iffieldundef{altpostnote}
                 {\clearfield{postnote}%
                  \global\booltrue{suppresspostnote}}
                 {\savefield{altpostnote}{\blx@tempb}%
                  \restorefield{postnote}{\blx@tempb}}%
               \restorefield{altpostnote}{\blx@tempa}}
              {}}{cite:\thefield{entrytype}}%
          \ifcsstring{blx@shorthand}{intro}
            {\usebibmacro{shorthandintro}}
            {}}}}}
\makeatother
\DefineBibliographyStrings{american}{%
  quotedin = {quoted in}
}

\ExecuteBibliographyOptions{citetracker=true}

\begin{document}
\null\vfill

\citefullauthor{victorinus:ephesians} writes, ``The true way of Israel
consists of living according to the
Spirit.'' \autocite[(1.2.12)129]{victorinus:ephesians}

Filler text \autocite[(5.13)77]{theodoret:galatians}.

\printbiblist{abbreviations}
\printbibliography
\end{document}
@dcpurton
Copy link
Owner Author

Some support may yet be added directly to biblatex. See plk/biblatex#902

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

No branches or pull requests

1 participant