ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Joey McCollum via ntg-context <ntg-context@ntg.nl>
To: Hans Hagen <j.hagen@xs4all.nl>
Cc: Joey McCollum <jmccollum20140511@gmail.com>,
	mailing list for ConTeXt users <ntg-context@ntg.nl>,
	Alan BRASLAU <alan.braslau@comcast.net>
Subject: Re: Short forms and abbreviations in bibliography
Date: Mon, 11 Oct 2021 10:24:23 -0400	[thread overview]
Message-ID: <CAGxRUG_0hUYyhH_b8bJ4NfkjtJLfZTrms6kyUHfdD1XVxrVk3g@mail.gmail.com> (raw)
In-Reply-To: <19a4940d-f76f-ae88-6bbf-42f1627da373@xs4all.nl>


[-- Attachment #1.1: Type: text/plain, Size: 3928 bytes --]

If it helps with troubleshooting, I've also tried to do this with
\fastsetup instead of \texdefinition:

```
\expanded{\abbreviation[\currentbtxtag]{\fastsetup{btx:sbl:cite:shorthand}}{
\fastsetup{btx:sbl:cite:listsubcite}}}
```

This also doesn't work, but I at least get a "Missing control sequence
inserted" error. The following MWE should reproduce the error (it modifies
the existing Chicago rendering, but since I couldn't figure out how to add
a shorthand field to the @book category in the chicago spec from within the
MWE, I just used the note field as a placeholder for it):

```

% Setup a minimal bibliography
\startbuffer [bib]
@book{Author1:2016,
author={Author1},
title={Work1},
note={W1},
publisher={Publisher1},
year=2016,
}
@book{Author2:2015,
author={Author2},
title={Work2},
publisher={Publisher2},
year=2015,
}
\stopbuffer
\usebtxdataset [bib.buffer]

% Setup a new cite alternative to test the desired functionality
\startbtxrenderingdefinitions[chicago]
\definesynonyms[abbreviation][abbreviations][\infull][\inshort] % we need
the \inshort command to access abbreviations by their entry tag

\startsetups btx:chicago:cite:shorthand
\fastsetup{btx:cite:concat}
\fastsetup{btx:cite:lefttext}
\begingroup
\def\currentbtxcitealternative{short}
\def\currentbtxcategory{\btxfield{category}}
\btxstartstyleandcolor[sbl:\s!list:title:\currentbtxcategory]
            \btxusecommand[sbl:\s!list:title:\currentbtxcategory]{
              \btxflush{note}% set the shorthand according to the current
category
            }
          \btxstopstyleandcolor
\endgroup
\fastsetup{btx:cite:righttext}
\stopsetups

\startsetups btx:chicago:cite:test
\fastsetup{btx:cite:concat}
\fastsetup{btx:cite:lefttext}
\btxdoifelse{note} {
 %\expanded{\definesynonym[yes][abbreviation][\currentbtxtag]{\fastsetup{btx:chicago:cite:shorthand}}{\fastsetup{btx:cite:entry}}}%
this throws a Missing control sequence inserted error
 \expanded{\definesynonym[yes][abbreviation][\currentbtxtag]{\cite[alternative=shorthand][\currentbtxtag]}{\cite[alternative=entry][\currentbtxtag]}}%
this works, but recursively cites the same tag
 \inshort{\currentbtxtag}
} {
 \fastsetup{btx:cite:entry}
}
\fastsetup{btx:cite:righttext}
\stopsetups
\stopbtxrenderingdefinitions

% Use this cite alternative by default
\usebtxdefinitions[chicago]
\setupbtx[chicago:cite][alternative=test]

\starttext
\cite[Author1:2016]\blank
\cite[Author2:2015]\blank
\page
\startsubject[title=Abbreviations]
\placelistofabbreviations
\stopsubject
\page
\startsubject[title=Bibliography]
\placelistofpublications
\stopsubject
\stoptext
```

Joey

On Fri, Oct 8, 2021 at 7:38 AM Hans Hagen <j.hagen@xs4all.nl> wrote:

> On 10/7/2021 6:38 AM, Joey McCollum via ntg-context wrote:
> > A concise solution that I found would work was to define a "shorthand"
> > citation alternative and just print the shorthand with that:
> >
> > ```
> > % Shorthand citation setup
> > \startsetups btx:sbl:cite:shorthand
> >    \begingroup
> >    \def\currentbtxcategory{\btxfield{category}}
> >    \texdefinition{btx:sbl:inline:shorthand}
> >    \endgroup
> >    \removeunwantedspaces
> >    \removepunctuation
> > \stopsetups
> >
> > ...
> >
> >
> \expanded{\abbreviation[\currentbtxtag]{\textcite[alternative=shorthand,lefttext=,righttext=][\currentbtxtag]}{\textcite[alternative=listsubcite,lefttext=,righttext=][\currentbtxtag]}}
> > ```
> >
> > Again, this works, although I'm still not sure why
> > invoking \texdefinition{btx:sbl:inline:shorthand} directly doesn't.
> I leave it to Alan to comment on this as he's the bib guru
>
> Hans
>
> -----------------------------------------------------------------
>                                            Hans Hagen | PRAGMA ADE
>                Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>         tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -----------------------------------------------------------------
>

[-- Attachment #1.2: Type: text/html, Size: 5198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

      reply	other threads:[~2021-10-11 14:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-07 19:53 Joey McCollum via ntg-context
2021-08-07 20:40 ` Henning Hraban Ramm via ntg-context
2021-08-09  8:12   ` Denis Maier via ntg-context
2021-08-09 12:55     ` Joey McCollum via ntg-context
2021-08-22 22:11       ` Joey McCollum via ntg-context
2021-10-06 16:35         ` Joey McCollum via ntg-context
2021-10-06 18:35           ` Joey McCollum via ntg-context
2021-10-06 19:05             ` Joey McCollum via ntg-context
2021-10-06 21:58               ` Joey McCollum via ntg-context
2021-10-07  4:38                 ` Joey McCollum via ntg-context
2021-10-08 11:38                   ` Hans Hagen via ntg-context
2021-10-11 14:24                     ` Joey McCollum via ntg-context [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGxRUG_0hUYyhH_b8bJ4NfkjtJLfZTrms6kyUHfdD1XVxrVk3g@mail.gmail.com \
    --to=ntg-context@ntg.nl \
    --cc=alan.braslau@comcast.net \
    --cc=j.hagen@xs4all.nl \
    --cc=jmccollum20140511@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).