Re: [NTG-context] Displaying names in Chicago-Turabian "note" style

2021-12-21 Thread Joey McCollum via ntg-context
Joel,

I've attempted to incorporate most of these features for the SBL citation
style (which derives most of the same rules from Chicago) for ConTeXt. You
can use my code in https://github.com/jjmccollum/context-sbl as a template
for now, if you'd like; we're still waiting for the code to be incorporated
into a future ConTeXt update. Regarding the specific features you described:

(1) The rules for first name-last name authorconversions and et al. limits
for inline citations (i.e., ones in the text/footnotes, but not in the
bibliographic list) can be implemented using the general
\definebtx[chicagonum:\s!cite] command. In publ-imp-sbl.mkvi, I do this as
follows:

\definebtx
  [sbl:\s!cite]
  [sbl]
  [\c!alternative=footnote, % by default, SBL uses footnote citation format
(defined below)
   \c!otherstext={\btxspace\btxlabeltext{others}}, % use et al. for
truncated author / editor list
   \c!etallimit=3, % don't use et al. for 3 or fewer authors
   \c!etaldisplay=1, % but if there are > 3, then only list the first
explicitly
   \c!etaloption=last,
   \c!authorconversion=\v!normal, % by default, use normal name order for
in-text citations
   ...
  ]

(2) SBL also uses short-form citations for inline citations after the first
one. To make these work, it ended up being easiest to create distinct
\fastsetups for an "inlineshort" style. Here is how I handled the citation
of the author in such instances in publ-imp-sbl.mkvi  :

\starttexdefinition btx:sbl:inlineshort:author
  \btxdoif{author} {
% If the useidem option is set and this author matches the previously
cited author, then just print "idem";
% otherwise, print the author/editor's last name
\doifelse{\btxparameter{useidem}} {\v!yes} {

\texdefinition{btx:sbl:doifsamefoundnameauthorelse}{\currentbtxtag}{\getvariable{btx:sbl}{previousinlinetag}}
{
\btxlabeltext{sbl:idem}
  } {
\currentbtxciteauthorbyfield
  }
} {
  \currentbtxciteauthorbyfield
}
\btxcomma
  }
\stoptexdefinition

(3) I haven't implemented support for ibid. tracking (it's on a wishlist
that I sent to Hans and Alan, as it would best be handled by changes to the
core publication support module), so I'm afraid I can't help you on that at
the moment. There is some placeholder code in publ-imp-sbl.mkvi for
handling this when ibid. tracking is eventually implemented, so you might
be able to use that as a template.

(4) To get the "inverted first author" authorconversion working, I had to
create new authorconversions for this. You can find this in the updated
publ-imp-author.mkvi file in my GitHub repo:

\startsetups \s!btx:\s!list:\s!author:invertedfirst
\ifnum\currentbtxauthorindex>\plusone
\fastsetup{\s!btx:\s!list:\s!author:normal}
\else
\fastsetup{\s!btx:\s!list:\s!author:inverted}
\fi
\stopsetups

\startsetups \s!btx:\s!cite:\s!author:invertedfirst
\ifnum\currentbtxauthorindex>\plusone
\fastsetup{\s!btx:\s!cite:\s!author:normal}
\else
\fastsetup{\s!btx:\s!cite:\s!author:inverted}
\fi
\stopsetups

Then, in publ-imp-sbl.mkvi, I invoke this setup in the \btxsetup for
citations in the bibliographic list as follows:

\definebtx
  [sbl:\s!list:author]
  [sbl:\s!list]
  [\c!authorconversion=invertedfirst,
  \c!separator:names:4={\btxcomma\btxlabeltext{and}\space}] % between only
2 names

I hope this helps!

Joey

On Tue, Dec 21, 2021 at 12:51 PM Joel via ntg-context 
wrote:

> I could not find any existing solution for using Chicago-Turabian "note"
> style in ConTeXt, so I have started my own attempt.
>
> Chicago-Turabian uses footnotes to display the author's details on the
> same page, but also uses a bibliography to display an alphabetical list of
> the sources again at the end. The footnotes display somewhat differently
> each time a source is shown. The first time a source is cited, the footnote
> contains a long, detailed reference. Subsequent reappearances of the same
> citation are abbreviated somewhat. And "ibid" is used when the source is
> cited twice in a row. The bibliography entry contains really detailed
> information, similar to what was shown in the first footnote, with minor
> differences.
>
> This code uses three macros: \turabian, used only the first time a source
> is reference, \shortturabian, used for subsequent references of the same
> source, and `\ibid, for when a source is referenced twice in a row. Each of
> these macros simply creates a footnote, showing the author's details, and
> also uses \nocite to make sure an entry is added to
> \placelistofpublications. Page details are optionally added in #2, and this
> information only appears in the footnotes.
>
> I am having trouble getting the code to display the author's names
> correctly. Every attempt ends with strange results, like "FirstLast" with
> no space or just "Initial Last". Chicago-Turabian displays the names
> differently, depending on the placement:
>
> (1) First, the \turabian macro should show in 

Re: [NTG-context] Displaying names in Chicago-Turabian "note" style

2021-12-21 Thread Wolfgang Schuster via ntg-context

Joel via ntg-context schrieb am 21.12.2021 um 18:51:

[...]

\define[3]\ifisempty{%
         \setbox0=\hbox{#1\unskip}%
         \ifdim\wd0=0pt
             #2%
         \else
             #3%
         \fi
}%



No need for your own command because ConTeXt already provides 
\doifemptyelse which does the same thing.


Wolfgang
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] Displaying names in Chicago-Turabian "note" style

2021-12-21 Thread Joel via ntg-context
I could not find any existing solution for using Chicago-Turabian "note" style 
in ConTeXt, so I have started my own attempt.

Chicago-Turabian uses footnotes to display the author's details on the same 
page, but also uses a bibliography to display an alphabetical list of the 
sources again at the end. The footnotes display somewhat differently each time 
a source is shown. The first time a source is cited, the footnote contains a 
long, detailed reference. Subsequent reappearances of the same citation are 
abbreviated somewhat. And "ibid" is used when the source is cited twice in a 
row. The bibliography entry contains really detailed information, similar to 
what was shown in the first footnote, with minor differences.

This code uses three macros: \turabian, used only the first time a source is 
reference, \shortturabian, used for subsequent references of the same source, 
and `\ibid, for when a source is referenced twice in a row. Each of these 
macros simply creates a footnote, showing the author's details, and also uses 
\nocite to make sure an entry is added to \placelistofpublications. Page 
details are optionally added in #2, and this information only appears in the 
footnotes.
I am having trouble getting the code to display the author's names correctly. 
Every attempt ends with strange results, like "FirstLast" with no space or just 
"Initial Last". Chicago-Turabian displays the names differently, depending on 
the placement:

(1) First, the \turabian macro should show in ordinary First + Last order in 
the footnote, example: "Anna Burns, Robert Smith, and Judith Green", but if the 
number of authors exceeds 3, it display "Anna Burns et al."

(2) Second, the \shorturabian macro should show just the Last names in the 
footnote: "Burns, Smith, and Green", also using "Burns et al." if there are 
more than 3 names.

(3) The \ibid macro doesn't show any names.

(4) Finally, the actual bibliographic entry in \placelistofpublications uses a 
strange format, with the first author listed as Last + First order, all 
subsequent authors in First + Last order, such as "Burns, Anna, Robert Smith, 
and Judith Green.", meanwhile "et al." is never used in the bibliography, even 
if there are 100 authors.

Any help would be greatly appreciated!
--Joel
Minimal working example follows:

\startbuffer [bib]
@Book{ball1996,
author = {Ball, Larry},
title = {Desert lawmen: The high sheriffs \word{of} New Mexico \word{and} 
Arizona, 1846-1912},
publisher = {University \word{of} New Mexico Press},
year = {1996},
address = {Albuquerque, NM},
isbn = {9780826317001}
}
 
@Book{minear2009,
author = {Minear, Tish and Limon, Janet},
title = {Discover Native America: Arizona, Colorado, New Mexico, \word{and} 
Utah},
publisher = {Hippocrene Books},
year = {2009},
address = {New York, NY},
isbn = {9780781803274}
}

\stopbuffer

\define[3]\ifisempty{%
        \setbox0=\hbox{#1\unskip}%
        \ifdim\wd0=0pt
            #2%
        \else
            #3%
        \fi
}%

\usebtxdataset[bib.buffer]

\startbtxrenderingdefinitions[chicagonum]

\definebtx[chicagonum]
    [default=default,
    specification=chicagonum,
    otherstext={\btxspace{\it\btxlabeltext{others}}},
    etallimit=10,
    etaldisplay=\btxparameter\c!etallimit,
    journalconversion=\v!normal,
    monthconversion=\v!month,
    title=yes,
    separator:names:2={\btxcomma},
    separator:names:3={\btxcomma\btxlabeltext{and}\space},
    separator:names:4={\btxspace\btxlabeltext{and}\space}]
   
\setupbtxlist[chicagonum]

\definebtxrendering[chicagonum]
    [specification=chicagonum,
    sorttype=authoryear,
    numbering=no]


\startsetups btx:chicagonum:list:book
    \btxdoif{author}{
        \btxflush{author}
        \btxperiod
    }
    \btxdoif{title}{
        {\it\Words \btxflush{title}}
        \btxperiod
    }
    \btxdoif{address}{
        \btxflush{address}
        \btxcolon
    }
    \btxdoif{publisher}{
        \btxflush{publisher}
        \btxcomma
    }
    \btxdoif{year}{
        \btxflush{year}
        \btxperiod
    }
    \removeunwantedspaces
\stopsetups


\startsetups btx:chicagonum:list:article
    \btxdoif{author}{
        \btxflush{author}
        \btxperiod
    }
    \btxdoif{title}{
        \quotation{\Words \btxflush{title}}
        \btxperiod
    }
    \btxdoif{journal}{
        {\it\Words \btxflush{journal}}
    }    
    \btxdoif{volume}{
        \btxflush{volume}
        \btxcomma
    }
    \btxdoif{number}{
        no.~\btxflush{number}
    }
    \btxdoifelse{month}{
        (\btxflush{month} \btxflush{year})
        \btxcolon
    }{
        \btxdoif{year}{
            (\btxflush{year})
        }
        \btxcolon
   }
    \btxdoif{pages}{
        \btxflush{pages}
        \btxperiod
    }
    \removeunwantedspaces
\stopsetups

\stopbtxrenderingdefinitions


\setupbtx[chicagonum][dataset=default,
    authorconversion={normal},
 etallimit=]

\setupbtx[chicagonum:list:author]
    [authorconversion={normal},
 etallimit=]