Re: [NTG-context] Hebrew punctuation with SBL Hebrew

2022-08-31 Thread Joey McCollum via ntg-context
In your "broken" example, the patah below the het is being moved to the
right rather than staying under the middle of the het? But the shift to the
right is the correct behavior for furtive patah and should be expected.

On Wed, Aug 31, 2022 at 8:06 PM Denis Maier via ntg-context <
ntg-context@ntg.nl> wrote:

> Hi,
>
>
>
> I’m running into something weird with Hebrew punctuation. Consider the
> example below. SBL Hebrew gives me incorrect results when there’s a vaw
> with a holam = וֹ  just before a chet with a patach = חַ => the patach
> below the chet ist misplaced.
>
> If I remove the holam from the vaw, everything looks ok. Oddly, in Linux
> Libertine I get the correct results in both cases. Does anyone know what
> the problem is here? User error? A bug in SBL Hebrew (which would be very
> odd since that font should be designed specifically for that kind of
> stuff). A missing seeting?
>
>
>
> Best,
>
> Denis
>
>
>
> \definefontfamily[notok][rm][SBL Hebrew][features=hebrew]
>
> \definefontfamily[ok][rm][Linux Libertine O][features=hebrew]
>
>
>
> \setupdirections[bidi=global,method=unicode]
>
>
>
>
>
> \starttext
>
>
>
> Ok:
>
> {\switchtobodyfont[notok]
>
> חִיוּחוחַ
>
> }
>
>
>
> Broken:
>
> {\switchtobodyfont[notok]
>
> חִיוּחוֹחַ
>
> }
>
>
>
> Linux Libertine works in both cases:
>
>
>
> Ok:
>
> {\switchtobodyfont[ok]
>
> חִיוּחוחַ
>
> }
>
>
>
> Ok:
>
> {\switchtobodyfont[ok]
>
> חִיוּחוֹחַ
>
> }
>
>
>
>
>
> \stoptext
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
>
> ___
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] error with sbl bibliography on latest LMTX

2022-07-09 Thread Joey McCollum via ntg-context
Sorry, these are definitely errors on my part. The first one ("invalid
parent sbl:list:title:unpublished for sbl:list:title:thesis,
sbl:list:title:unpublished defined too") was thankfully an easy fix; I just
had to move \definebtx[sbl:\s!list:title:unpublished] before
\definebtx[sbl:\s!list:title:thesis]. I've now pushed this change to the
repo at https://github.com/jjmccollum/context-sbl.

The second error ("Undefined control sequence \currentbtxloctext") is
unfortunately more puzzling. In an effort to preserve backward
compatibility with biblatex usage, I focused on implementing citations in
the SBL style using \autocite, \inlinecite, \parencite, and \footcite
commands, and I neglected to see if the ConTeXt \cite command would work as
expected.

The \currentbtxloctext macro is used for handling more complicated
situations regarding volume, part, page number, etc. citations; for the
purposes of your MWE (and for most citations) a righttext with the page
number citation should also work just fine, so the lack of a loctext
parameter in the \cite command shouldn't be a problem. The
\currentbtxloctext macro is defined in most of the btx:sbl:cite setups in
publ-imp-sbl.mkvi, always via the command

```
\def\currentbtxloctext{\btxparameter{loctext}}
```

The default value of this parameter and similar ones should be \empty, per
the \definebtx[sbl] command in publ-imp-sbl.mkvi:

```
\definebtx
  [sbl]
  [
  ...
  lefttext=\empty, % empty by default
  altloctext=\empty, %empty by default
  loctext=\empty, %empty by default
  righttext=\empty, % empty by default
  punct=\empty, % trailing punctuation (empty by default)
  ...
  ]
```

If I've coded this correctly, then the loctext parameter should default to
\empty when you do not specify it for your \cite command. This seems to be
the case when you first invoke the \cite command (i.e., in the
btx:sbl:cite:footnote setup).

Here is the problem: if you invoke the btx:sbl:cite:inline setup from
inside the btx:sbl:cite:footnote setup, it seems that the loctext parameter
is no longer accessible, and thus, it does not get defined. If I patch the
btx:sbl:cite:footnote setup as follows, then I no longer get the "Undefined
control sequence \currentbtxloctext" error:

```
% Inline footnote citation setup (with intelligent trailing punctuation
replacement)
\startsetups btx:sbl:cite:footnote
  \removeunwantedspaces

\doifinstring{\btxparameter{punct}}{\btxparameter{autopunctuation}}{\btxparameter{punct}}
  \begingroup
  \letbtxparameter{punct}\empty % don't pass the trailing punctuation down
to the inline setup
  \let\doifendswithpunctelse\btx_sbl_doifendswithpunctelse % why is this
necessary? For some reason, \btx_sbl_doifendswithpunctelse is not
recognized within the footnote environment...
  \def\currentbtxcitealternative{footnote}
  \def\currentbtxcategory{\btxfield{category}}
  \def\currentbtxloctext{\btxparameter{loctext}}
  \def\currentbtxaltloctext{\btxparameter{altloctext}}
  \startfootnote
\Word{\fastsetup{btx:sbl:cite:inline}}% capitalize the first word in
the footnote (needed to render "Ibid." and "Idem" correctly)
% Add a closing period if there is no righttext
\doif{\btxparameter{righttext}}{\empty} {
  \btxperiod
}
  \stopfootnote
  \endgroup

\doifnotinstring{\btxparameter{punct}}{\btxparameter{autopunctuation}}{\btxparameter{punct}}
\stopsetups
```

But I still get errors involving other macros that now appear to be
undefined—specifically, the \btxsblshorthandbeforeloctext macro (and,
likely, the \btxsblvolumebeforeloctext macro, as well). These are initially
defined as "no" in the SBL style module outside of the various citation
alternative setups, but they are conditionally redefined as "yes" in these
setups based on specific information in the bibliographic entry.

This pattern suggests a bigger problem. Do these variables and the \cite
parameters fall out of scope when we enter a footnote environment inside a
setup? In my code, I noticed that a macro defined outside of the
btx:sbl:cite:footnote setup was unrecognized within the footnote
environment unless I freshly redefined it:

```
\let\doifendswithpunctelse\btx_sbl_doifendswithpunctelse % why is this
necessary? For some reason, \btx_sbl_doifendswithpunctelse is not
recognized within the footnote environment...
```

Meanwhile, if I change the default citation alternative to "inline" or
"paren", then everything works:

```

\usebtxdataset[default][references.bib]

\setupbtx[dataset=default]

\usebtxdefinitions[sbl]

\setupbtx[sbl:cite][alternative=paren] % or alternative=inline

\setupinteraction[state=start]


\starttext


superior typographic output \cite[lefttext={e.g.}][taraborelli:beauty].


Therefore, the {\TEX}book mentions that the word

\quotation{shel\noligature{ff}ul} should indeed be rendered without the

ff-ligature \cite[righttext={p.~19}][knuth:texbook].


\placelistofpublications%[numbering=yes]


\stoptext
```

I realize that the above "fix" does not truly solve the 

Re: [NTG-context] How to install the ConTeXt-SBL module?

2022-05-29 Thread Joey McCollum via ntg-context
While testing the module, I would copy the .mkiv and .lua files to my
ConTeXt MkIV directory (on Windows with the TeXLive distribution, this was
C:\texlive\2021\texmf-dist\tex\context\base\mkiv) and then run

context --make

to apply the updates.

If there is some other preferred way to do this, I'm sure someone can
correct me. Otherwise, I hope this helps!

On Mon, May 30, 2022 at 10:28 AM Joel via ntg-context 
wrote:

> I had https://github.com/jjmccollum/context-sbl this module working fine,
> but ran and update, and somehow it deleted my extra files. I can't figure
> out how I was able to get it working in the first place--I had just copied
> all the files to a folder somewhere.
>
> What is the correct way to install an unofficial ConTeXt module, such as
> this one?
>
> --Joel
>
> ___
> 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
>
> ___
>
___
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
___


Re: [NTG-context] How to override ConTeXt-SBL titles, to make all titles everywhere capitalized?

2022-01-17 Thread Joey McCollum via ntg-context
I've avoided forcing capitalization in too many places in the SBL rendering
because there are often language-specific (or, within English, even
dialect-specific) differences regarding what should be capitalized. I think
I already enforce capitalization of the first word, though:

```
\starttexdefinition titleemph #1
  \emph{\Word{#1}}
\stoptexdefinition

\starttexdefinition titlequote #1
  \quotation{\Word{#1}}
\stoptexdefinition
```

If you want the behavior you've described, you can change \Word to \Words
in the lines above (in publ-imp-sbl.mkvi). I probably will leave the code
as-is, however, as it seems safer to expect the user to provide the desired
capitalization in the BibTeX file.

Joey

On Mon, Jan 17, 2022 at 11:03 AM Joel via ntg-context 
wrote:

> I am a few days from sending a document to a publisher, and using the
> Society of Biblical Literature style (via the macro ConTeXt-SBL) as it is
> very close to what I need, Chicago (numbers style) citations. One glaring
> difference I notice between the two styles is ConTeXt-SBL presents the
> titles of articles and books in lower case, but Chicago gives them in upper
> case (I think SBL should too, but maybe as my entire BibTeX file is
> lowercase, it is not). How can I tell ConTeXt to override the titles,
> everywhere they appear, so they are printed in uppercase? I've manually
> marked all of the words that should not be capitalized in my BiBTeX file as
> with \word{of} so they will ignore any instructions to become capitalized.
>
> --Joel
>
>
>
> ___
> 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
>
> ___
>
___
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
___


Re: [NTG-context] Why are endnotes not working with ConTeXt-SBL?

2021-12-26 Thread Joey McCollum via ntg-context
This actually seems to be rooted in a more general problem with the
publications support module. Why does invoking the fastsetup for citations
work within the default footnote setup, but not within endnotes flushed via
\placenotes[footnote]? If I modify the original MWE to use ConTeXt's
default btx rendering, I get the same error:

```
\startbuffer [bib]

@Book{clark1989,
author = {Clark, William},
title = {Railroads \word{and} railroad towns \word{in} New Mexico},
publisher = {New Mexico Magazine},
year = {1989},
address = {Albuquerque, New Mexico},
isbn = {9780937206126}
}

\stopbuffer

\usebtxdataset[bib.buffer]

\setupbtx[dataset=default]

\setupnote[footnote][location=none] % commenting out this line will produce
footnotes that expand the citation correctly

\starttext

   \input knuth
\cite[alternative=footnote][clark1989]
\page
\placenotes[footnote]

\startchapter[title=Bibliography]
\placelistofpublications
\stopchapter

\stoptext
```

If it helps, the relevant code in publications support is the following
block in publ-imp-cite.mkvi:

```
\startsetups \s!btx:\s!cite:footnote
\startfootnote
\fastsetup{btx:cite:entry}
\stopfootnote
\stopsetups
```

The \fastsetup{btx:cite:entry} doesn't expand to anything if the footnote
is flushed as an endnote via \placenotes[footnote]. Does anyone have any
idea why this happens and how to fix it?

Joey

On Sat, Dec 25, 2021 at 3:34 PM Joey McCollum 
wrote:

> A reasonable solution for the time being would be to check if the
> righttext argument is empty, and add a final period in the footnote only if
> it is not (with the assumption being that the user would provide
> punctuation in any righttext for footnote/endnote citations). I've pushed
> the following change to the GitHub repo, if you'd like to pull and use it:
>
> ```
> % Inline footnote citation setup (with intelligent trailing punctuation
> replacement)
> \startsetups btx:sbl:cite:footnote
>   \removeunwantedspaces
>
> \doifinstring{\btxparameter{punct}}{\btxparameter{autopunctuation}}{\btxparameter{punct}}
>   \begingroup
>   \letbtxparameter{punct}\empty % don't pass the trailing punctuation down
> to the inline setup
>   \startfootnote
> \Word{\fastsetup{btx:sbl:cite:inline}}% capitalize the first word in
> the footnote (needed to render "Ibid." and "Idem" correctly)
> % Add a closing period if there is no righttext
> \doif{\btxparameter{righttext}}{\empty} {
>   \btxperiod
> }
>   \stopfootnote
>   \endgroup
>
> \doifnotinstring{\btxparameter{punct}}{\btxparameter{autopunctuation}}{\btxparameter{punct}}
> \stopsetups
> ```
>
> This should allow your script to compile, but unfortunately, it doesn't
> seem to make endnotes work, at least not when I try it. For some reason,
> the macro \Word{\fastsetup{btx:sbl:cite:inline}} is expanding to nothing
> inside the \startfootnote ... \stopfootnote environment. I have no idea why
> this is happening, so any ideas are appreciated.
>
> Joey
>
> On Sat, Dec 25, 2021 at 1:11 PM Joey McCollum 
> wrote:
>
>> Joel,
>>
>> You may not have done anything wrong; this may be an issue with
>> ConTeXt-SBL. In my code for the btx:sbl:cite:footnote setup in
>> publ-imp-sbl.mkvi, I added a comment to this effect:
>>
>> ```
>> \startsetups btx:sbl:cite:footnote
>>   \removeunwantedspaces
>>
>> \doifinstring{\btxparameter{punct}}{\btxparameter{autopunctuation}}{\btxparameter{punct}}
>>   \begingroup
>>   \letbtxparameter{punct}\empty % don't pass the trailing punctuation
>> down to the inline setup
>>   \let\doifendswithpunctelse\btx_sbl_doifendswithpunctelse % why is this
>> necessary? For some reason, \btx_sbl_doifendswithpunctelse is not
>> recognized within the footnote environment...
>>   \startfootnote
>> \Word{\fastsetup{btx:sbl:cite:inline}}% capitalize the first word in
>> the footnote (needed to render "Ibid." and "Idem" correctly)
>> % Add a closing period, unless the righttext ends with punctuation
>> \doifendswithpunctelse{\btxparameter{righttext}} {
>>   \removeunwantedspaces
>> } {
>>   \removeunwantedspaces
>>   \btxperiod
>> }
>>   \stopfootnote
>>   \endgroup
>>
>> \doifnotinstring{\btxparameter{punct}}{\btxparameter{autopunctuation}}{\btxparameter{punct}}
>> \stopsetups
>> ```
>>
>> I define the \btx_sbl_doifendswithpunctelse macro earlier in the module.
>> Initially, when I tried to invoke this macro within the \startfootnote ...
>> \stopfootnote environment (to conditionally add a period at the end of a
>> footnote citation if it does not have a righttext ending with punctuation),
>> I got the same error you got, but for \btx_sbl_doifendswithpunctelse. I
>> wasn't sure why this was happening, so I tried defining a new
>> \doifendswithpunctelse macro. Unfortunately, based on your e-mail, it looks
>> like this doesn't actually fix the problem.
>>
>> Any help from other developers would be appreciated here! Unfortunately,
>> I don't have a MWE replicating the 

Re: [NTG-context] Why are endnotes not working with ConTeXt-SBL?

2021-12-25 Thread Joey McCollum via ntg-context
A reasonable solution for the time being would be to check if the
righttext argument is empty, and add a final period in the footnote only if
it is not (with the assumption being that the user would provide
punctuation in any righttext for footnote/endnote citations). I've pushed
the following change to the GitHub repo, if you'd like to pull and use it:

```
% Inline footnote citation setup (with intelligent trailing punctuation
replacement)
\startsetups btx:sbl:cite:footnote
  \removeunwantedspaces

\doifinstring{\btxparameter{punct}}{\btxparameter{autopunctuation}}{\btxparameter{punct}}
  \begingroup
  \letbtxparameter{punct}\empty % don't pass the trailing punctuation down
to the inline setup
  \startfootnote
\Word{\fastsetup{btx:sbl:cite:inline}}% capitalize the first word in
the footnote (needed to render "Ibid." and "Idem" correctly)
% Add a closing period if there is no righttext
\doif{\btxparameter{righttext}}{\empty} {
  \btxperiod
}
  \stopfootnote
  \endgroup

\doifnotinstring{\btxparameter{punct}}{\btxparameter{autopunctuation}}{\btxparameter{punct}}
\stopsetups
```

This should allow your script to compile, but unfortunately, it doesn't
seem to make endnotes work, at least not when I try it. For some reason,
the macro \Word{\fastsetup{btx:sbl:cite:inline}} is expanding to nothing
inside the \startfootnote ... \stopfootnote environment. I have no idea why
this is happening, so any ideas are appreciated.

Joey

On Sat, Dec 25, 2021 at 1:11 PM Joey McCollum 
wrote:

> Joel,
>
> You may not have done anything wrong; this may be an issue with
> ConTeXt-SBL. In my code for the btx:sbl:cite:footnote setup in
> publ-imp-sbl.mkvi, I added a comment to this effect:
>
> ```
> \startsetups btx:sbl:cite:footnote
>   \removeunwantedspaces
>
> \doifinstring{\btxparameter{punct}}{\btxparameter{autopunctuation}}{\btxparameter{punct}}
>   \begingroup
>   \letbtxparameter{punct}\empty % don't pass the trailing punctuation down
> to the inline setup
>   \let\doifendswithpunctelse\btx_sbl_doifendswithpunctelse % why is this
> necessary? For some reason, \btx_sbl_doifendswithpunctelse is not
> recognized within the footnote environment...
>   \startfootnote
> \Word{\fastsetup{btx:sbl:cite:inline}}% capitalize the first word in
> the footnote (needed to render "Ibid." and "Idem" correctly)
> % Add a closing period, unless the righttext ends with punctuation
> \doifendswithpunctelse{\btxparameter{righttext}} {
>   \removeunwantedspaces
> } {
>   \removeunwantedspaces
>   \btxperiod
> }
>   \stopfootnote
>   \endgroup
>
> \doifnotinstring{\btxparameter{punct}}{\btxparameter{autopunctuation}}{\btxparameter{punct}}
> \stopsetups
> ```
>
> I define the \btx_sbl_doifendswithpunctelse macro earlier in the module.
> Initially, when I tried to invoke this macro within the \startfootnote ...
> \stopfootnote environment (to conditionally add a period at the end of a
> footnote citation if it does not have a righttext ending with punctuation),
> I got the same error you got, but for \btx_sbl_doifendswithpunctelse. I
> wasn't sure why this was happening, so I tried defining a new
> \doifendswithpunctelse macro. Unfortunately, based on your e-mail, it looks
> like this doesn't actually fix the problem.
>
> Any help from other developers would be appreciated here! Unfortunately, I
> don't have a MWE replicating the problem on hand at the moment.
>
> Joey
>
> On Sat, Dec 25, 2021 at 1:04 PM Joel via ntg-context 
> wrote:
>
>> I am using the ConTeXt-SBL package for citations. I need to move my
>> footnotes to the end of each article.
>>
>> According to the manual, I can suppress the placement of footnotes using
>> two lines of code. I've added these to my minimal working code, placing 
>> \setupnote[footnote][location=none]
>> in the header and \placenotes[footnote] where I want the endnotes to
>> appear. It complains this error:
>>
>> "Undefined control sequence \doifendswithpunctelse"
>>
>> What did I do wrong?
>>
>> --Joel
>>
>> Code follows:
>>
>> \usemodule[publ-imp-sbl]
>> \startbuffer [bib]
>>
>> @Article{na2006,
>> title={Volcanoes \word{of} New Mexico},
>> year={2006},
>> journal={New Mexico Earth Matters},
>> publisher={New Mexico Bureau \word{of} Geology \word{and} Mineral
>> Resources},
>> volume={6},
>> number={1},
>> location={Socorro, New Mexico}
>> }
>>
>> @Book{clark1989,
>> author = {Clark, William},
>> title = {Railroads \word{and} railroad towns \word{in} New Mexico},
>> publisher = {New Mexico Magazine},
>> year = {1989},
>> address = {Albuquerque, New Mexico},
>> isbn = {9780937206126}
>> }
>>
>> \stopbuffer
>>
>> \usebtxdataset[bib.buffer]
>>
>> \setupbtx[dataset=default]
>> \usebtxdefinitions[sbl]
>> \setupbtx[sbl]
>>
>> \setupnote[footnote][location=none]
>>
>> \starttext
>>
>>\input knuth
>> \cite[clark1989]
>>
>> \placenotes[footnote]
>>
>>
>> \startchapter[title=Bibliography]
>> \placelistofpublications
>> \stopchapter
>>
>> 

Re: [NTG-context] Why are endnotes not working with ConTeXt-SBL?

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

You may not have done anything wrong; this may be an issue with
ConTeXt-SBL. In my code for the btx:sbl:cite:footnote setup in
publ-imp-sbl.mkvi, I added a comment to this effect:

```
\startsetups btx:sbl:cite:footnote
  \removeunwantedspaces

\doifinstring{\btxparameter{punct}}{\btxparameter{autopunctuation}}{\btxparameter{punct}}
  \begingroup
  \letbtxparameter{punct}\empty % don't pass the trailing punctuation down
to the inline setup
  \let\doifendswithpunctelse\btx_sbl_doifendswithpunctelse % why is this
necessary? For some reason, \btx_sbl_doifendswithpunctelse is not
recognized within the footnote environment...
  \startfootnote
\Word{\fastsetup{btx:sbl:cite:inline}}% capitalize the first word in
the footnote (needed to render "Ibid." and "Idem" correctly)
% Add a closing period, unless the righttext ends with punctuation
\doifendswithpunctelse{\btxparameter{righttext}} {
  \removeunwantedspaces
} {
  \removeunwantedspaces
  \btxperiod
}
  \stopfootnote
  \endgroup

\doifnotinstring{\btxparameter{punct}}{\btxparameter{autopunctuation}}{\btxparameter{punct}}
\stopsetups
```

I define the \btx_sbl_doifendswithpunctelse macro earlier in the module.
Initially, when I tried to invoke this macro within the \startfootnote ...
\stopfootnote environment (to conditionally add a period at the end of a
footnote citation if it does not have a righttext ending with punctuation),
I got the same error you got, but for \btx_sbl_doifendswithpunctelse. I
wasn't sure why this was happening, so I tried defining a new
\doifendswithpunctelse macro. Unfortunately, based on your e-mail, it looks
like this doesn't actually fix the problem.

Any help from other developers would be appreciated here! Unfortunately, I
don't have a MWE replicating the problem on hand at the moment.

Joey

On Sat, Dec 25, 2021 at 1:04 PM Joel via ntg-context 
wrote:

> I am using the ConTeXt-SBL package for citations. I need to move my
> footnotes to the end of each article.
>
> According to the manual, I can suppress the placement of footnotes using
> two lines of code. I've added these to my minimal working code, placing 
> \setupnote[footnote][location=none]
> in the header and \placenotes[footnote] where I want the endnotes to
> appear. It complains this error:
>
> "Undefined control sequence \doifendswithpunctelse"
>
> What did I do wrong?
>
> --Joel
>
> Code follows:
>
> \usemodule[publ-imp-sbl]
> \startbuffer [bib]
>
> @Article{na2006,
> title={Volcanoes \word{of} New Mexico},
> year={2006},
> journal={New Mexico Earth Matters},
> publisher={New Mexico Bureau \word{of} Geology \word{and} Mineral
> Resources},
> volume={6},
> number={1},
> location={Socorro, New Mexico}
> }
>
> @Book{clark1989,
> author = {Clark, William},
> title = {Railroads \word{and} railroad towns \word{in} New Mexico},
> publisher = {New Mexico Magazine},
> year = {1989},
> address = {Albuquerque, New Mexico},
> isbn = {9780937206126}
> }
>
> \stopbuffer
>
> \usebtxdataset[bib.buffer]
>
> \setupbtx[dataset=default]
> \usebtxdefinitions[sbl]
> \setupbtx[sbl]
>
> \setupnote[footnote][location=none]
>
> \starttext
>
>\input knuth
> \cite[clark1989]
>
> \placenotes[footnote]
>
>
> \startchapter[title=Bibliography]
> \placelistofpublications
> \stopchapter
>
> \stoptext
>
>
> ___
> 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
>
> ___
>
___
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
___


Re: [NTG-context] Why are back-to-back \autocite commands not working in ConTeXt-SBL?

2021-12-24 Thread Joey McCollum via ntg-context
That may work with something like

```
\cite[loctext={{2},{2}}][{na2006,clark1989}]
```

or

```
\autocite[{{\loc[2]},{\loc[2]}}]{{na2006,clark1989}}
```

(I know that the ConTeXt \cite command supports multicites with
comma-separated entries, but I forget exactly what the expected syntax
looks like.)

Joey

On Fri, Dec 24, 2021 at 10:14 AM Denis Maier via ntg-context <
ntg-context@ntg.nl> wrote:

> biblatex has special multicite commands=> e.g. autocites. could that be
> used in that case?
>
> Denis
>
> Joey McCollum via ntg-context  hat am 24.12.2021
> 15:43 geschrieben:
>
>
> Joel,
>
> Thanks for mentioning this! I think I've run into the same issue before,
> but I wasn't sure how I should go about fixing it, so this might be a good
> place to get suggestions from others.
>
> The \autocite, \inlinecite, \parencite, and \footcite helper commands are
> intended to handle trailing punctuation intelligently (in order to do
> things like move punctuation after a footnote citation before the footnote
> marker), so they treat the next character after the command as a "hidden"
> parameter. This works as expected if the next character is a punctuation
> character or something like a \blank command, but if it's something like a
> \section command (or another \autocite command, as you've discovered), then
> this causes problems.
>
> That said, I think you should be able to get your ConTeXt to compile if
> you follow your \autocite command with punctuation or some form of
> whitespace (which is why a double newline works, as you've discovered,
> while a single newline does not).
>
> I'd like to keep the intelligent trailing punctuation adjustment feature
> if possible, but this problem definitely needs to be fixed. If anyone has
> any suggestions, I welcome them! My hope is that this can be resolved with
> a simple check.
>
> Joey
>
> On Fri, Dec 24, 2021 at 9:37 AM Joel via ntg-context 
> wrote:
>
> I am using the ConTeXt-SBL module to handle the citations in my article.
> Using the plain \cite[na2006] command has worked fine.
>
> But there are some situations where I want the footnote to include page
> number details. I tried using \cite[extra=2][na2006], but that doesn't seem
> compatible with ConTeXt-SBL. I checked the documentation, and if I
> understand correctly, I should use the autocite command to add page numbers
> to my citation? Like this:
>
> \autocite[{\loc[2]}][]{na2006}
>
> This solution works in 95% of cases, but when I need to cite another book
> immediately after that, it throws up errors:
>
>
> This won't compile:
>
> \autocite[{\loc[2]}][]{na2006}
> \autocite[{\loc[2]}][]{clark1989}
>
> This won't compile:
>
> \autocite[{\loc[2]}][]{na2006}%
> %
>\autocite[{\loc[2]}][]{clark1989}
>
> This also won't compile:
>
> \autocite[{\loc[2]}][]{na2006}\autocite[{\loc[2]}][]{clark1989}
>
> After much trial and error, I found this will compile:
>
> \autocite[{\loc[2]}][]{na2006}
>
> \autocite[{\loc[2]}][]{clark1989}
>
> The problem with this last example, is if my citations appear within the
> paragraph, then I end up with a paragraph break in the wrong place!
>
> Here is my minimum working example, which won't compile unless I add a
> blank line between the two citations.
>
> \usemodule[publ-imp-sbl]
> \startbuffer [bib]
>
> @Article{na2006,
> title={Volcanoes \word{of} New Mexico},
> year={2006},
> journal={New Mexico Earth Matters},
> publisher={New Mexico Bureau \word{of} Geology \word{and} Mineral
> Resources},
> volume={6},
> number={1},
> location={Socorro, New Mexico}
> }
>
> @Book{clark1989,
> author = {Clark, William},
> title = {Railroads \word{and} railroad towns \word{in} New Mexico},
> publisher = {New Mexico Magazine},
> year = {1989},
> address = {Albuquerque, New Mexico},
> isbn = {9780937206126}
> }
>
> \stopbuffer
>
> \usebtxdataset[bib.buffer]
>
> \setupbtx[dataset=default]
> \usebtxdefinitions[sbl]
> \setupbtx[sbl]
>
> \starttext
>
> \autocite[{\loc[2]}][]{na2006}
> \autocite[{\loc[3]}][]{clark1989}
>
>
> \startchapter[title=Bibliography]
> \placelistofpublications
> \stopchapter
>
> \stoptext
>
> Is the autocite command the wrong tool for what I need? How can I place
> citations right next to each other, but also include page number
> information with ConTeXt-SBL?
>
> --Joel
>
> ___
>
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.nt

Re: [NTG-context] Why are back-to-back \autocite commands not working in ConTeXt-SBL?

2021-12-24 Thread Joey McCollum via ntg-context
Additionally, if you want to cite page numbers, the key to use in
ConTeXt-SBL is "loctext". (I was not aware of an "extra" key when I was
developing the module.) So, you should be able to make the ConTeXt-style
\cite command work as follows:

```
\cite[loctext=2][na2006]
```

I hope this helps, too!

Joey

On Fri, Dec 24, 2021 at 9:43 AM Joey McCollum 
wrote:

> Joel,
>
> Thanks for mentioning this! I think I've run into the same issue before,
> but I wasn't sure how I should go about fixing it, so this might be a good
> place to get suggestions from others.
>
> The \autocite, \inlinecite, \parencite, and \footcite helper commands are
> intended to handle trailing punctuation intelligently (in order to do
> things like move punctuation after a footnote citation before the footnote
> marker), so they treat the next character after the command as a "hidden"
> parameter. This works as expected if the next character is a punctuation
> character or something like a \blank command, but if it's something like a
> \section command (or another \autocite command, as you've discovered), then
> this causes problems.
>
> That said, I think you should be able to get your ConTeXt to compile if
> you follow your \autocite command with punctuation or some form of
> whitespace (which is why a double newline works, as you've discovered,
> while a single newline does not).
>
> I'd like to keep the intelligent trailing punctuation adjustment feature
> if possible, but this problem definitely needs to be fixed. If anyone has
> any suggestions, I welcome them! My hope is that this can be resolved with
> a simple check.
>
> Joey
>
> On Fri, Dec 24, 2021 at 9:37 AM Joel via ntg-context 
> wrote:
>
>> I am using the ConTeXt-SBL module to handle the citations in my article.
>> Using the plain \cite[na2006] command has worked fine.
>>
>> But there are some situations where I want the footnote to include page
>> number details. I tried using \cite[extra=2][na2006], but that doesn't seem
>> compatible with ConTeXt-SBL. I checked the documentation, and if I
>> understand correctly, I should use the autocite command to add page numbers
>> to my citation? Like this:
>>
>> \autocite[{\loc[2]}][]{na2006}
>>
>> This solution works in 95% of cases, but when I need to cite another book
>> immediately after that, it throws up errors:
>>
>>
>> This won't compile:
>>
>> \autocite[{\loc[2]}][]{na2006}
>> \autocite[{\loc[2]}][]{clark1989}
>>
>> This won't compile:
>>
>> \autocite[{\loc[2]}][]{na2006}%
>> %
>>\autocite[{\loc[2]}][]{clark1989}
>>
>> This also won't compile:
>>
>> \autocite[{\loc[2]}][]{na2006}\autocite[{\loc[2]}][]{clark1989}
>>
>> After much trial and error, I found this will compile:
>>
>> \autocite[{\loc[2]}][]{na2006}
>>
>> \autocite[{\loc[2]}][]{clark1989}
>>
>> The problem with this last example, is if my citations appear within the
>> paragraph, then I end up with a paragraph break in the wrong place!
>>
>> Here is my minimum working example, which won't compile unless I add a
>> blank line between the two citations.
>>
>> \usemodule[publ-imp-sbl]
>> \startbuffer [bib]
>>
>> @Article{na2006,
>> title={Volcanoes \word{of} New Mexico},
>> year={2006},
>> journal={New Mexico Earth Matters},
>> publisher={New Mexico Bureau \word{of} Geology \word{and} Mineral
>> Resources},
>> volume={6},
>> number={1},
>> location={Socorro, New Mexico}
>> }
>>
>> @Book{clark1989,
>> author = {Clark, William},
>> title = {Railroads \word{and} railroad towns \word{in} New Mexico},
>> publisher = {New Mexico Magazine},
>> year = {1989},
>> address = {Albuquerque, New Mexico},
>> isbn = {9780937206126}
>> }
>>
>> \stopbuffer
>>
>> \usebtxdataset[bib.buffer]
>>
>> \setupbtx[dataset=default]
>> \usebtxdefinitions[sbl]
>> \setupbtx[sbl]
>>
>> \starttext
>>
>> \autocite[{\loc[2]}][]{na2006}
>> \autocite[{\loc[3]}][]{clark1989}
>>
>>
>> \startchapter[title=Bibliography]
>> \placelistofpublications
>> \stopchapter
>>
>> \stoptext
>>
>> Is the autocite command the wrong tool for what I need? How can I place
>> citations right next to each other, but also include page number
>> information with ConTeXt-SBL?
>>
>> --Joel
>>
>>
>> ___
>> 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
>>
>> ___
>>
>
___
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  : 

Re: [NTG-context] Why are back-to-back \autocite commands not working in ConTeXt-SBL?

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

Thanks for mentioning this! I think I've run into the same issue before,
but I wasn't sure how I should go about fixing it, so this might be a good
place to get suggestions from others.

The \autocite, \inlinecite, \parencite, and \footcite helper commands are
intended to handle trailing punctuation intelligently (in order to do
things like move punctuation after a footnote citation before the footnote
marker), so they treat the next character after the command as a "hidden"
parameter. This works as expected if the next character is a punctuation
character or something like a \blank command, but if it's something like a
\section command (or another \autocite command, as you've discovered), then
this causes problems.

That said, I think you should be able to get your ConTeXt to compile if you
follow your \autocite command with punctuation or some form of whitespace
(which is why a double newline works, as you've discovered, while a single
newline does not).

I'd like to keep the intelligent trailing punctuation adjustment feature if
possible, but this problem definitely needs to be fixed. If anyone has any
suggestions, I welcome them! My hope is that this can be resolved with a
simple check.

Joey

On Fri, Dec 24, 2021 at 9:37 AM Joel via ntg-context 
wrote:

> I am using the ConTeXt-SBL module to handle the citations in my article.
> Using the plain \cite[na2006] command has worked fine.
>
> But there are some situations where I want the footnote to include page
> number details. I tried using \cite[extra=2][na2006], but that doesn't seem
> compatible with ConTeXt-SBL. I checked the documentation, and if I
> understand correctly, I should use the autocite command to add page numbers
> to my citation? Like this:
>
> \autocite[{\loc[2]}][]{na2006}
>
> This solution works in 95% of cases, but when I need to cite another book
> immediately after that, it throws up errors:
>
>
> This won't compile:
>
> \autocite[{\loc[2]}][]{na2006}
> \autocite[{\loc[2]}][]{clark1989}
>
> This won't compile:
>
> \autocite[{\loc[2]}][]{na2006}%
> %
>\autocite[{\loc[2]}][]{clark1989}
>
> This also won't compile:
>
> \autocite[{\loc[2]}][]{na2006}\autocite[{\loc[2]}][]{clark1989}
>
> After much trial and error, I found this will compile:
>
> \autocite[{\loc[2]}][]{na2006}
>
> \autocite[{\loc[2]}][]{clark1989}
>
> The problem with this last example, is if my citations appear within the
> paragraph, then I end up with a paragraph break in the wrong place!
>
> Here is my minimum working example, which won't compile unless I add a
> blank line between the two citations.
>
> \usemodule[publ-imp-sbl]
> \startbuffer [bib]
>
> @Article{na2006,
> title={Volcanoes \word{of} New Mexico},
> year={2006},
> journal={New Mexico Earth Matters},
> publisher={New Mexico Bureau \word{of} Geology \word{and} Mineral
> Resources},
> volume={6},
> number={1},
> location={Socorro, New Mexico}
> }
>
> @Book{clark1989,
> author = {Clark, William},
> title = {Railroads \word{and} railroad towns \word{in} New Mexico},
> publisher = {New Mexico Magazine},
> year = {1989},
> address = {Albuquerque, New Mexico},
> isbn = {9780937206126}
> }
>
> \stopbuffer
>
> \usebtxdataset[bib.buffer]
>
> \setupbtx[dataset=default]
> \usebtxdefinitions[sbl]
> \setupbtx[sbl]
>
> \starttext
>
> \autocite[{\loc[2]}][]{na2006}
> \autocite[{\loc[3]}][]{clark1989}
>
>
> \startchapter[title=Bibliography]
> \placelistofpublications
> \stopchapter
>
> \stoptext
>
> Is the autocite command the wrong tool for what I need? How can I place
> citations right next to each other, but also include page number
> information with ConTeXt-SBL?
>
> --Joel
>
>
> ___
> 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
>
> ___
>
___
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
___


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] xml processing: if elseif else / switch case

2021-12-09 Thread Joey McCollum via ntg-context
Thanks for correcting that, Wolfgang. I must have added the other \fi
instances because I was trying to use \orelse in MKIV and couldn't get it
to work. Is it only supported in LMTX?

Joey

On Thu, Dec 9, 2021 at 11:30 AM Hans Hagen via ntg-context <
ntg-context@ntg.nl> wrote:

> On 12/9/2021 5:11 PM, Wolfgang Schuster via ntg-context wrote:
> > Joey McCollum via ntg-context schrieb am 09.12.2021 um 15:08:
> >> I believe \orelse might be what you want. It works with most \if...
> >> macros, and it avoids nesting of \doifelse constructs. Here's an
> >> example, which I use in conditionally removing preceding punctuation
> >> if any other keys are defined before a specific one in an assignment:
> >>
> >> ```
> >>   % If any of the preceding keys was specified, then replace any
> >> preceding punctuation with a space
> >> % and typeset the number with its CSL abbreviation, followed by a
> >> comma
> >>   \ifdefined\btxsbllocvol
> >> \removeunwantedspaces\removepunctuation\btxspace
> >> \orelse\ifdefined\btxsbllocno
> >> \removeunwantedspaces\removepunctuation\btxspace
> >>   \fi
> >> \orelse\ifdefined\btxsbllocpt
> >>   [...]
> >>   \fi
> >> ```
> >
> > The \fi at the end of each \orelse branch is wrong.
> >
> > \ifdefined\btxsbllocvol
> >  ...
> > \orelse\ifdefined\btxsbllocno
> >  ...
> > \else
> >  ...
> > \fi
> and when 'string' comparison is needed one can do:
>
> \starttext
>
> \def\foo{foo}
> \def\ofo{ofo}
> \def\oof{oof}
>
> \def\XXX{ofo}
>
> \ifcstok\XXX\foo
>  FOO
> \orelse\ifcstok\XXX\ofo
>  OFO
> \orelse\ifcstok\XXX\oof
>  OOF
> \else
>  XXX
> \fi
>
> \def\XXX{\ofo}
>
> \iftok{\XXX}{\foo}%
>  FOO
> \orelse\iftok{\XXX}{\ofo}%
>  OFO
> \orelse\iftok{\XXX}{\oof}%
>  OOF
> \else
>  XXX
> \fi
>
> \ifcstok{\XXX}\foo
>  FOO
> \orelse\ifcstok{\XXX}\ofo
>  OFO
> \orelse\ifcstok\XXX}\oof
>  OOF
> \else
>  XXX
> \fi
>
> \stoptext
>
> watch the subtle differences. It all makes coding in tex primitives a
> bit more visual appealing and readable. Oone of the objectives of lmtx
> is that users can read the context code without pondering too much about
> the syntax or getting depressed by possibly obscure helper macros and
> expansion trickery.
>
> 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
> -
>
> ___
> 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
>
> ___
>
___
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
___


Re: [NTG-context] xml processing: if elseif else / switch case

2021-12-09 Thread Joey McCollum via ntg-context
I believe \orelse might be what you want. It works with most \if... macros,
and it avoids nesting of \doifelse constructs. Here's an example, which I
use in conditionally removing preceding punctuation if any other keys are
defined before a specific one in an assignment:

```
  % If any of the preceding keys was specified, then replace any
preceding punctuation with a space
  % and typeset the number with its CSL abbreviation, followed by a
comma
  \ifdefined\btxsbllocvol
\removeunwantedspaces\removepunctuation\btxspace
  \orelse\ifdefined\btxsbllocno
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsbllocpt
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsbllocp
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsbllocn
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsbllocfig
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsbllocop
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsbllocbk
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsbllocep
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsbllocchap
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsbllocv
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsbllocfol
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsbllocfrag
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsbllocpl
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsblloccol
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsbllocl
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsbllocsv
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \orelse\ifdefined\btxsbllocsec
\removeunwantedspaces\removepunctuation\btxspace
  \fi
  \fi
```

Joey

On Thu, Dec 9, 2021, 3:19 AM Denis Maier via ntg-context 
wrote:

> Hi,
>
>
>
> I was wondering whether we have tests similar to «if-else if-else» or
> «switch case» in context’s xml processing. (And even in context more
> general...) I have found these doifelse tests, but elseif doesn’t seem to
> exist. Is that correct? If yes, could that be added? Of course, you can
> always just nest doifelse-constructs, but that will become ugly quickly.
> Being able to specify multiple branches would be handy.
>
>
>
> Best,
>
> Denis
>
> ___
> 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
>
> ___
>
___
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] Initial release of SBL bibliographic rendering and biblio wishlist

2021-12-08 Thread Joey McCollum via ntg-context
A while ago, I mentioned in a thread on the mailing list that I was working
on a new bibliographic rendering for the SBL citation style. After
additional testing and implementation of various features (e.g., an
authorconversion that inverts the first author and prints all subsequent
authors in normal order, an author-title sort order for bibliographic
entries, support for shorthands/abbreviations, support for Citation Style
Language locators, and support for biblatex-style citation macros that
intelligently move punctuation that follows them). While optimizations for
performance, simplifications of the code, and new feature additions are
still desirable, the module is in working condition and can now be
incorporated in a future ConTeXt update. The new .lua and .mkvi files for
the SBL rendering, updated publ-aut.lua and publ-imp-author.mkvi files, and
some new code intended to be incorporated into publ-ini.lua and
publ-ini.mkiv can all be found in project GitHub repo at the
https://github.com/jjmccollum/context-sbl.

While I worked on this module, Denis Maier (who provided valuable feedback
and suggestions throughout) and I put together a wish list of new features
we would like to see implemented in the publications support core modules.
We put together the list with Hans and Alan in mind, but any help is
appreciated! The list follows:

   - Probably the most urgent need is for field inheritance mappings
   through crossrefs to be fixed. These should be customizable in
   bibliographic specification .lua files (e.g., publ-imp-sbl.lua), or at the
   very least, they should follow the pattern of biblatex. As it is currently
   implemented, field inheritance seems to map any field from the
   cross-referenced entry to a field *of the same name* in the current
   entry if it doesn't have a field of this name already. But this causes
   serious problems when one needs to check if an entry has a given field
   (such as "shorthand") at all; specifically, the \btxdoif macro will execute
   its argument if the current entry *or any entry it cross-references*
   contains a field with that name. What we want is a more disambiguated
   mapping of inherited fields: for many common entry types (such as @book,
   @collection, @reference, @proceedings, and @inbook, @incollection,
   @inreference, and @inproceedings), biblatex maps the title field of the
   cross-referenced entry to a different-named field in the lower-level entry
   (e.g., maintitle -> booktitle -> title, maineditor -> bookeditor -> editor,
   etc.).
   - A mechanism for setting default field values (e.g., "pagination",
   "options") by category in the .lua file for a given specification. (In the
   SBL spec, for instance, an entry of category @ancienttext or @classictext
   should have options={skipbib=true} by default.) If the user actually
   specifies this field in an entry, then the default value would be
   overwritten.
   - If it hasn't been done already, the \btxdoifelsecitedone macro defined
   in the cont-new.mkiv file in https://github.com/jjmccollum/context-sbl
   should be implemented in publ-ini.lua and publ-ini.mkiv.
   - Related to the previous entry, the ability to remove existing entry
   tags from the "collected" or "tobesaved" lists defined in publ-ini.lua.
   This would allow us to override the usual list registry rules of \cite
   based on the values of, say, an entry's category, "type" field or "options"
   field.
   - General support for the useauthor, useeditor, usetranslator, skipbib,
   and skipbiblist entry options from biblatex. These could be implemented as
   citation-level btx options (currently, useauthor already is implemented for
   the SBL style).
   - Support for disambiguation in "author" citations made with the "name"
   authorconversion. Publications support already allows us to map different
   versions of the same name (e.g., "John Doe" and "J. Doe" to a single value.
   But ideally, the publications support module should also check if surnames
   are shared by distinct authors, and if so, it should then check for
   distinct first and middle initials, and then distinct full names, until it
   finds a difference. The shortest distinct renderings should then be used
   for the "name" authorconversion. Different bibliographic renderings have
   different rules for this, so implementations of these different rules
   (detailed at
   https://docs.citationstyles.org/en/stable/specification.html#disambiguation)
   would be ideal.
   - General support for *ibidem* (same entry), *idem* (same author), and *op.
   cit.* (same title) tracking in the publ-ini module. These could be
   implemented with default settings that could be overridden as needed in
   individual specifications. Following biblatex, the user should be able to
   specify yes/no "ibidtracker", "idemtracker", and "opcittracker" options via
   \setupbtx. The publ-ini.mkiv file already defines macros like
   \btxdoifsameaspreviouscheckedelse, 

Re: [NTG-context] Checking for a Unicode prefix of a Unicode string

2021-11-29 Thread Joey McCollum via ntg-context
After some debugging, the example code I offered above seems to work, with
minor adjustments:

\begingroup
\let\loc\loctextloc
\currentbtxloctext
\btxcomma

\endgroup

Thanks again for all the help!

Joey

On Mon, Nov 29, 2021 at 12:11 PM Joey McCollum 
wrote:

> Okay. So using this example as a template, I'd like to do the following:
>
>- define a general-purpose \loc macro that can be invoked in the main
>text (i.e., outside of citations) in the usual way; this one would
>correspond to \WhateverB above and would not remove punctuation preceding
>the macro.
>- separately define a \loctextloc macro that accepts the same input as
>\loc, but conditionally removes preceding punctuation based on variables
>set outside of this macro during the citation process (e.g.,
>\btxsblshorthandbeforetextloc); this would correspond to \WhateverA above.
>- in the macro for typesetting the loctext btx parameter, redefine
>\loc to do what \loctextloc does, and then invoke \currentbtxloctext so
>that the \loc invocations it contains will be expanded like \loctextloc, as
>follows:
>
> \begingroup
> \def\loc\loctextloc
> \currentbtxloctext
>
> \btxcomma
>
> \endgroup
>
> Is this a ConTeXt-friendly way to do this? I'm attempted this now, but I
> have some errors to debug, and I'd like to know if this is even a feasible
> direction before I continue.
>
> Joey
>
> On Sun, Nov 28, 2021 at 5:39 AM Hans Hagen  wrote:
>
>> On 11/28/2021 2:39 AM, Joey McCollum wrote:
>> > I was afraid that might be the problem. I've described some of the
>> > intended purpose of this code near the end of the "Checking for a
>> macro  > ...
>>
>> Maybe play with:
>>
>> \starttext
>>
>> \def\WhateverA{\removeunwantedspaces\removepunctuation\space ¶ 1.23}
>> \def\WhateverB{¶ 1.23}
>>
>> foo bar, \WhateverA\ test
>> foo bar, \WhateverB\ test
>>
>> \stoptext
>>
>> so, wrap ¶ into a macro
>>
>> \def\MyParSymbol{\removeunwantedspaces\removepunctuation\space ¶}
>>
>> 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
>> -
>>
>
___
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
___


Re: [NTG-context] Checking for a Unicode prefix of a Unicode string

2021-11-29 Thread Joey McCollum via ntg-context
Okay. So using this example as a template, I'd like to do the following:

   - define a general-purpose \loc macro that can be invoked in the main
   text (i.e., outside of citations) in the usual way; this one would
   correspond to \WhateverB above and would not remove punctuation preceding
   the macro.
   - separately define a \loctextloc macro that accepts the same input as
   \loc, but conditionally removes preceding punctuation based on variables
   set outside of this macro during the citation process (e.g.,
   \btxsblshorthandbeforetextloc); this would correspond to \WhateverA above.
   - in the macro for typesetting the loctext btx parameter, redefine \loc
   to do what \loctextloc does, and then invoke \currentbtxloctext so that the
   \loc invocations it contains will be expanded like \loctextloc, as follows:

\begingroup
\def\loc\loctextloc
\currentbtxloctext

\btxcomma

\endgroup

Is this a ConTeXt-friendly way to do this? I'm attempted this now, but I
have some errors to debug, and I'd like to know if this is even a feasible
direction before I continue.

Joey

On Sun, Nov 28, 2021 at 5:39 AM Hans Hagen  wrote:

> On 11/28/2021 2:39 AM, Joey McCollum wrote:
> > I was afraid that might be the problem. I've described some of the
> > intended purpose of this code near the end of the "Checking for a macro
> > ...
>
> Maybe play with:
>
> \starttext
>
> \def\WhateverA{\removeunwantedspaces\removepunctuation\space ¶ 1.23}
> \def\WhateverB{¶ 1.23}
>
> foo bar, \WhateverA\ test
> foo bar, \WhateverB\ test
>
> \stoptext
>
> so, wrap ¶ into a macro
>
> \def\MyParSymbol{\removeunwantedspaces\removepunctuation\space ¶}
>
> 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
> -
>
___
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
___


Re: [NTG-context] Checking for a Unicode prefix of a Unicode string

2021-11-27 Thread Joey McCollum via ntg-context
I was afraid that might be the problem. I've described some of the intended
purpose of this code near the end of the "Checking for a macro in a string
without expanding it" thread on the mailing list, but I will get into more
detail here. I'm working on a ConTeXt implementation of citation style
language (CSL) locators, particularly for the SBL citation rendering
(although the code could easily be adapted for use in general or with other
bibliographic renderings). This would allow for a consistent,
language-sensitive syntax that could be used within citations or in any
part of a text and could accommodate changes in bibliographic style without
requiring the user to reformat all their page number citations. In SBL
style, for instance, volume, part, and page numbers are not prefixed by
abbreviations like "vol.", "pt." and "p.", but in other styles, they might
be. The locator syntax

```
\loc[vol=33,pt=1,p=86]
```

would be defined in the SBL rendering file to output

```
33.1:86
```

while in some other style, it might be defined to output

```
vol. 33, pt. 1, p. 86
```

To accommodate the use of these macros within citations, I've added
"loctext" (locator text) and "altloctext" (alternate locator text)
arguments to the set of parameters used by the \cite macro, because in some
bibliographic categories, different locators can be specified for different
parts of a citation (e.g., one for a passage in an ancient text and another
for the book reproducing it), and therefore cannot just be specified in the
"righttext" parameter. So now we can do something like

```
\cite[lefttext={See},altloctext={1.3},loctext={8:223},righttext={for
further details}][clementinehomilies]
```

to get

See *The Clementine Homilies* 1.3 (*ANF *8:223) for further details.

or

```
\cite[lefttext={See},loctext={\loc[p=8]},righttext={; but there are also
contradictory statements, e.g. \loc[p=12].}][Doe:Title]
```

to get

See Doe, *Title*, 8; but there are also contradictory statements, e.g. 12.


The main problem is determining when to include a comma before printing the
"loctext" and when not to include one. In the first example above, we don't
want a comma between *ANF* and 8:223 (SBL style does not add a comma
between a multivolume set abbreviation and a volume number), but in the
second example, we do want one between *Title *and 8. Similarly, we want to
remove the comma if the first locator in the loctext is a section marker
(§) or paragraph marker (¶). This is why I want to check the beginning of
the \currentloctext macro for the presence of a volume number (a number
followed by a colon), a section mark, or a paragraph mark.

While storing the locator parameters as btx parameters would allow for
another solution to this problem, it would complicate defining the \loc
macro in a way that would be suitable outside of citations or for multiple
uses in the same citation (notice how a second \loc invocation occurs in
the righttext of the second example above). Parsing the output of \loc
seemed like the simplest solution, but as you've pointed out, it has its
own difficulties. I'm inclined to try one of the TeX-based solutions you
describe above to avoid complicating other things, but if my description of
the intended use gives you any better ideas, please suggest them!

Thanks again!

Joey

On Sat, Nov 27, 2021 at 1:44 PM Hans Hagen  wrote:

> On 11/27/2021 6:13 PM, Joey McCollum wrote:
> > All right, I think I've solved the expansion problem I described before:
> > to ensure that the first input is expanded when it is passed to Lua, I
> > have to pass it as [==[#1]==], not "#1". But the updated MWE below still
> > does not seem to work, as the \DoIfPrefixElse macro is printing "NOP"
> > instead of "YES":
> >
> > ```
> >
> > \starttexdefinition loc [#1]
> >
> > \doifassignmentelse{#1} {
> >
> > % if an assignment, then parse and format accordingly
> >
> > \getparameters[loc][#1]
> >
> > % Was a section number specified?
> >
> > \doifdefined{locsec} {
> >
> > § \locsec
> >
> > }
> >
> > } {
> >
> > % otherwise, just print the input as-is
> >
> > #1
> >
> > }
> >
> > \stoptexdefinition
> >
> >
> >
> \def\DoIfPrefixElse#1#2{\ctxlua{commands.doifelse(string.find([==[#2]==],"^"..[==[#1]==]))}}
> >
> >
> > \def\currentbtxloctext{\loc[sec=31]}
> >
> >
> > \starttext
> >
> > \currentbtxloctext\blank
> >
> > \DoIfPrefixElse{§}{\currentbtxloctext}{YES}{NOP}
> >
> > \stoptext
> >
> > ```
> >
> > Indeed, if I add a simple \doifelse equality check, it looks like the
> > value I expect is not the same as what the macro produces, even though
> > they look identical:
> >
> > ```
> >
> > \starttexdefinition loc [#1]
> >  \doifassignmentelse{#1} {
> >  % if an assignment, then parse and format accordingly
> >  \getparameters[loc][#1]
> >  % Was a section number specified?
> >  \doifdefined{locsec} {
> >  § \locsec
> >  }
> >  } {
> >  % otherwise, just print the input as-is
> > 

Re: [NTG-context] Checking for a Unicode prefix of a Unicode string

2021-11-27 Thread Joey McCollum via ntg-context
All right, I think I've solved the expansion problem I described before: to
ensure that the first input is expanded when it is passed to Lua, I have to
pass it as [==[#1]==], not "#1". But the updated MWE below still does not
seem to work, as the \DoIfPrefixElse macro is printing "NOP" instead of
"YES":

```

\starttexdefinition loc [#1]

\doifassignmentelse{#1} {

% if an assignment, then parse and format accordingly

\getparameters[loc][#1]

% Was a section number specified?

\doifdefined{locsec} {

§ \locsec

}

} {

% otherwise, just print the input as-is

#1

}

\stoptexdefinition


\def\DoIfPrefixElse#1#2{\ctxlua{commands.doifelse(string.find([==[#2]==],"^"..[==[#1]==]))}}


\def\currentbtxloctext{\loc[sec=31]}


\starttext

\currentbtxloctext\blank

\DoIfPrefixElse{§}{\currentbtxloctext}{YES}{NOP}

\stoptext
```

Indeed, if I add a simple \doifelse equality check, it looks like the value
I expect is not the same as what the macro produces, even though they look
identical:

```

\starttexdefinition loc [#1]
\doifassignmentelse{#1} {
% if an assignment, then parse and format accordingly
\getparameters[loc][#1]
% Was a section number specified?
\doifdefined{locsec} {
§ \locsec
}
} {
% otherwise, just print the input as-is
#1
}
\stoptexdefinition

\def\DoIfPrefixElse#1#2{\ctxlua{commands.doifelse(string.find([==[#2]==],"^"..[==[#1]==]))}}

\def\currentbtxloctext{\loc[sec=31]}

\starttext
§ 31\blank%the raw text we expect
\currentbtxloctext\blank%the text as produced by the macro
\doifelse{\currentbtxloctext}{§ 31}{YES}{NOP}\blank% should output YES,
but doesn't
\DoIfPrefixElse{§}{\currentbtxloctext}{YES}{NOP}\blank% should output
YES, but doesn't
\stoptext
```

What am I missing here?

Joey

On Fri, Nov 26, 2021 at 11:57 AM Joey McCollum 
wrote:

> Thanks! Invoking string.find(str,"^"..pre) is certainly much easier. This
> sort of thing would be a nice general-purpose helper function. Denis Maier
> and I should have a "wish list" of desired helpers and features (mostly
> related to bibliographies/publication support) ready for you (and Alan)
> sometime soon.
>
> But for now, it looks like I still need to work out errors that arise when
> I pass a macro as the "str" input to be searched. I've defined a \loc macro
> that accepts an assignment and outputs a formatted string, and later, I
> want to check if this macro (after it has been fully expanded) starts with
> a certain prefix. A minimal (non-)working example follows:
>
> ```
>
> \starttexdefinition loc [#1]
>
> \doifassignmentelse{#1} {
>
> % if an assignment, then parse and format accordingly
>
> \getparameters[loc][#1]
>
> % Was a section number specified?
>
> \doifdefined{locsec} {
>
> § \locsec\btxcomma
>
> }
>
> } {
>
> % otherwise, just print the input as-is
>
> #1
>
> }
>
> \stoptexdefinition
>
>
>
> \def\DoIfPrefixElse#1#2{\ctxlua{commands.doifelse(string.find("#2","^".."#1"))}}
>
>
> \def\currentbtxloctext{\loc[sec=31]}
>
>
> \starttext
>
> \DoIfPrefixElse{§}{\currentbtxloctext}{YES}{NOP}
>
> \stoptext
> ```
>
> Lua is throwing an "invalid escape sequence near '"\l'" error, which is
> presumably because the macro \loc[sec=31] is not being expanded. How do I
> fix this?
>
> Thanks!
>
> Joey
>
> On Fri, Nov 26, 2021 at 3:46 AM Hans Hagen via ntg-context <
> ntg-context@ntg.nl> wrote:
>
>> On 11/26/2021 7:42 AM, Joey McCollum via ntg-context wrote:
>> > I wasn't aware of a general-purpose "doifstartswith" macro in ConTeXt
>> > (the \doifnextcharelse macro only works one character at a time, and
>> the
>> > \doifinstring macros may capture substrings that are not prefixes), and
>> > I'd like to develop one for something I'm working on. I've been trying
>> > to do this in Lua, as that seemed like the most natural approach.
>> > Normally, something like this would work fine as a foundation:
>> >
>> > ```
>> >function isprefix(prefix, str)
>> >  if string.sub(str, 1, string.len(prefix)) == prefix then
>> >return true
>> >  end
>> >  return false
>> >end
>> > ```
>>
>> how about
>>
>> if string.find(str,"^"..prefix) then
>>
>> in:
>>
>> \starttext
>>
>>
>> \def\DoIfPrefixElse#1#2{\ctxlua{commands.doifelse(string.find("#2","^".."#1"))}}
>>
>> \DoIfPrefixElse{pre}{prefix}{YES}{NOP}
>> \DoIfPrefixElse{pre}{suffix}{YES}{NOP}
>>

Re: [NTG-context] Checking for a Unicode prefix of a Unicode string

2021-11-26 Thread Joey McCollum via ntg-context
Thanks! Invoking string.find(str,"^"..pre) is certainly much easier. This
sort of thing would be a nice general-purpose helper function. Denis Maier
and I should have a "wish list" of desired helpers and features (mostly
related to bibliographies/publication support) ready for you (and Alan)
sometime soon.

But for now, it looks like I still need to work out errors that arise when
I pass a macro as the "str" input to be searched. I've defined a \loc macro
that accepts an assignment and outputs a formatted string, and later, I
want to check if this macro (after it has been fully expanded) starts with
a certain prefix. A minimal (non-)working example follows:

```

\starttexdefinition loc [#1]

\doifassignmentelse{#1} {

% if an assignment, then parse and format accordingly

\getparameters[loc][#1]

% Was a section number specified?

\doifdefined{locsec} {

§ \locsec\btxcomma

}

} {

% otherwise, just print the input as-is

#1

}

\stoptexdefinition


\def\DoIfPrefixElse#1#2{\ctxlua{commands.doifelse(string.find("#2","^".."#1"))}}


\def\currentbtxloctext{\loc[sec=31]}


\starttext

\DoIfPrefixElse{§}{\currentbtxloctext}{YES}{NOP}

\stoptext
```

Lua is throwing an "invalid escape sequence near '"\l'" error, which is
presumably because the macro \loc[sec=31] is not being expanded. How do I
fix this?

Thanks!

Joey

On Fri, Nov 26, 2021 at 3:46 AM Hans Hagen via ntg-context <
ntg-context@ntg.nl> wrote:

> On 11/26/2021 7:42 AM, Joey McCollum via ntg-context wrote:
> > I wasn't aware of a general-purpose "doifstartswith" macro in ConTeXt
> > (the \doifnextcharelse macro only works one character at a time, and the
> > \doifinstring macros may capture substrings that are not prefixes), and
> > I'd like to develop one for something I'm working on. I've been trying
> > to do this in Lua, as that seemed like the most natural approach.
> > Normally, something like this would work fine as a foundation:
> >
> > ```
> >function isprefix(prefix, str)
> >  if string.sub(str, 1, string.len(prefix)) == prefix then
> >return true
> >  end
> >  return false
> >end
> > ```
>
> how about
>
> if string.find(str,"^"..prefix) then
>
> in:
>
> \starttext
>
>
> \def\DoIfPrefixElse#1#2{\ctxlua{commands.doifelse(string.find("#2","^".."#1"))}}
>
> \DoIfPrefixElse{pre}{prefix}{YES}{NOP}
> \DoIfPrefixElse{pre}{suffix}{YES}{NOP}
>
> \stoptext
>
> utf strings are just sequences of bytes so matching works
>
> when you want to do more in lua you can decide for
>
> \startluacode
> interfaces.implement {
>  name  = "DoIfPrefixElse",
>  arguments = { "argument", "argument" },
>  actions   = function(pre,str)
>  commands.doifelse(string.find(str,"^"..pre))
>  end
> }
> \stopluacode
>
> \DoIfPrefixElse{pre}{prefix}{YES}{NOP}
> \DoIfPrefixElse{pre}{suffix}{YES}{NOP}
>
> but in any case: make sure that you don't clash with built in ...
>
> if needed i can make a set of fast(er) ones but someone has to collect a
> list of 'handy helpers' first
>
> 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
> -
>
> ___
> 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
>
> ___
>
___
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] Checking for a Unicode prefix of a Unicode string

2021-11-25 Thread Joey McCollum via ntg-context
I wasn't aware of a general-purpose "doifstartswith" macro in ConTeXt (the
\doifnextcharelse macro only works one character at a time, and the
\doifinstring macros may capture substrings that are not prefixes), and I'd
like to develop one for something I'm working on. I've been trying to do
this in Lua, as that seemed like the most natural approach. Normally,
something like this would work fine as a foundation:

```
  function isprefix(prefix, str)
if string.sub(str, 1, string.len(prefix)) == prefix then
  return true
end
return false
  end
```

Unfortunately, if I want to check for prefixes that include two-byte
characters like § and ¶, then the positions and string lengths that I
specify no longer correspond to the actual byte offsets and lengths that
Lua uses. I'm aware of the utf8 plugin that was intended to address this
issue, but the following code also isn't working:

```
  function sbl.isprefix(prefix, str)
-- lua is devious and measures string length in bytes, not chars,
-- so we can't just use string.sub and string.len as we normally would.
local i = utf8.offset(str, 1)
local j = utf8.offset(str, utf8.len(prefix) + 1) - 1
if string.sub(str, i, j) == prefix then
  return true
end
return false
  end
```

The only other detail that may be relevant is that I'm passing a macro as
the "str" input. But this should be expanded when the Lua code is
manipulating it, right?

I'm sure there's something obvious that I'm doing wrong, but I've been
trying to get this to work for at least a couple hours now, and I don't
know what else to try. If there is a simple fix to my Lua code or an
existing ConTeXt macro that will get the job done, I'd appreciate it!

Joey
___
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] \doifanydefinedelse, \doifallundefinedelse

2021-11-19 Thread Joey McCollum via ntg-context
I was checking the "Branches and Decisions" wiki entry at
https://wiki.contextgarden.net/System_Macros/Branches_and_Decisions, and I
saw that ConTeXt has a useful \doifalldefinedelse macro that checks a
comma-separated list of macro names and proceeds according to whether or
not all of the macros with those names are defined. I was curious as to
whether or not there is also a \doifanydefinedelse (or, equivalently, a
\doifallundefinedelse) macro that would check if *any *of the macros with
names in the comma-separated list is defined (or, equivalently, if all of
them are undefined). I don't see any mention of such a macro on the wiki
page, so I wanted to ask: has something like this already been implemented,
and if not, is there a simple way to do a check like this? This
functionality would be useful for performing some checks on a key-value
assignment, and passing a comma-separated list to a macro would be much
cleaner than doing a bunch of nested if-else blocks.

Joey
___
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
___


Re: [NTG-context] Checking for a macro in a string without expanding it

2021-11-16 Thread Joey McCollum via ntg-context
I'm not sure if my mind is twisted enough! I can follow how Jairo's answer
works, and that does what I need it to, but it's not as clear to me what
the last two TeX-only approaches are doing at a low level.

Perhaps more importantly, I should clarify that for my purposes, the
\MyOuter macro is the \currentbtxrighttext macro, which is defined in a
separate module that I'd prefer not to modify. I want to be able to detect
and parse the parameters of a \loc macro that a user can specify in a
citation as follows:

```
\cite[lefttext={See}, righttext={\loc[vol=8,p=223] for further
details}][clementinehomilies]
```

Because the locator parameters may need to be parenthesized or formatted
differently depending on the category of the bibliography entry, they
should be typeset separately from the plain part of the righttext. This is
why I'd like to be able to parse the parameters and then expand the \loc
macro itself as empty when the righttext is typeset.

Joey

On Tue, Nov 16, 2021 at 4:19 PM Hans Hagen via ntg-context <
ntg-context@ntg.nl> wrote:

> On 11/16/2021 9:09 PM, Jairo A. del Rio via ntg-context wrote:
> > If I understand it correctly, you may need something like this...?
> >
> > % Protection is key
> > \protected\def\inner[#1]{\empty}
> > % \outer is (or was) already defined in \CONTEXT
> > % Please use another name
> > \def\Outer{\inner[123] and \inner[some text] etc.}
> > \startluacode
> > local implement = interfaces.implement
> > local argument = tokens.scanners.argument
> > local function parseinner()
> >local r = {}
> >local str = argument()
> >str = str:gsub("\\inner%s*(%b[])",function(s)r[#r+1] =
> s:sub(2,#s-1)end)
> >context(table.concat(r," ")) -- Change " " by another spacer if needed
> > end
> > implement{name = "parseinner", public = true, actions = parseinner}
> > \stopluacode
> > \starttext
> > \parseinner{\Outer}
> > \stoptext
> >
> > However, this will only work with very simple cases (no nesting, etc.).
> > Hope this helps.
> well, if we start talking weird code ...
>
> \starttext
>
> \tolerant\def\MyInnerOuter#1\MyInner[#2]#3\MyDone\ignorearguments{#2}
>
> \def\MyOuter#1{\MyInnerOuter#1\MyDone\ignorearguments}
>
> whatever: \MyOuter{\MyInner[oeps]}\par
> whatever: \MyOuter{\InnerMy[oeps]}\par
>
> \edef\ItWorksA{\MyOuter{\MyInner[oeps]}}
> \edef\ItWorksB{\MyOuter{\InnerMy[oeps]}}
>
> whatever: \meaningless\ItWorksA\par
> whatever: \meaningless\ItWorksB\par
>
> \stoptext
>
> (1) we're tolerant so no problem when no match
> (2) the ignore hack quits scanning because tex will keep looking
>
> it's pretty fast and needs no lua magic, only a twisted mind
>
> 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
> -
>
> ___
> 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
>
> ___
>
___
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] Checking for a macro in a string without expanding it

2021-11-16 Thread Joey McCollum via ntg-context
As the subject of this question suggests, this is really more of a question
about expansion control (a topic that is still a bit obscure to me).
Suppose I have a macro \inner that expects a single argument or an
assignment of parameters in brackets. For my purposes, I don't want this
macro to do anything when it is typeset, so I'll just define it as empty:

```
\def\inner[#1]\empty
```

Now suppose I have another macro \outer that invokes this macro with some
specific input and sets some plain text after it:

```
\def\outer{\inner[123] etc.}
```

What I'd like to do is parse the argument of \inner in \outer. I was hoping
that a string search in Lua would work, but I'm not having any luck. A
minimal (non)-working example is included below:

```

\def\inner[#1]\empty

\def\outer{\inner[123] etc.}


\startluacode

local userdata = userdata or {}

function userdata.parseinner(str)

local innerparams = ""

if string.find(str, "\\inner(%b[])") then

  i, j = string.find(str, "\\inner(%b[])")

  innerparams = string.sub(str, i+1, j-1) -- we just want the content
inside the brackets

end

context(innerparams)

return

end

\stopluacode

\def\parseinner#1{\ctxlua{userdata.parseinner([==[#1]==])}}


\starttext

Testing:\blank

\parseinner{\outer}

\stoptext
```

My problem is that when I pass \outer to the \parseinner macro, it gets
fully expanded, so there isn't anything left to match "\\inner%b[]". Is
there a way to expand \outer when I pass it to the \parseinner macro
without also expanding the \inner macro inside it? Or is there some other
preferred way of doing this?

Joey
___
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
___


Re: [NTG-context] Unusual error with \doifinstring in \startbtxrenderingdefinitions ... \stopbtxrenderingdefinitions

2021-10-11 Thread Joey McCollum via ntg-context
An alternative solution is to isolate the setting of the
autopunctuation btx option:

```
% Because some common punctuation characters are escaped in publ-ini.mkiv,
% we have to set this option separately
\pushcatcodetable
\setcatcodetable\ctxcatcodes
  \setupbtx[sbl][autopunctuation={!,.:;?}]% undelimited list of trailing
punctuation to move before footnote citations
\popcatcodetable
```

Joey

On Sun, Oct 10, 2021 at 9:40 AM Joey McCollum 
wrote:

> Thanks for these replies! Adding \unexpanded or \protected before \def
> didn't fix the problem, and surrounding the definition with \unprotect ...
> \protect didn't work either. But surrounding it with \pushcatcodetable
> \setcatcodetable\ctxcatcodes ... \popcatcodetable worked.
>
> I've never seen these commands before, but I gather from the existing
> documentation that the current catcode governs which characters are treated
> as special when a buffer is being processed. So here, it looks like I'm
> temporarily switching from some other catcode set (it looks like in
> publ-ini.mkiv, \catcode\commentasciicode\othercatcode gets invoked
> in \publ_set_publication, so perhaps that's what's happening?) to the
> default ConTeXt catcodes and then back.
>
> Thanks again!
>
> Joey
>
> On Sun, Oct 10, 2021 at 6:40 AM Wolfgang Schuster <
> wolfgang.schuster.li...@gmail.com> wrote:
>
>> Joey McCollum via ntg-context schrieb am 10.10.2021 um 05:42:
>>
>> The test using \removepunctuation that you provided does what it should
>> be doing (it produces 6 instances of "test-test" with the intervening
>> punctuation mark in each case removed), but it doesn't do what I'm trying
>> to do in the MWE above. I'm trying to take certain punctuation marks that
>> follow the \autopuncttest macro and place them before it instead.
>> Looking at the typo-chr .lua and .mkiv files, I see that there are 
>> \pushpunctuation
>> and \poppunctuation methods in addition to the \removepunctuation
>> method. These might be useful for this purpose, but in any case, I still
>> have to check if the trailing character is one of the characters in a
>> specified set/string, and this is where the error is arising.
>>
>>
>> Add \protected (or \unexpanded) to your command definition.
>>
>> \startbtxrenderingdefinitions[myspec]
>> \protected\def\autopuncttest#1#2%
>>   {\removeunwantedspaces%
>>\doifinstring{#2}{,.!?;:}{#2}%
>>\footnote{#1}%
>>\doifnotinstring{#2}{,.!?;:}{#2}}
>> \stopbtxrenderingdefinitions
>>
>> 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
___


Re: [NTG-context] Short forms and abbreviations in bibliography

2021-10-11 Thread Joey McCollum via ntg-context
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  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
> -
>
___
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
___


Re: [NTG-context] Unusual error with \doifinstring in \startbtxrenderingdefinitions ... \stopbtxrenderingdefinitions

2021-10-10 Thread Joey McCollum via ntg-context
Thanks for these replies! Adding \unexpanded or \protected before \def
didn't fix the problem, and surrounding the definition with \unprotect ...
\protect didn't work either. But surrounding it with \pushcatcodetable
\setcatcodetable\ctxcatcodes ... \popcatcodetable worked.

I've never seen these commands before, but I gather from the existing
documentation that the current catcode governs which characters are treated
as special when a buffer is being processed. So here, it looks like I'm
temporarily switching from some other catcode set (it looks like in
publ-ini.mkiv, \catcode\commentasciicode\othercatcode gets invoked
in \publ_set_publication, so perhaps that's what's happening?) to the
default ConTeXt catcodes and then back.

Thanks again!

Joey

On Sun, Oct 10, 2021 at 6:40 AM Wolfgang Schuster <
wolfgang.schuster.li...@gmail.com> wrote:

> Joey McCollum via ntg-context schrieb am 10.10.2021 um 05:42:
>
> The test using \removepunctuation that you provided does what it should be
> doing (it produces 6 instances of "test-test" with the intervening
> punctuation mark in each case removed), but it doesn't do what I'm trying
> to do in the MWE above. I'm trying to take certain punctuation marks that
> follow the \autopuncttest macro and place them before it instead. Looking
> at the typo-chr .lua and .mkiv files, I see that there are \pushpunctuation
> and \poppunctuation methods in addition to the \removepunctuation method.
> These might be useful for this purpose, but in any case, I still have to
> check if the trailing character is one of the characters in a specified
> set/string, and this is where the error is arising.
>
>
> Add \protected (or \unexpanded) to your command definition.
>
> \startbtxrenderingdefinitions[myspec]
> \protected\def\autopuncttest#1#2%
>   {\removeunwantedspaces%
>\doifinstring{#2}{,.!?;:}{#2}%
>\footnote{#1}%
>\doifnotinstring{#2}{,.!?;:}{#2}}
> \stopbtxrenderingdefinitions
>
> 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
___


Re: [NTG-context] Unusual error with \doifinstring in \startbtxrenderingdefinitions ... \stopbtxrenderingdefinitions

2021-10-09 Thread Joey McCollum via ntg-context
The test using \removepunctuation that you provided does what it should be
doing (it produces 6 instances of "test-test" with the intervening
punctuation mark in each case removed), but it doesn't do what I'm trying
to do in the MWE above. I'm trying to take certain punctuation marks that
follow the \autopuncttest macro and place them before it instead. Looking
at the typo-chr .lua and .mkiv files, I see that there are \pushpunctuation
and \poppunctuation methods in addition to the \removepunctuation method.
These might be useful for this purpose, but in any case, I still have to
check if the trailing character is one of the characters in a specified
set/string, and this is where the error is arising.

Joey

On Sat, Oct 9, 2021 at 12:50 PM Hans Hagen  wrote:

> On 10/9/2021 5:40 PM, Joey McCollum via ntg-context wrote:
> > Hi,
> >
> > I'm trying to define concise biblatex-style citation macros for a custom
> > bibliographic style specification with support for intelligent placement
> > of trailing punctuation, and I've encountered an unusual error. If I try
> > to define the macros within the btxrenderingdefinitions environment,
> > then the code for handling trailing punctuation with the
> > \doifinstring and \doifnotinstring macros fails in some cases.
> > Specifically, it correctly detects when the trailing punctuation is a
> > period, comma, or semicolon, but not when it is a colon, exclamation
> > point, or question mark. The following MWE reproduces the error:
> >
> > ```
> \starttext
>
> test,\removepunctuation -test
> test;\removepunctuation -test
> test:\removepunctuation -test
> test?\removepunctuation -test
> test!\removepunctuation -test
> test.\removepunctuation -test
>
> \stoptext
>
>
>
> -
>Hans Hagen | PRAGMA ADE
>Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -
>
___
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] Unusual error with \doifinstring in \startbtxrenderingdefinitions ... \stopbtxrenderingdefinitions

2021-10-09 Thread Joey McCollum via ntg-context
Hi,

I'm trying to define concise biblatex-style citation macros for a custom
bibliographic style specification with support for intelligent placement of
trailing punctuation, and I've encountered an unusual error. If I try to
define the macros within the btxrenderingdefinitions environment, then the
code for handling trailing punctuation with the \doifinstring and
\doifnotinstring macros fails in some cases. Specifically, it correctly
detects when the trailing punctuation is a period, comma, or semicolon, but
not when it is a colon, exclamation point, or question mark. The following
MWE reproduces the error:

```

\startbtxrenderingdefinitions[myspec]

\def\autopuncttest#1#2{%

\removeunwantedspaces%

\doifinstring{#2}{,.!?;:}{#2}%

\footnote{#1}%

\doifnotinstring{#2}{,.!?;:}{#2}%

}

\stopbtxrenderingdefinitions


\usebtxdefinitions[myspec]


\starttext

This works \autopuncttest{Footnote 1}, as does this \autopuncttest{Footnote
2}; and so does this \autopuncttest{Footnote 3}.\blank

But this one fails if defined in the bib spec \autopuncttest{Footnote
4}!\blank

And why does this one fail in the bib spec too \autopuncttest{Footnote
5}?\blank

\stoptext
```

Everything works as expected if the macro definition is outside of the
btxrenderingdefinitions
environment. But within the environment, do certain punctuation marks need
to be escaped in the second argument of \doifinstring? Or is this a bug?

Joey
___
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
___


Re: [NTG-context] Short forms and abbreviations in bibliography

2021-10-06 Thread Joey McCollum via ntg-context
ink>\zerocount
>>>>>  \btx_cite_reference_inject_indeed
>>>>>  \settrue\c_btx_cite_reference_injected
>>>>>\fi\fi
>>>>>  \fi
>>>>>   \fi}
>>>>>
>>>>> ...
>>>>>
>>>>> \let\btxcitereference\btx_cite_reference_inject
>>>>>
>>>>> ...
>>>>>
>>>>> \unexpanded\def\btxhandleciteentry
>>>>>   {\dontleavehmode
>>>>>\begingroup
>>>>>\def\currentbtxcitealternative{entry}%
>>>>>\setbtxparameterset\s!cite\currentbtxcitealternative % needs
>>>>> checking
>>>>>\btxcitereference
>>>>>\btx_entry_inject
>>>>>\endgroup}
>>>>>
>>>>> My next step will be to figure out what these are doing, but I'm still
>>>>> not sure if the module accommodates rendering in-text "entry" citations
>>>>> differently than citations in the list.
>>>>>
>>>>> Joey
>>>>>
>>>>> On Mon, Aug 9, 2021 at 8:55 AM Joey McCollum <
>>>>> jmccollum20140...@gmail.com> wrote:
>>>>>
>>>>>> Henning's suggestion for abbreviations should work fine for that
>>>>>> issue. I could simply use the shorthand in the "series" and "journal"
>>>>>> fields and set up the appropriate \abbreviation calls in the document or
>>>>>> environment.
>>>>>>
>>>>>> As for the larger issue of bibliographies, I've started working on
>>>>>> publ-imp-sbl.lua and publ-imp-sbl.mkvi files. I knew I would need this 
>>>>>> for
>>>>>> my own project soon, and I felt it would be useful to myself and the
>>>>>> ConTeXt community if I could at least get a rudimentary version working.
>>>>>> I'm presently using the reference for examples from the *SBL
>>>>>> Handbook of Style*, 2nd edition, available at
>>>>>> https://github.com/dcpurton/biblatex-sbl/blob/master/test/biblatex-sbl-examples.ref.txt
>>>>>> .
>>>>>>
>>>>>> Like you say, some parts are tricky. SBL uses "entry"-style citations
>>>>>> by default and doesn't seem to make use of other common alternatives 
>>>>>> (such
>>>>>> as "authoryear"). I can think of some existing alternatives that might 
>>>>>> get
>>>>>> used in specific cases (e.g., "author", "title"), but the
>>>>>> recommended shorthand has the form "shortauthor, shorttitle" (i.e., the
>>>>>> last name(s) of the author(s) only, followed by a comma and a shortened
>>>>>> form of the title as specified in the "shorttitle" field). I could make
>>>>>> this the sbl style's implementation of the "short" alternative, since the
>>>>>> LaTeX-style bracketed number references are foreign to SBL style anyway,
>>>>>> but if would be preferable just to introduce another alternative 
>>>>>> (something
>>>>>> like "authortitle"), then I could also try to do that.
>>>>>>
>>>>>> For my immediate purposes, I won't need much more than the @book,
>>>>>> @article, @inbook, and @incollection entries, so my focus will be on
>>>>>> getting those right, but if anyone is interested in helping, I'll gladly
>>>>>> take help. (But it would probably be better to discuss the details in a
>>>>>> separate e-mail thread.)
>>>>>>
>>>>>> Joey
>>>>>>
>>>>>> On Mon, Aug 9, 2021 at 4:12 AM Denis Maier via ntg-context <
>>>>>> ntg-context@ntg.nl> wrote:
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> > -Ursprüngliche Nachricht-
>>>>>>> > Von: ntg-context  Im Auftrag von
>>>>>>> Henning
>>>>>>> > Hraban Ramm via ntg-context
>>>>>>> > Gesendet: Samstag, 7. August 2021 22:40
>>>>>>> > An: mailing list for ConTeXt users 
>>>>>>> > Cc: Henning Hraban Ramm 
>>>>>>> > Betreff: Re: [NTG-context] Short forms and abbreviations in
>>>>>>> bibliography
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> > > Am 07.08.2021 um 21:53 schrieb Joey McCollum via ntg-context
>>>>>>> >>>>>> > cont...@ntg.nl>:
>>>>>>> > >
>>>>>>> > > A separate list of abbreviations would then list "LSAWS"
>>>>>>> alongside "Linguistic
>>>>>>> > Studies in Ancient West Semitic" (and likewise for other
>>>>>>> journal/series
>>>>>>> > abbreviations).
>>>>>>> >
>>>>>>> > Regarding abbreviations have a look at
>>>>>>> > https://wiki.contextgarden.net/Command/definesynonyms
>>>>>>> >
>>>>>>> > It should be as easy as
>>>>>>> >
>>>>>>> > \abbreviation{LSAWS}{Linguistic Studies in Ancient West Semitic}
>>>>>>> >
>>>>>>> > The full name of \quote{LSAWS} is \infull{LSAWS}.
>>>>>>> >
>>>>>>> > \placelistofabbreviations
>>>>>>> >
>>>>>>> >
>>>>>>> > I had a case where mostly abbreviations were used in the text but
>>>>>>> the full name
>>>>>>> > should appear in the index.
>>>>>>> > I can provide the setup (including Lua functions), if it might
>>>>>>> help you.
>>>>>>> >
>>>>>>> >
>>>>>>> > Can’t help with bibliographies, sorry.
>>>>>>>
>>>>>>> SBL is a tricky beast anyway. There were some discussions regarding
>>>>>>> implementing Chicago Manual of Style a couple of weeks ago. 
>>>>>>> Develelopments
>>>>>>> on that front could also be useful for SBL. Don't know what came out of
>>>>>>> this though.
>>>>>>>
>>>>>>> Denis
>>>>>>>
>>>>>>> >
>>>>>>> > Hraban
>>>>>>> > 
>>>>>>> > ___
>>>>>>> > 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
>>>>>>> > 
>>>>>>> > ___
>>>>>>>
>>>>>>> ___
>>>>>>> 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
>>>>>>>
>>>>>>> ___
>>>>>>>
>>>>>>
___
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
___


Re: [NTG-context] Short forms and abbreviations in bibliography

2021-10-06 Thread Joey McCollum via ntg-context
t;>>>> environment.
>>>>>
>>>>> As for the larger issue of bibliographies, I've started working on
>>>>> publ-imp-sbl.lua and publ-imp-sbl.mkvi files. I knew I would need this for
>>>>> my own project soon, and I felt it would be useful to myself and the
>>>>> ConTeXt community if I could at least get a rudimentary version working.
>>>>> I'm presently using the reference for examples from the *SBL Handbook
>>>>> of Style*, 2nd edition, available at
>>>>> https://github.com/dcpurton/biblatex-sbl/blob/master/test/biblatex-sbl-examples.ref.txt
>>>>> .
>>>>>
>>>>> Like you say, some parts are tricky. SBL uses "entry"-style citations
>>>>> by default and doesn't seem to make use of other common alternatives (such
>>>>> as "authoryear"). I can think of some existing alternatives that might get
>>>>> used in specific cases (e.g., "author", "title"), but the
>>>>> recommended shorthand has the form "shortauthor, shorttitle" (i.e., the
>>>>> last name(s) of the author(s) only, followed by a comma and a shortened
>>>>> form of the title as specified in the "shorttitle" field). I could make
>>>>> this the sbl style's implementation of the "short" alternative, since the
>>>>> LaTeX-style bracketed number references are foreign to SBL style anyway,
>>>>> but if would be preferable just to introduce another alternative 
>>>>> (something
>>>>> like "authortitle"), then I could also try to do that.
>>>>>
>>>>> For my immediate purposes, I won't need much more than the @book,
>>>>> @article, @inbook, and @incollection entries, so my focus will be on
>>>>> getting those right, but if anyone is interested in helping, I'll gladly
>>>>> take help. (But it would probably be better to discuss the details in a
>>>>> separate e-mail thread.)
>>>>>
>>>>> Joey
>>>>>
>>>>> On Mon, Aug 9, 2021 at 4:12 AM Denis Maier via ntg-context <
>>>>> ntg-context@ntg.nl> wrote:
>>>>>
>>>>>>
>>>>>>
>>>>>> > -Ursprüngliche Nachricht-
>>>>>> > Von: ntg-context  Im Auftrag von
>>>>>> Henning
>>>>>> > Hraban Ramm via ntg-context
>>>>>> > Gesendet: Samstag, 7. August 2021 22:40
>>>>>> > An: mailing list for ConTeXt users 
>>>>>> > Cc: Henning Hraban Ramm 
>>>>>> > Betreff: Re: [NTG-context] Short forms and abbreviations in
>>>>>> bibliography
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> > > Am 07.08.2021 um 21:53 schrieb Joey McCollum via ntg-context >>>>> > cont...@ntg.nl>:
>>>>>> > >
>>>>>> > > A separate list of abbreviations would then list "LSAWS"
>>>>>> alongside "Linguistic
>>>>>> > Studies in Ancient West Semitic" (and likewise for other
>>>>>> journal/series
>>>>>> > abbreviations).
>>>>>> >
>>>>>> > Regarding abbreviations have a look at
>>>>>> > https://wiki.contextgarden.net/Command/definesynonyms
>>>>>> >
>>>>>> > It should be as easy as
>>>>>> >
>>>>>> > \abbreviation{LSAWS}{Linguistic Studies in Ancient West Semitic}
>>>>>> >
>>>>>> > The full name of \quote{LSAWS} is \infull{LSAWS}.
>>>>>> >
>>>>>> > \placelistofabbreviations
>>>>>> >
>>>>>> >
>>>>>> > I had a case where mostly abbreviations were used in the text but
>>>>>> the full name
>>>>>> > should appear in the index.
>>>>>> > I can provide the setup (including Lua functions), if it might help
>>>>>> you.
>>>>>> >
>>>>>> >
>>>>>> > Can’t help with bibliographies, sorry.
>>>>>>
>>>>>> SBL is a tricky beast anyway. There were some discussions regarding
>>>>>> implementing Chicago Manual of Style a couple of weeks ago. 
>>>>>> Develelopments
>>>>>> on that front could also be useful for SBL. Don't know what came out of
>>>>>> this though.
>>>>>>
>>>>>> Denis
>>>>>>
>>>>>> >
>>>>>> > Hraban
>>>>>> > 
>>>>>> > ___
>>>>>> > 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
>>>>>> > 
>>>>>> > ___
>>>>>>
>>>>>> ___
>>>>>> 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
>>>>>>
>>>>>> ___
>>>>>>
>>>>>
___
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
___


Re: [NTG-context] Short forms and abbreviations in bibliography

2021-10-06 Thread Joey McCollum via ntg-context
  \btxcitereference
>>>\currentbtxfirst
>>>}
>>> \fi
>>> \fastsetup{\s!btx:\s!cite:righttext}
>>> \stopsetups
>>>
>>> \startsetups \s!btx:\s!cite:entry
>>> \fastsetup{\s!btx:\s!cite:concat}
>>> \fastsetup{\s!btx:\s!cite:lefttext}
>>> \btxhandleciteentry
>>> \fastsetup{\s!btx:\s!cite:righttext}
>>> \stopsetups
>>>
>>> \startsetups \s!btx:\s!cite:footnote
>>> \startfootnote
>>> \fastsetup{btx:cite:entry}
>>> \stopfootnote
>>> \stopsetups
>>>
>>> Intuitively, I would expect btx:cite:listelement [why not
>>> \s!btx:\s!cite:listelement?] to handle rendering a bibliographic entry for
>>> the bibliography proper (i.e., the list typically placed at the end of a
>>> document), while \s!btx:\s!cite:entry would handle in-text citations. The
>>> third setup, \s!btx:\s!cite:footnote, simply renders the "entry"-style
>>> citation in a footnote.
>>>
>>> But as far as I can tell, the "listelement" setup is never used outside
>>> of publ-imp-cite.mkvi. Only the "entry" setup appears to be used.
>>> Meanwhile, the \btxcitereference and  \btxhandleciteentry macros (invoked
>>> in these setups) appear to be defined in publ-ini.mkiv:
>>>
>>> \unexpanded\def\btx_cite_reference_inject
>>>   {\ifconditional\c_btx_cite_reference_injected
>>>\else
>>>  \dontleavehmode
>>>  \iftrialtypesetting \else
>>>\ifx\currentbtxbacklink\empty
>>>  % can be made empty when combining author / year
>>>\else\ifnum\currentbtxbacklink>\zerocount
>>>  \btx_cite_reference_inject_indeed
>>>  \settrue\c_btx_cite_reference_injected
>>>\fi\fi
>>>  \fi
>>>   \fi}
>>>
>>> ...
>>>
>>> \let\btxcitereference\btx_cite_reference_inject
>>>
>>> ...
>>>
>>> \unexpanded\def\btxhandleciteentry
>>>   {\dontleavehmode
>>>\begingroup
>>>\def\currentbtxcitealternative{entry}%
>>>\setbtxparameterset\s!cite\currentbtxcitealternative % needs checking
>>>\btxcitereference
>>>\btx_entry_inject
>>>\endgroup}
>>>
>>> My next step will be to figure out what these are doing, but I'm still
>>> not sure if the module accommodates rendering in-text "entry" citations
>>> differently than citations in the list.
>>>
>>> Joey
>>>
>>> On Mon, Aug 9, 2021 at 8:55 AM Joey McCollum <
>>> jmccollum20140...@gmail.com> wrote:
>>>
>>>> Henning's suggestion for abbreviations should work fine for that issue.
>>>> I could simply use the shorthand in the "series" and "journal" fields and
>>>> set up the appropriate \abbreviation calls in the document or environment.
>>>>
>>>> As for the larger issue of bibliographies, I've started working on
>>>> publ-imp-sbl.lua and publ-imp-sbl.mkvi files. I knew I would need this for
>>>> my own project soon, and I felt it would be useful to myself and the
>>>> ConTeXt community if I could at least get a rudimentary version working.
>>>> I'm presently using the reference for examples from the *SBL Handbook
>>>> of Style*, 2nd edition, available at
>>>> https://github.com/dcpurton/biblatex-sbl/blob/master/test/biblatex-sbl-examples.ref.txt
>>>> .
>>>>
>>>> Like you say, some parts are tricky. SBL uses "entry"-style citations
>>>> by default and doesn't seem to make use of other common alternatives (such
>>>> as "authoryear"). I can think of some existing alternatives that might get
>>>> used in specific cases (e.g., "author", "title"), but the
>>>> recommended shorthand has the form "shortauthor, shorttitle" (i.e., the
>>>> last name(s) of the author(s) only, followed by a comma and a shortened
>>>> form of the title as specified in the "shorttitle" field). I could make
>>>> this the sbl style's implementation of the "short" alternative, since the
>>>> LaTeX-style bracketed number references are foreign to SBL style anyway,
>>>> but if would be preferable just to introduce another alternative (something
>>>> like "authortitle"), then I could also try to do that.
>>&g

Re: [NTG-context] Short forms and abbreviations in bibliography

2021-10-06 Thread Joey McCollum via ntg-context
y when combining author / year
>>\else\ifnum\currentbtxbacklink>\zerocount
>>  \btx_cite_reference_inject_indeed
>>  \settrue\c_btx_cite_reference_injected
>>\fi\fi
>>  \fi
>>   \fi}
>>
>> ...
>>
>> \let\btxcitereference\btx_cite_reference_inject
>>
>> ...
>>
>> \unexpanded\def\btxhandleciteentry
>>   {\dontleavehmode
>>\begingroup
>>\def\currentbtxcitealternative{entry}%
>>\setbtxparameterset\s!cite\currentbtxcitealternative % needs checking
>>\btxcitereference
>>\btx_entry_inject
>>\endgroup}
>>
>> My next step will be to figure out what these are doing, but I'm still
>> not sure if the module accommodates rendering in-text "entry" citations
>> differently than citations in the list.
>>
>> Joey
>>
>> On Mon, Aug 9, 2021 at 8:55 AM Joey McCollum 
>> wrote:
>>
>>> Henning's suggestion for abbreviations should work fine for that issue.
>>> I could simply use the shorthand in the "series" and "journal" fields and
>>> set up the appropriate \abbreviation calls in the document or environment.
>>>
>>> As for the larger issue of bibliographies, I've started working on
>>> publ-imp-sbl.lua and publ-imp-sbl.mkvi files. I knew I would need this for
>>> my own project soon, and I felt it would be useful to myself and the
>>> ConTeXt community if I could at least get a rudimentary version working.
>>> I'm presently using the reference for examples from the *SBL Handbook
>>> of Style*, 2nd edition, available at
>>> https://github.com/dcpurton/biblatex-sbl/blob/master/test/biblatex-sbl-examples.ref.txt
>>> .
>>>
>>> Like you say, some parts are tricky. SBL uses "entry"-style citations by
>>> default and doesn't seem to make use of other common alternatives (such as
>>> "authoryear"). I can think of some existing alternatives that might get
>>> used in specific cases (e.g., "author", "title"), but the
>>> recommended shorthand has the form "shortauthor, shorttitle" (i.e., the
>>> last name(s) of the author(s) only, followed by a comma and a shortened
>>> form of the title as specified in the "shorttitle" field). I could make
>>> this the sbl style's implementation of the "short" alternative, since the
>>> LaTeX-style bracketed number references are foreign to SBL style anyway,
>>> but if would be preferable just to introduce another alternative (something
>>> like "authortitle"), then I could also try to do that.
>>>
>>> For my immediate purposes, I won't need much more than the @book,
>>> @article, @inbook, and @incollection entries, so my focus will be on
>>> getting those right, but if anyone is interested in helping, I'll gladly
>>> take help. (But it would probably be better to discuss the details in a
>>> separate e-mail thread.)
>>>
>>> Joey
>>>
>>> On Mon, Aug 9, 2021 at 4:12 AM Denis Maier via ntg-context <
>>> ntg-context@ntg.nl> wrote:
>>>
>>>>
>>>>
>>>> > -Ursprüngliche Nachricht-
>>>> > Von: ntg-context  Im Auftrag von Henning
>>>> > Hraban Ramm via ntg-context
>>>> > Gesendet: Samstag, 7. August 2021 22:40
>>>> > An: mailing list for ConTeXt users 
>>>> > Cc: Henning Hraban Ramm 
>>>> > Betreff: Re: [NTG-context] Short forms and abbreviations in
>>>> bibliography
>>>> >
>>>> >
>>>> >
>>>> > > Am 07.08.2021 um 21:53 schrieb Joey McCollum via ntg-context >>> > cont...@ntg.nl>:
>>>> > >
>>>> > > A separate list of abbreviations would then list "LSAWS" alongside
>>>> "Linguistic
>>>> > Studies in Ancient West Semitic" (and likewise for other
>>>> journal/series
>>>> > abbreviations).
>>>> >
>>>> > Regarding abbreviations have a look at
>>>> > https://wiki.contextgarden.net/Command/definesynonyms
>>>> >
>>>> > It should be as easy as
>>>> >
>>>> > \abbreviation{LSAWS}{Linguistic Studies in Ancient West Semitic}
>>>> >
>>>> > The full name of \quote{LSAWS} is \infull{LSAWS}.
>>>> >
>>>> > \p

Re: [NTG-context] Short forms and abbreviations in bibliography

2021-10-06 Thread Joey McCollum via ntg-context
ment or environment.
>>
>> As for the larger issue of bibliographies, I've started working on
>> publ-imp-sbl.lua and publ-imp-sbl.mkvi files. I knew I would need this for
>> my own project soon, and I felt it would be useful to myself and the
>> ConTeXt community if I could at least get a rudimentary version working.
>> I'm presently using the reference for examples from the *SBL Handbook of
>> Style*, 2nd edition, available at
>> https://github.com/dcpurton/biblatex-sbl/blob/master/test/biblatex-sbl-examples.ref.txt
>> .
>>
>> Like you say, some parts are tricky. SBL uses "entry"-style citations by
>> default and doesn't seem to make use of other common alternatives (such as
>> "authoryear"). I can think of some existing alternatives that might get
>> used in specific cases (e.g., "author", "title"), but the
>> recommended shorthand has the form "shortauthor, shorttitle" (i.e., the
>> last name(s) of the author(s) only, followed by a comma and a shortened
>> form of the title as specified in the "shorttitle" field). I could make
>> this the sbl style's implementation of the "short" alternative, since the
>> LaTeX-style bracketed number references are foreign to SBL style anyway,
>> but if would be preferable just to introduce another alternative (something
>> like "authortitle"), then I could also try to do that.
>>
>> For my immediate purposes, I won't need much more than the @book,
>> @article, @inbook, and @incollection entries, so my focus will be on
>> getting those right, but if anyone is interested in helping, I'll gladly
>> take help. (But it would probably be better to discuss the details in a
>> separate e-mail thread.)
>>
>> Joey
>>
>> On Mon, Aug 9, 2021 at 4:12 AM Denis Maier via ntg-context <
>> ntg-context@ntg.nl> wrote:
>>
>>>
>>>
>>> > -Ursprüngliche Nachricht-
>>> > Von: ntg-context  Im Auftrag von Henning
>>> > Hraban Ramm via ntg-context
>>> > Gesendet: Samstag, 7. August 2021 22:40
>>> > An: mailing list for ConTeXt users 
>>> > Cc: Henning Hraban Ramm 
>>> > Betreff: Re: [NTG-context] Short forms and abbreviations in
>>> bibliography
>>> >
>>> >
>>> >
>>> > > Am 07.08.2021 um 21:53 schrieb Joey McCollum via ntg-context >> > cont...@ntg.nl>:
>>> > >
>>> > > A separate list of abbreviations would then list "LSAWS" alongside
>>> "Linguistic
>>> > Studies in Ancient West Semitic" (and likewise for other journal/series
>>> > abbreviations).
>>> >
>>> > Regarding abbreviations have a look at
>>> > https://wiki.contextgarden.net/Command/definesynonyms
>>> >
>>> > It should be as easy as
>>> >
>>> > \abbreviation{LSAWS}{Linguistic Studies in Ancient West Semitic}
>>> >
>>> > The full name of \quote{LSAWS} is \infull{LSAWS}.
>>> >
>>> > \placelistofabbreviations
>>> >
>>> >
>>> > I had a case where mostly abbreviations were used in the text but the
>>> full name
>>> > should appear in the index.
>>> > I can provide the setup (including Lua functions), if it might help
>>> you.
>>> >
>>> >
>>> > Can’t help with bibliographies, sorry.
>>>
>>> SBL is a tricky beast anyway. There were some discussions regarding
>>> implementing Chicago Manual of Style a couple of weeks ago. Develelopments
>>> on that front could also be useful for SBL. Don't know what came out of
>>> this though.
>>>
>>> Denis
>>>
>>> >
>>> > Hraban
>>> > 
>>> > ___
>>> > 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
>>> > 
>>> > ___
>>>
>>> ___
>>> 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
>>>
>>> ___
>>>
>>
___
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
___


Re: [NTG-context] Addition of authortitle sorttype for bibliographies

2021-10-04 Thread Joey McCollum via ntg-context
I'm not sure if this thread got lost back when I sent it, but I just wanted
to bump this thread again. The authortitle sort sequence detailed in the
previous e-mail is working as expected, and it may be a helpful addition to
the publ-aut.lua file for general use. In case the last e-mail was lost,
I've repeated the code below:

```
publications.sortmethods.authortitle = {
sequence = {
{ field = "author",default = "",   unknown = "" },
{ field = "title", default = "",   unknown = "" },
{ field = "booktitle", default = "",   unknown = "" }, --
if this is an untitled section (e.g., introduction, foreword, preface) of a
book or a review of a book
{ field = "maintitle", default = "",   unknown = "" }, --
if this is an untitled section or volume in a multivolume collection
{ field = "volume",default = "",   unknown = "" },
{ field = "part",  default = "",   unknown = "" },
{ field = "date",  default = "9998-13-32", unknown =
"-14-33" }, -- some specifications allow date instead of year, month,
day
{ field = "year",  default = "9998",   unknown = "" },
{ field = "month", default = "13", unknown = "14" },
{ field = "day",   default = "32", unknown = "33" },
{ field = "index", default = "",   unknown = "" },
},
}
```

Joey

On Sun, Sep 19, 2021 at 10:57 PM Joey McCollum 
wrote:

> Actually, since some categories (such as @review and @suppbook from
> biblatex) do not necessarily have titles of their own, it may be best to
> include a few other fields in the sort sequence to accommodate them. The
> following sequence may be better:
>
> ```
> publications.sortmethods.authortitle = {
> sequence = {
> { field = "author",default = "",   unknown = "" },
> { field = "title", default = "",   unknown = "" },
> { field = "booktitle", default = "",   unknown = "" }, --
> if this is an untitled section (e.g., introduction, foreword, preface) of a
> book or a review of a book
> { field = "maintitle", default = "",   unknown = "" }, --
> if this is an untitled section or volume in a multivolume collection
> { field = "volume",default = "",   unknown = "" },
> { field = "part",  default = "",   unknown = "" },
> { field = "date",  default = "9998-13-32", unknown =
> "-14-33" }, -- some specifications allow date instead of year, month,
> day
> { field = "year",  default = "9998",   unknown = "" },
> { field = "month", default = "13", unknown = "14" },
> { field = "day",   default = "32", unknown = "33" },
> { field = "index", default = "",   unknown = "" },
> },
> }
> ```
>
> It is also worth noting that in order for the volume field to sort
> properly, its values will have to be padded with leading zeroes; otherwise,
> an entry with volume = {2} will be sorted after one with volume = {10}. To
> accommodate this, specifications would need to remove the leading zeroes
> when they typeset volume and part numbers.
>
> Joey
>
> On Sun, Sep 19, 2021 at 2:02 PM Joey McCollum 
> wrote:
>
>> Hi,
>>
>> I've had to make another update to the general publications support code
>> in order to implement a feature of the SBL rendering. Denis Maier has
>> opened some issues on the context-sbl GitHub repo (
>> https://github.com/jjmccollum/context-sbl) to offer some helpful
>> suggestions about needed features and bug fixes. One issue was that SBL
>> should order list entries by author and title. Thankfully, there is already
>> an authordate sortmethod defined in publ-aut.lua (probably to support the
>> Chicago rendering), so I was able to use it as a template for the
>> following authortitle sort sequence:
>>
>> ```
>> publications.sortmethods.authortitle = {
>> sequence = {
>> { field = "author",  default = "", unknown = "" },
>> { field = "title",   default = "", unknown = "" },
>> { field = "date",  default = "9998-13-32", unknown =
>> "-14-33" }, -- some specifications allow date instead of year, month,
>> day
>> { field = "year",default = "9998", unknown = "" },
>> { field = "month",   default = "13",   unknown = "14" },
>> { field = "day", default = "32",   unknown = "33" },
>> { field = "index",   default = "", unknown = "" },
>> },
>> }
>> ```
>>
>> I added this to publ-aut.lua because publications.sortmethods.authoryear
>> is defined in that file, but if another location is more appropriate, then
>> feel free to let me know, and I can move it! Otherwise, if this looks okay
>> to include in a future update, then feel free to incorporate it!
>>
>> Joey
>>
>

Re: [NTG-context] Ibid. and idem support for bibliographies (and variable scope more generally)

2021-09-21 Thread Joey McCollum via ntg-context
Ah, I see. My implementation will mess up in that case. We may need methods
that keep track of whether a citation is made in a footnote or not. I'm not
sure how to implement that. Certainly, if we knew that all footnote
citations were being made with the alternative=footnote option, then that
probably make things easier, but in the case of a verbose footnote that
only features a citation at the end, it would likely be more convenient for
a user to use the inline alternative in the footnote, as you do in your
example.

Thanks for catching that!

Joey

On Tue, Sep 21, 2021 at 11:55 AM  wrote:

> To be clear, I wasn’t talking 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.
>
>
>
> Denis
>
>
>
>
>
> *Von:* Joey McCollum 
> *Gesendet:* Dienstag, 21. September 2021 17:16
> *An:* Maier, Denis Christian (UB) 
> *Cc:* mailing list for ConTeXt users 
> *Betreff:* Re: [NTG-context] Ibid. and idem support for bibliographies
> (and variable scope more generally)
>
>
>
> Yes, I haven't added any code to check for the useibid or useidem options
> in list citations; they are only used for in-text citations in the SBL
> specification definition. The distinction between \setupbtx[sbl:\s!list]
> and \setupbtx[sbl:\s!cite] should allow us to specify their options
> separately. For list citations, we probably should add a "sameauthor"
> option, with "rule" (draw a horizontal rule for repeated authors), "empty"
> (leave a blank space the size of the "margin" option), and "ditto" (e.g., a
> dumb quote sign, or "Idem") as potential values, since all three of these
> options are currently supported in publ-imp-chicago.mkvi and
> publ-imp-sbl.mkvi, but as far as I know, they always default to the "rule"
> setup.
>
>
>
> Joey
>
>
>
> On Tue, Sep 21, 2021 at 12:52 AM  wrote:
>
> Cool.
>
> I don't know about your particular solution, but will probably want to
> make sure to have different variables for citations in the main text and in
> the notes.
>
> Denis
>
>
>
> 
> Von: ntg-context  im Auftrag von Joey
> McCollum via ntg-context 
> Gesendet: Dienstag, 21. September 2021 02:22:49
> An: mailing list for ConTeXt users
> Cc: Joey McCollum
> Betreff: [NTG-context] Ibid. and idem support for bibliographies (and
> variable scope more generally)
>
> Hi,
>
> I've found a way to implement ibid. and idem support in the SBL
> specification under development at
> https://github.com/jjmccollum/context-sbl (this e-mail essentially
> repeats my comments in https://github.com/jjmccollum/context-sbl/issues/5),
> but I'm not sure if my solution is a recommended way to solve the problem,
> and I'm curious about why the more straightforward approach doesn't work.
>
> I've added useibid and useidem options for the \definebtx command (making
> them language-dependent by adding them to mult-def.lua, which seems to be
> how the other options have been implemented). Ideally, I'd like to follow
> the pattern of the chicago:list:sameauthor setup and use a macro similar to
> \btxdoifsameaspreviouselse. But since \btxdoifsameaspreviouselse relies on
> the indexed structure of the bibliographic list to determine what the
> "previous" entry is, it won't work for my purposes; I need to retrieve the
> tag of the last entry passed to the \cite command.
>
> I ended up making this work by initializing a global variable via
>
> ```
> \setxvariables[btx:sbl][previousinlinetag=\empty]
> ```
>
> in the publ-imp-sbl.mkvi file, resetting it at the end of each citation via
>
> ```
> \setxvariables[btx:sbl][previousinlinetag=\currentbtxtag]
> ```
>
> and checking it in the appropriate places via
>
> ```
> getvariable{btx:sbl}{previousinlinetag}
> ```
>
> I initially tried to do this with a simple macro
> \btx_sbl_previousinlinetag defined in publ-imp-sbl.mkvi (in the same scope
> as the rest of the specification), but attempting to reset it in the cite
> setups with \let or \def didn't work. Why doesn't this work? Is the setup
> for a cite alternative executed in its own scope in a way that would
> 

Re: [NTG-context] Ibid. and idem support for bibliographies (and variable scope more generally)

2021-09-21 Thread Joey McCollum via ntg-context
Yes, I haven't added any code to check for the useibid or useidem options
in list citations; they are only used for in-text citations in the SBL
specification definition. The distinction between \setupbtx[sbl:\s!list]
and \setupbtx[sbl:\s!cite] should allow us to specify their options
separately. For list citations, we probably should add a "sameauthor"
option, with "rule" (draw a horizontal rule for repeated authors), "empty"
(leave a blank space the size of the "margin" option), and "ditto" (e.g., a
dumb quote sign, or "Idem") as potential values, since all three of these
options are currently supported in publ-imp-chicago.mkvi and
publ-imp-sbl.mkvi, but as far as I know, they always default to the "rule"
setup.

Joey

On Tue, Sep 21, 2021 at 12:52 AM  wrote:

> Cool.
>
> I don't know about your particular solution, but will probably want to
> make sure to have different variables for citations in the main text and in
> the notes.
>
> Denis
>
>
>
> 
> Von: ntg-context  im Auftrag von Joey
> McCollum via ntg-context 
> Gesendet: Dienstag, 21. September 2021 02:22:49
> An: mailing list for ConTeXt users
> Cc: Joey McCollum
> Betreff: [NTG-context] Ibid. and idem support for bibliographies (and
> variable scope more generally)
>
> Hi,
>
> I've found a way to implement ibid. and idem support in the SBL
> specification under development at
> https://github.com/jjmccollum/context-sbl (this e-mail essentially
> repeats my comments in https://github.com/jjmccollum/context-sbl/issues/5),
> but I'm not sure if my solution is a recommended way to solve the problem,
> and I'm curious about why the more straightforward approach doesn't work.
>
> I've added useibid and useidem options for the \definebtx command (making
> them language-dependent by adding them to mult-def.lua, which seems to be
> how the other options have been implemented). Ideally, I'd like to follow
> the pattern of the chicago:list:sameauthor setup and use a macro similar to
> \btxdoifsameaspreviouselse. But since \btxdoifsameaspreviouselse relies on
> the indexed structure of the bibliographic list to determine what the
> "previous" entry is, it won't work for my purposes; I need to retrieve the
> tag of the last entry passed to the \cite command.
>
> I ended up making this work by initializing a global variable via
>
> ```
> \setxvariables[btx:sbl][previousinlinetag=\empty]
> ```
>
> in the publ-imp-sbl.mkvi file, resetting it at the end of each citation via
>
> ```
> \setxvariables[btx:sbl][previousinlinetag=\currentbtxtag]
> ```
>
> and checking it in the appropriate places via
>
> ```
> getvariable{btx:sbl}{previousinlinetag}
> ```
>
> I initially tried to do this with a simple macro
> \btx_sbl_previousinlinetag defined in publ-imp-sbl.mkvi (in the same scope
> as the rest of the specification), but attempting to reset it in the cite
> setups with \let or \def didn't work. Why doesn't this work? Is the setup
> for a cite alternative executed in its own scope in a way that would
> prevent me from updating a variable defined in the scope of the rendering
> specification? And is there a way to do this that is preferable to using
> global variables?
>
> Thanks!
>
> Joey
>
___
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] Ibid. and idem support for bibliographies (and variable scope more generally)

2021-09-20 Thread Joey McCollum via ntg-context
Hi,

I've found a way to implement ibid. and idem support in the SBL
specification under development at https://github.com/jjmccollum/context-sbl
(this e-mail essentially repeats my comments in
https://github.com/jjmccollum/context-sbl/issues/5), but I'm not sure if my
solution is a recommended way to solve the problem, and I'm curious about
why the more straightforward approach doesn't work.

I've added useibid and useidem options for the \definebtx command (making
them language-dependent by adding them to mult-def.lua, which seems to be
how the other options have been implemented). Ideally, I'd like to follow
the pattern of the chicago:list:sameauthor setup and use a macro similar to
\btxdoifsameaspreviouselse. But since \btxdoifsameaspreviouselse relies on
the indexed structure of the bibliographic list to determine what the
"previous" entry is, it won't work for my purposes; I need to retrieve the
tag of the last entry passed to the \cite command.

I ended up making this work by initializing a global variable via

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

in the publ-imp-sbl.mkvi file, resetting it at the end of each citation via

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

and checking it in the appropriate places via

```
getvariable{btx:sbl}{previousinlinetag}
```

I initially tried to do this with a simple macro \btx_sbl_previousinlinetag
defined in publ-imp-sbl.mkvi (in the same scope as the rest of the
specification), but attempting to reset it in the cite setups with \let or
\def didn't work. Why doesn't this work? Is the setup for a cite
alternative executed in its own scope in a way that would prevent me from
updating a variable defined in the scope of the rendering specification?
And is there a way to do this that is preferable to using global variables?

Thanks!

Joey
___
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
___


Re: [NTG-context] Addition of authortitle sorttype for bibliographies

2021-09-19 Thread Joey McCollum via ntg-context
Actually, since some categories (such as @review and @suppbook from
biblatex) do not necessarily have titles of their own, it may be best to
include a few other fields in the sort sequence to accommodate them. The
following sequence may be better:

```
publications.sortmethods.authortitle = {
sequence = {
{ field = "author",default = "",   unknown = "" },
{ field = "title", default = "",   unknown = "" },
{ field = "booktitle", default = "",   unknown = "" }, --
if this is an untitled section (e.g., introduction, foreword, preface) of a
book or a review of a book
{ field = "maintitle", default = "",   unknown = "" }, --
if this is an untitled section or volume in a multivolume collection
{ field = "volume",default = "",   unknown = "" },
{ field = "part",  default = "",   unknown = "" },
{ field = "date",  default = "9998-13-32", unknown =
"-14-33" }, -- some specifications allow date instead of year, month,
day
{ field = "year",  default = "9998",   unknown = "" },
{ field = "month", default = "13", unknown = "14" },
{ field = "day",   default = "32", unknown = "33" },
{ field = "index", default = "",   unknown = "" },
},
}
```

It is also worth noting that in order for the volume field to sort
properly, its values will have to be padded with leading zeroes; otherwise,
an entry with volume = {2} will be sorted after one with volume = {10}. To
accommodate this, specifications would need to remove the leading zeroes
when they typeset volume and part numbers.

Joey

On Sun, Sep 19, 2021 at 2:02 PM Joey McCollum 
wrote:

> Hi,
>
> I've had to make another update to the general publications support code
> in order to implement a feature of the SBL rendering. Denis Maier has
> opened some issues on the context-sbl GitHub repo (
> https://github.com/jjmccollum/context-sbl) to offer some helpful
> suggestions about needed features and bug fixes. One issue was that SBL
> should order list entries by author and title. Thankfully, there is already
> an authordate sortmethod defined in publ-aut.lua (probably to support the
> Chicago rendering), so I was able to use it as a template for the
> following authortitle sort sequence:
>
> ```
> publications.sortmethods.authortitle = {
> sequence = {
> { field = "author",  default = "", unknown = "" },
> { field = "title",   default = "", unknown = "" },
> { field = "date",  default = "9998-13-32", unknown =
> "-14-33" }, -- some specifications allow date instead of year, month,
> day
> { field = "year",default = "9998", unknown = "" },
> { field = "month",   default = "13",   unknown = "14" },
> { field = "day", default = "32",   unknown = "33" },
> { field = "index",   default = "", unknown = "" },
> },
> }
> ```
>
> I added this to publ-aut.lua because publications.sortmethods.authoryear
> is defined in that file, but if another location is more appropriate, then
> feel free to let me know, and I can move it! Otherwise, if this looks okay
> to include in a future update, then feel free to incorporate it!
>
> Joey
>
___
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] Addition of authortitle sorttype for bibliographies

2021-09-19 Thread Joey McCollum via ntg-context
Hi,

I've had to make another update to the general publications support code in
order to implement a feature of the SBL rendering. Denis Maier has opened
some issues on the context-sbl GitHub repo (
https://github.com/jjmccollum/context-sbl) to offer some helpful
suggestions about needed features and bug fixes. One issue was that SBL
should order list entries by author and title. Thankfully, there is already
an authordate sortmethod defined in publ-aut.lua (probably to support the
Chicago rendering), so I was able to use it as a template for the
following authortitle sort sequence:

```
publications.sortmethods.authortitle = {
sequence = {
{ field = "author",  default = "", unknown = "" },
{ field = "title",   default = "", unknown = "" },
{ field = "date",  default = "9998-13-32", unknown =
"-14-33" }, -- some specifications allow date instead of year, month,
day
{ field = "year",default = "9998", unknown = "" },
{ field = "month",   default = "13",   unknown = "14" },
{ field = "day", default = "32",   unknown = "33" },
{ field = "index",   default = "", unknown = "" },
},
}
```

I added this to publ-aut.lua because publications.sortmethods.authoryear is
defined in that file, but if another location is more appropriate, then
feel free to let me know, and I can move it! Otherwise, if this looks okay
to include in a future update, then feel free to incorporate it!

Joey
___
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] Exclude bibliographic entries from list even when cited with \cite

2021-09-16 Thread Joey McCollum via ntg-context
Hi,

It's taken a couple weeks, but I nearly have a working bibliographic
rendering for SBL style ready. I'm hosting the .lua and .mkvi files I have
so far, as well as a test .bib and .tex file, on GitHub at
https://github.com/jjmccollum/context-sbl. The look of the rendering seems
to be correct for all of the examples, so the last remaining tasks mostly
concern some lower-level technical issues.

Because of the way that SBL style renders entries that are contained in
other works (e.g., a chapter in a book that is part of a multivolume
collection), it seemed natural to accommodate this by allowing entries to
have cross-references to other entries. The rendering process can then be
handled through recursive subcitations with different alternatives. In
general, I handle these subcitations with the \textcite command, so that
"higher-level" entries are not added to the list when they are only
subcited.

An important guideline that I still have to implement works in the opposite
direction: it says that entries in certain categories should not be added
to the list, but the books or collections containing them should be. I
think I could make this work for the subcitation using the \listcite or
\cite command recursively. But is there a way to conditionally handle
whether or not to add the entry to the list after I invoke the \cite
command, or is this built into the \cite command at a low level? If I had
to, I could define an \autocite command that does all of these checks
first, but if it's possible to keep the common \cite command instead of
forcing users to use a different command, that would be preferable.

Thanks!

Joey
___
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
___


Re: [NTG-context] Implementing a custom authorconversion for bibliographies

2021-09-15 Thread Joey McCollum via ntg-context
Looks like it was just a small oversight on my part; I had to make sure I
added a corresponding \s!btx:\s!list:\s!author:invertedfirst setup for list
entries. Here's what finally works:

```
\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

...

\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
```

Thanks again, Hans!

Joey

On Wed, Sep 15, 2021 at 10:13 AM Joey McCollum 
wrote:

> Good suggestion! I removed my changes to publ-aut.lua for now and tried
> adding each of the two setups you described to publ-imp-author.mkvi (where
> it seemed to fit best). But simply specifying
>
> ```
> \definebtx
>   [sbl:\s!list:author]
>   [sbl:\s!list]
>   [\c!authorconversion=invertedfirst]
> ```
>
> in my custom rendering file does not access the invertedfirst setup,
> regardless of which of the two setups I use. Do I have to do something
> different to access it?
>
> Thanks!
>
> On Wed, Sep 15, 2021 at 4:18 AM Hans Hagen  wrote:
>
>> On 9/15/2021 5:06 AM, Joey McCollum via ntg-context wrote:
>> > All right, I figured out where I needed to make this change for it to
>> > take effect. The relevant script is publ-aut.lua. The code I needed to
>> > change was for the "oneauthor" function definition, which itself is
>> > located in the "btxauthor" function definition. My changes are detailed
>> > below:
>>
>> did you try to stay at the tex end? like:
>>
>> % \startsetups \s!btx:\s!cite:\s!author:invertedfirst
>> % \ifnum\currentbtxauthorindex>\plusone
>> %\btxsetauthorvariant{inverted}
>> % \else
>> %\btxsetauthorvariant{normal}
>> % \fi
>> % \fastsetup{\s!btx:\s!cite:\s!author:\btxauthorvariant}
>> % \stopsetups
>>
>> \startsetups \s!btx:\s!cite:\s!author:invertedfirst
>>  \ifnum\currentbtxauthorindex>\plusone
>> \fastsetup{\s!btx:\s!cite:\s!author:inverted}
>>  \else
>> \fastsetup{\s!btx:\s!cite:\s!author:normal}
>>  \fi
>> \stopsetups
>>
>>
>>
>> > ```
>> >  local function oneauthor(i,last,justone)
>> >  local author = split[i]
>> >  if index then
>> >  ctx_btxstartauthor(i,1,0)
>> >  elseif last then
>> >  ctx_btxstartauthor(i,1,0)
>> >  ctx_btxsetconcat(0)
>> >  if combiner == "invertedfirst" then
>> >  if i == 1 then
>> >  ctx_btxsetauthorvariant("inverted")
>> >  else
>> >  ctx_btxsetauthorvariant("normal")
>> >  end
>> >  else
>> >  ctx_btxsetauthorvariant(combiner)
>> >  end
>> >  else
>> >  local state = author.state or 0
>> >  ctx_btxstartauthor(i,max,state)
>> >  ctx_btxsetconcat(concatstate(i,max))
>> >  if combiner == "invertedfirst" then
>> >  if i == 1 then
>> >  ctx_btxsetauthorvariant("inverted")
>> >  else
>> >  ctx_btxsetauthorvariant("normal")
>> >  end
>> >  else
>> >  ctx_btxsetauthorvariant(combiner)
>> >  end
>> >  end
>> >  local initials = author.initials
>> >  if initials and #initials > 0 then
>> >  ctx_btxsetinitials() --
>> > (concat(the_initials(initials,symbol)," "))
>> >  end
>> >  local firstnames = author.firstnames
>> >  if firstnames and #firstnames > 0 then
>> >  ctx_btxsetfirstnames() -- (concat(firstnames," "))
>> >  end
>> >  local vons = author.vons
>> >  if vons and #vons > 0 then
>> >  ctx_btxsetvons() -- (concat(vons," "))
>> >  end
&

Re: [NTG-context] Implementing a custom authorconversion for bibliographies

2021-09-15 Thread Joey McCollum via ntg-context
Good suggestion! I removed my changes to publ-aut.lua for now and tried
adding each of the two setups you described to publ-imp-author.mkvi (where
it seemed to fit best). But simply specifying

```
\definebtx
  [sbl:\s!list:author]
  [sbl:\s!list]
  [\c!authorconversion=invertedfirst]
```

in my custom rendering file does not access the invertedfirst setup,
regardless of which of the two setups I use. Do I have to do something
different to access it?

Thanks!

On Wed, Sep 15, 2021 at 4:18 AM Hans Hagen  wrote:

> On 9/15/2021 5:06 AM, Joey McCollum via ntg-context wrote:
> > All right, I figured out where I needed to make this change for it to
> > take effect. The relevant script is publ-aut.lua. The code I needed to
> > change was for the "oneauthor" function definition, which itself is
> > located in the "btxauthor" function definition. My changes are detailed
> > below:
>
> did you try to stay at the tex end? like:
>
> % \startsetups \s!btx:\s!cite:\s!author:invertedfirst
> % \ifnum\currentbtxauthorindex>\plusone
> %\btxsetauthorvariant{inverted}
> % \else
> %\btxsetauthorvariant{normal}
> % \fi
> % \fastsetup{\s!btx:\s!cite:\s!author:\btxauthorvariant}
> % \stopsetups
>
> \startsetups \s!btx:\s!cite:\s!author:invertedfirst
>  \ifnum\currentbtxauthorindex>\plusone
> \fastsetup{\s!btx:\s!cite:\s!author:inverted}
>  \else
> \fastsetup{\s!btx:\s!cite:\s!author:normal}
>  \fi
> \stopsetups
>
>
>
> > ```
> >  local function oneauthor(i,last,justone)
> >  local author = split[i]
> >  if index then
> >  ctx_btxstartauthor(i,1,0)
> >  elseif last then
> >  ctx_btxstartauthor(i,1,0)
> >  ctx_btxsetconcat(0)
> >  if combiner == "invertedfirst" then
> >  if i == 1 then
> >  ctx_btxsetauthorvariant("inverted")
> >  else
> >  ctx_btxsetauthorvariant("normal")
> >  end
> >  else
> >  ctx_btxsetauthorvariant(combiner)
> >  end
> >  else
> >  local state = author.state or 0
> >  ctx_btxstartauthor(i,max,state)
> >  ctx_btxsetconcat(concatstate(i,max))
> >  if combiner == "invertedfirst" then
> >  if i == 1 then
> >  ctx_btxsetauthorvariant("inverted")
> >  else
> >  ctx_btxsetauthorvariant("normal")
> >  end
> >  else
> >  ctx_btxsetauthorvariant(combiner)
> >  end
> >  end
> >  local initials = author.initials
> >  if initials and #initials > 0 then
> >  ctx_btxsetinitials() --
> > (concat(the_initials(initials,symbol)," "))
> >  end
> >  local firstnames = author.firstnames
> >  if firstnames and #firstnames > 0 then
> >  ctx_btxsetfirstnames() -- (concat(firstnames," "))
> >  end
> >  local vons = author.vons
> >  if vons and #vons > 0 then
> >  ctx_btxsetvons() -- (concat(vons," "))
> >  end
> >  local surnames = author.surnames
> >  if surnames and #surnames > 0 then
> >  ctx_btxsetsurnames() -- (concat(surnames," "))
> >  end
> >  local juniors = author.juniors
> >  if juniors and #juniors > 0 then
> >  ctx_btxsetjuniors() -- (concat(juniors," "))
> >  end
> >  if not index and i == max then
> >  if split.others then
> >  ctx_btxsetoverflow(1)
> >  else
> >  local overflow = #split - max
> >  if overflow > 0 then
> >  ctx_btxsetoverflow(overflow)
> >  end
> >  end
> >  end
> >  if combiner == "invertedfirst" then
> >  if i == 1 then
> >  ctx_btxsetup("inverted")
> >  else
> >  

Re: [NTG-context] Implementing a custom authorconversion for bibliographies

2021-09-14 Thread Joey McCollum via ntg-context
All right, I figured out where I needed to make this change for it to take
effect. The relevant script is publ-aut.lua. The code I needed to change
was for the "oneauthor" function definition, which itself is located in the
"btxauthor" function definition. My changes are detailed below:

```
local function oneauthor(i,last,justone)
local author = split[i]
if index then
ctx_btxstartauthor(i,1,0)
elseif last then
ctx_btxstartauthor(i,1,0)
ctx_btxsetconcat(0)
if combiner == "invertedfirst" then
if i == 1 then
ctx_btxsetauthorvariant("inverted")
else
ctx_btxsetauthorvariant("normal")
end
else
ctx_btxsetauthorvariant(combiner)
end
else
local state = author.state or 0
ctx_btxstartauthor(i,max,state)
ctx_btxsetconcat(concatstate(i,max))
if combiner == "invertedfirst" then
if i == 1 then
ctx_btxsetauthorvariant("inverted")
else
ctx_btxsetauthorvariant("normal")
end
else
ctx_btxsetauthorvariant(combiner)
end
end
local initials = author.initials
if initials and #initials > 0 then
ctx_btxsetinitials() --
(concat(the_initials(initials,symbol)," "))
end
local firstnames = author.firstnames
if firstnames and #firstnames > 0 then
ctx_btxsetfirstnames() -- (concat(firstnames," "))
end
local vons = author.vons
if vons and #vons > 0 then
ctx_btxsetvons() -- (concat(vons," "))
end
local surnames = author.surnames
if surnames and #surnames > 0 then
ctx_btxsetsurnames() -- (concat(surnames," "))
end
local juniors = author.juniors
if juniors and #juniors > 0 then
ctx_btxsetjuniors() -- (concat(juniors," "))
end
if not index and i == max then
if split.others then
ctx_btxsetoverflow(1)
else
local overflow = #split - max
if overflow > 0 then
ctx_btxsetoverflow(overflow)
end
end
end
if combiner == "invertedfirst" then
if i == 1 then
ctx_btxsetup("inverted")
else
ctx_btxsetup("normal")
end
else
ctx_btxsetup(combiner)
end
ctx_btxstopauthor()
end
```

I'll admit that the addition of entire if-else blocks around whether or not
the combiner is a specific value may not be the best practice in terms of
future maintenance (especially if similar index-dependent
authorconversions are needed in the future). Alternatively, the
"btxauthor" function could populate a "combiners" array of length "max"
with a specific authorconversion for each author in the split; for most
authorconversions, all entries in this array would be the same, but for
authorconversions like "invertedfirst", the first entry would be different
from the rest. Then, the "oneauthor" function could just reference
combiners[i] instead of combiner.

Joey

On Fri, Sep 3, 2021 at 10:48 PM Joey McCollum 
wrote:

> Hi,
>
> I mentioned this in an earlier e-mail but thought that now might be a good
> time to describe this issue in detail. I'd like to define a new
> authorconversion that renders the first author in a list differently than
> the remaining authors in the list. Specifically, I'd like to use the
> "inverted" authorconversion for the first author and the "normal"
> authorconversion for the rest.
>
> In the newer bibl-bib.lua file, I can see what I might have to modify to
> accomplish this (I added the  if combiner == "invertedfirst"  block):
>
> ```
> function authors.concat(author,combiner,what,settings)
> if type(combiner) == "string" then
> combiner = authors[combiner or "normal"] or authors.normal
> end
> local split = splitauthors(author)
> local setting = settings[what]
> local etallimit, etaldisplay, etaltext = 1000, 1000, ""
> if setting then
> etallimit   = settings.etallimit   or 1000
> etaldisplay = settings.etaldisplay or etallimit
> etalltext   = settings.etaltextor ""
> end
> local max = #split
> if max > etallimit and etaldisplay < max then
> max = etaldisplay
> end
> if combiner == "invertedfirst" then
> for i=1,max do
> if i == 1 then
> split[i] 

[NTG-context] Implementing a custom authorconversion for bibliographies

2021-09-03 Thread Joey McCollum via ntg-context
Hi,

I mentioned this in an earlier e-mail but thought that now might be a good
time to describe this issue in detail. I'd like to define a new
authorconversion that renders the first author in a list differently than
the remaining authors in the list. Specifically, I'd like to use the
"inverted" authorconversion for the first author and the "normal"
authorconversion for the rest.

In the newer bibl-bib.lua file, I can see what I might have to modify to
accomplish this (I added the  if combiner == "invertedfirst"  block):

```
function authors.concat(author,combiner,what,settings)
if type(combiner) == "string" then
combiner = authors[combiner or "normal"] or authors.normal
end
local split = splitauthors(author)
local setting = settings[what]
local etallimit, etaldisplay, etaltext = 1000, 1000, ""
if setting then
etallimit   = settings.etallimit   or 1000
etaldisplay = settings.etaldisplay or etallimit
etalltext   = settings.etaltextor ""
end
local max = #split
if max > etallimit and etaldisplay < max then
max = etaldisplay
end
if combiner == "invertedfirst" then
for i=1,max do
if i == 1 then
split[i] = authors.inverted(split[i],settings)
else
split[i] = authors.normal(split[i],settings)
end

end
else
for i=1,max do
split[i] = combiner(split[i],settings)
end
end
local result = bibtexconcat(split,settings)
if max < #split then
return result
else
return result .. etaltext
end
end
```

Unfortunately, this doesn't seem to do anything. It's not clear to me
how bibl-bib.lua and bibl-bib.mkiv are being used by the other publication
support modules, if they're being used at all (publ-ini.mkiv doesn't appear
to register it, anyway). Is there another file I'd have to change to make
"invertedfirst" a working authorconversion? Is there a similar block of
code in publ-ini.lua where I should be implementing this change instead?

Thanks!

Joey
___
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] Different authorconversion for citation alternatives and bibliographic entries

2021-08-27 Thread Joey McCollum via ntg-context
I dealt with this issue at length in a separate thread (“Different author rendering in entry citation vs. list”) a couple months after you asked about this, so for the benefit of anyone who has been following this thread specifically, I’ll describe the solution I found here. There are (at least) a few commands defined in publ-imp-ini.mkiv that can help conditionally render author fields according to cite parameters rather than list parameters. The first, \btxflushauthornormal{author} (where author can be replaced by another name-type field, if I understand correctly), will flush the specified field according to the “normal” authorconversion. There are similar commands for \btxflushauthorname, \btxflushauthornormalshort, \btxflushauthorinverted, and \btxflushauthorinvertedshort, if you need a different conversion.If you also want to use other cite-specific name-rendering parameters, like etallimit, etaldisplay, and etaloption, then the \currentbtxciteauthorbyfield (which does not accept an argument and will only render the author field or any field in the author set) will do this. To handle citation alternative-dependent formatting, you can use the \currentbtxcitealternative as follows:```\doifelse {\currentbtxcitealternative} {entry} {    % Normal short conversion for entry citations    \btxflushauthornormalshort{author}} {    % Normal conversion for list citations    \btxflushauthornormal{author}}```Joey
___
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
___


Re: [NTG-context] Different author rendering in entry citation vs. list

2021-08-27 Thread Joey McCollum via ntg-context
Happy I could help! The \btxflushauthornormal command should handle the
authorconversion switch that you want. Just remember that if you need to
use different et al. settings in citations as well, you should use
\currentbtxciteauthorbyfield!

Joey

On Fri, Aug 27, 2021, 7:22 AM Ágoston Volcz via ntg-context <
ntg-context@ntg.nl> wrote:

> After I have seen your code snippet, the command \btxflushauthornormal
> grabbed my attention. This command and its variations are indeed what
> I was looking for. As I think the documentation doesn't mention these
> advanced commands, I didn't even know they exist.
> Thanks for sharing your discovery!
>
> Agoston
>
> Am Fr., 27. Aug. 2021 um 05:09 Uhr schrieb Joey McCollum via
> ntg-context :
> >
> > Nevermind, it looks like there's an even more deliberate and succinct
> way to handle this! In publ-ini.mkiv, the \currentbtxciteauthorbyfield
> command shows how to print the author field mapped according to the cite
> style:
> >
> > ```
> > \unexpanded\def\currentbtxciteauthorbyfield
> >   {\begingroup
> >%\setbtxparameterset\s!cite\s!author
> >% the alternatives inherit from cite:author
> >% and APA distinguishes authoryears from authoryear ("and" vs. "&")
> >\setbtxparameterset\s!cite\currentbtxcitealternative
> >\clf_btxauthor
> > {\currentbtxdataset}%
> > {\currentbtxtag}%
> > {\currentbtxauthorfield}%
> > {%
> > combiner{\btxparameter\c!authorconversion}%
> > kind{cite}%
> > etallimit   {\btxparameter\c!etallimit}%
> > etaldisplay {\btxparameter\c!etaldisplay}%
> > etaloption  {\btxparameter\c!etaloption}%
> > symbol  {\btxparameter{\c!stopper:initials}}%
> > }%
> >   \relax
> >   \endgroup}
> > ```
> >
> > The snippet above might offer some guidance on how to handle this
> problem more generally, but for my specific use case, it suffices to invoke
> the \currentbtxciteauthorbyfield command:
> >
> > ```
> > \doifelse {\currentbtxcitealternative} {entry} {
> > % Normal order for in-text citations
> >  \currentbtxciteauthorbyfield
> > } {
> > % Inverted order for list citations
> > % TODO: need to print the first name inverted, with all subsequent
> names in normal order
> > \btxflush{author}
> > }
> > ```
> >
> > I get the feeling that there are more relevant commands in publ-ini.mkiv
> that are intended to help with this kind of thing, but I've just been
> unaware of most of them. The existing bibliography documentation only
> covers the tip of the iceberg!
> >
> > Anyway, I realized that a couple months ago, Ágoston Volcz raised a
> similar issue in another thread. I think this approach should solve that
> problem, so when I get a chance, I can send an e-mail about that.
> >
> > Joey
> >
> > On Thu, Aug 26, 2021 at 3:38 PM Joey McCollum <
> jmccollum20140...@gmail.com> wrote:
> >>
> >> Okay, I've made some progress! Thankfully, the authorconversion rules
> can be overridden using some of the methods defined in publ-ini.mkiv. I now
> have something like this in my rendering's .mkvi file:
> >>
> >> ```
> >> \doifelse {\currentbtxcitealternative} {entry} {
> >> % Normal order for in-text citations
> >> \btxflushauthornormal{author}
> >> } {
> >> % Inverted order for list citations
> >> % TODO: need to print the first name inverted, with all subsequent
> names in normal order
> >> \btxflushauthorinverted{author}
> >> }
> >> ```
> >>
> >> This fixes the citation alternative-dependent authorconversion, but I
> still have to do the same for the etallimit and etaldisplay settings, and
> unfortunately, it doesn't look like there are similar commands for
> overriding this locally.
> >>
> >> Digging a bit more in publ-imp-chicago.lua and publ-imp-chicago.mkvi, I
> notice that it deals with a similar problem for the "editor" field: if the
> editor occurs in the "author" position (i.e., at the start of the citation,
> which happens when a book has an editor but no author), then the
> authorconversion should be inverted, but if the editor occurs after the
> author position (which happens when a book also has an author), then its
> authorconversion should be normalshort. The publ-imp-chicago.lua file
> addresses this by specifying an "ineditor" set containing only the "editor"
> field (essent

Re: [NTG-context] Different author rendering in entry citation vs. list

2021-08-26 Thread Joey McCollum via ntg-context
Nevermind, it looks like there's an even more deliberate and succinct way
to handle this! In publ-ini.mkiv, the \currentbtxciteauthorbyfield command
shows how to print the author field mapped according to the cite style:

```
\unexpanded\def\currentbtxciteauthorbyfield
  {\begingroup
   %\setbtxparameterset\s!cite\s!author
   % the alternatives inherit from cite:author
   % and APA distinguishes authoryears from authoryear ("and" vs. "&")
   \setbtxparameterset\s!cite\currentbtxcitealternative
   \clf_btxauthor
{\currentbtxdataset}%
{\currentbtxtag}%
{\currentbtxauthorfield}%
{%
combiner{\btxparameter\c!authorconversion}%
kind{cite}%
etallimit   {\btxparameter\c!etallimit}%
etaldisplay {\btxparameter\c!etaldisplay}%
etaloption  {\btxparameter\c!etaloption}%
symbol  {\btxparameter{\c!stopper:initials}}%
}%
  \relax
  \endgroup}
```

The snippet above might offer some guidance on how to handle this problem
more generally, but for my specific use case, it suffices to invoke the
\currentbtxciteauthorbyfield command:

```
\doifelse {\currentbtxcitealternative} {entry} {
% Normal order for in-text citations
 \currentbtxciteauthorbyfield
} {
% Inverted order for list citations
% TODO: need to print the first name inverted, with all subsequent
names in normal order
\btxflush{author}
}
```

I get the feeling that there are more relevant commands in publ-ini.mkiv
that are intended to help with this kind of thing, but I've just been
unaware of most of them. The existing bibliography documentation only
covers the tip of the iceberg!

Anyway, I realized that a couple months ago, Ágoston Volcz raised a similar
issue in another thread. I think this approach should solve that problem,
so when I get a chance, I can send an e-mail about that.

Joey

On Thu, Aug 26, 2021 at 3:38 PM Joey McCollum 
wrote:

> Okay, I've made some progress! Thankfully, the authorconversion rules can
> be overridden using some of the methods defined in publ-ini.mkiv. I now
> have something like this in my rendering's .mkvi file:
>
> ```
> \doifelse {\currentbtxcitealternative} {entry} {
> % Normal order for in-text citations
> \btxflushauthornormal{author}
> } {
> % Inverted order for list citations
> % TODO: need to print the first name inverted, with all subsequent
> names in normal order
> \btxflushauthorinverted{author}
> }
> ```
>
> This fixes the citation alternative-dependent authorconversion, but I
> still have to do the same for the etallimit and etaldisplay settings, and
> unfortunately, it doesn't look like there are similar commands for
> overriding this locally.
>
> Digging a bit more in publ-imp-chicago.lua and publ-imp-chicago.mkvi, I
> notice that it deals with a similar problem for the "editor" field: if the
> editor occurs in the "author" position (i.e., at the start of the citation,
> which happens when a book has an editor but no author), then the
> authorconversion should be inverted, but if the editor occurs after the
> author position (which happens when a book also has an author), then its
> authorconversion should be normalshort. The publ-imp-chicago.lua file
> addresses this by specifying an "ineditor" set containing only the "editor"
> field (essentially making it an alias to be used later), and then
> publ-imp-chicago.mkvi defines a style specifically for this field. I could
> solve the authorconversion, etallimit, and etaldisplay problems using an
> "entryauthor" field, but is this actually the recommended way to do this?
> Using this approach, I would have to have duplicate sets for nearly all
> "author"-type fields to ensure that they have different formatting in entry
> citations than they do in the list.
>
> Joey
>
> On Wed, Aug 25, 2021 at 5:45 PM Joey McCollum 
> wrote:
>
>> Hi,
>>
>> I'm trying to implement a custom bibliography rendering where in-text
>> citations (specifically, citations with alternative=entry) are not
>> identical to the entries in the bibliography list. Following a pattern I've
>> seen in publ-imp-chicago.mkvi, I've been able to implement most of the
>> features I'm interested in by using conditional formatting with a mode that
>> is specifically set for citations with the "entry" alternative. I'd also
>> like for author names in entry citations to be different author names in
>> list entries, in the following ways:
>>
>>- In entry citations, authorconversion should be normal, while in
>>list entries, authorconversion should be inverted (more specifically, the
>>first name should be inverted, while all subsequent names should be in
>>normal order...but if this is too complicated, then it may be an issue for
>>another e-mail thread, and we can just focus on normal vs. inverted for
>>now).
>>- In entry citations, "et al." should be used for any names after the
>>third name, while in list 

Re: [NTG-context] Different author rendering in entry citation vs. list

2021-08-26 Thread Joey McCollum via ntg-context
Okay, I've made some progress! Thankfully, the authorconversion rules can
be overridden using some of the methods defined in publ-ini.mkiv. I now
have something like this in my rendering's .mkvi file:

```
\doifelse {\currentbtxcitealternative} {entry} {
% Normal order for in-text citations
\btxflushauthornormal{author}
} {
% Inverted order for list citations
% TODO: need to print the first name inverted, with all subsequent
names in normal order
\btxflushauthorinverted{author}
}
```

This fixes the citation alternative-dependent authorconversion, but I still
have to do the same for the etallimit and etaldisplay settings, and
unfortunately, it doesn't look like there are similar commands for
overriding this locally.

Digging a bit more in publ-imp-chicago.lua and publ-imp-chicago.mkvi, I
notice that it deals with a similar problem for the "editor" field: if the
editor occurs in the "author" position (i.e., at the start of the citation,
which happens when a book has an editor but no author), then the
authorconversion should be inverted, but if the editor occurs after the
author position (which happens when a book also has an author), then its
authorconversion should be normalshort. The publ-imp-chicago.lua file
addresses this by specifying an "ineditor" set containing only the "editor"
field (essentially making it an alias to be used later), and then
publ-imp-chicago.mkvi defines a style specifically for this field. I could
solve the authorconversion, etallimit, and etaldisplay problems using an
"entryauthor" field, but is this actually the recommended way to do this?
Using this approach, I would have to have duplicate sets for nearly all
"author"-type fields to ensure that they have different formatting in entry
citations than they do in the list.

Joey

On Wed, Aug 25, 2021 at 5:45 PM Joey McCollum 
wrote:

> Hi,
>
> I'm trying to implement a custom bibliography rendering where in-text
> citations (specifically, citations with alternative=entry) are not
> identical to the entries in the bibliography list. Following a pattern I've
> seen in publ-imp-chicago.mkvi, I've been able to implement most of the
> features I'm interested in by using conditional formatting with a mode that
> is specifically set for citations with the "entry" alternative. I'd also
> like for author names in entry citations to be different author names in
> list entries, in the following ways:
>
>- In entry citations, authorconversion should be normal, while in list
>entries, authorconversion should be inverted (more specifically, the first
>name should be inverted, while all subsequent names should be in normal
>order...but if this is too complicated, then it may be an issue for another
>e-mail thread, and we can just focus on normal vs. inverted for now).
>- In entry citations, "et al." should be used for any names after the
>third name, while in list entries, all names should be printed in full.
>
> I thought that the following settings would work:
>
> \definebtx
>   [sbl:\s!list]
>   [sbl]
>   [\c!otherstext=,
>   \c!etallimit=,
>   \c!etaldisplay=,
>   \c!etaloption=,
>   \c!authorconversion=inverted] % TODO: need to print the first name
> inverted, with all subsequent names in normal order
>
> \definebtx
>   [sbl:\s!cite]
>   [sbl]
>   [\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=3, %
>\c!authorconversion=\v!normal] % by default, use normal name order for
> in-text citations
>
> But only the "list" settings seem to be used. I suspect this might be
> because the setup for "entry" citations invokes \btxhandleciteentry and
> therefore uses "list" settings everywhere except where I check modes for
> conditional formatting. But is there a command or environment I can use to
> change authorconversion locally, based on the current mode, in the helper
> methods I've defined for rendering bibliography entries?
>
> Thanks!
>
> Joey
>
___
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] Different author rendering in entry citation vs. list

2021-08-25 Thread Joey McCollum via ntg-context
Hi,

I'm trying to implement a custom bibliography rendering where in-text
citations (specifically, citations with alternative=entry) are not
identical to the entries in the bibliography list. Following a pattern I've
seen in publ-imp-chicago.mkvi, I've been able to implement most of the
features I'm interested in by using conditional formatting with a mode that
is specifically set for citations with the "entry" alternative. I'd also
like for author names in entry citations to be different author names in
list entries, in the following ways:

   - In entry citations, authorconversion should be normal, while in list
   entries, authorconversion should be inverted (more specifically, the first
   name should be inverted, while all subsequent names should be in normal
   order...but if this is too complicated, then it may be an issue for another
   e-mail thread, and we can just focus on normal vs. inverted for now).
   - In entry citations, "et al." should be used for any names after the
   third name, while in list entries, all names should be printed in full.

I thought that the following settings would work:

\definebtx
  [sbl:\s!list]
  [sbl]
  [\c!otherstext=,
  \c!etallimit=,
  \c!etaldisplay=,
  \c!etaloption=,
  \c!authorconversion=inverted] % TODO: need to print the first name
inverted, with all subsequent names in normal order

\definebtx
  [sbl:\s!cite]
  [sbl]
  [\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=3, %
   \c!authorconversion=\v!normal] % by default, use normal name order for
in-text citations

But only the "list" settings seem to be used. I suspect this might be
because the setup for "entry" citations invokes \btxhandleciteentry and
therefore uses "list" settings everywhere except where I check modes for
conditional formatting. But is there a command or environment I can use to
change authorconversion locally, based on the current mode, in the helper
methods I've defined for rendering bibliography entries?

Thanks!

Joey
___
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
___


Re: [NTG-context] Short forms and abbreviations in bibliography

2021-08-22 Thread Joey McCollum via ntg-context
Just continuing to talk my way through the inner workings of the ConTeXt
Publication modules. It looks like three "long" citation forms are defined
in publ-imp-cite.mkvi:

\startsetups btx:cite:listelement
\fastsetup{\s!btx:\s!cite:concat}
\fastsetup{\s!btx:\s!cite:lefttext}
\ifx\currentbtxfirst\empty
\fastsetup{\s!btx:\s!cite:\s!empty}
\else
   \texdefinition {\s!btx:\s!cite:inject} {
   \btxcitereference
   \currentbtxfirst
   }
\fi
\fastsetup{\s!btx:\s!cite:righttext}
\stopsetups

\startsetups \s!btx:\s!cite:entry
\fastsetup{\s!btx:\s!cite:concat}
\fastsetup{\s!btx:\s!cite:lefttext}
\btxhandleciteentry
\fastsetup{\s!btx:\s!cite:righttext}
\stopsetups

\startsetups \s!btx:\s!cite:footnote
\startfootnote
\fastsetup{btx:cite:entry}
\stopfootnote
\stopsetups

Intuitively, I would expect btx:cite:listelement [why not
\s!btx:\s!cite:listelement?] to handle rendering a bibliographic entry for
the bibliography proper (i.e., the list typically placed at the end of a
document), while \s!btx:\s!cite:entry would handle in-text citations. The
third setup, \s!btx:\s!cite:footnote, simply renders the "entry"-style
citation in a footnote.

But as far as I can tell, the "listelement" setup is never used outside of
publ-imp-cite.mkvi. Only the "entry" setup appears to be used. Meanwhile,
the \btxcitereference and  \btxhandleciteentry macros (invoked in these
setups) appear to be defined in publ-ini.mkiv:

\unexpanded\def\btx_cite_reference_inject
  {\ifconditional\c_btx_cite_reference_injected
   \else
 \dontleavehmode
 \iftrialtypesetting \else
   \ifx\currentbtxbacklink\empty
 % can be made empty when combining author / year
   \else\ifnum\currentbtxbacklink>\zerocount
 \btx_cite_reference_inject_indeed
 \settrue\c_btx_cite_reference_injected
   \fi\fi
 \fi
  \fi}

...

\let\btxcitereference\btx_cite_reference_inject

...

\unexpanded\def\btxhandleciteentry
  {\dontleavehmode
   \begingroup
   \def\currentbtxcitealternative{entry}%
   \setbtxparameterset\s!cite\currentbtxcitealternative % needs checking
   \btxcitereference
   \btx_entry_inject
   \endgroup}

My next step will be to figure out what these are doing, but I'm still not
sure if the module accommodates rendering in-text "entry" citations
differently than citations in the list.

Joey

On Mon, Aug 9, 2021 at 8:55 AM Joey McCollum 
wrote:

> Henning's suggestion for abbreviations should work fine for that issue. I
> could simply use the shorthand in the "series" and "journal" fields and set
> up the appropriate \abbreviation calls in the document or environment.
>
> As for the larger issue of bibliographies, I've started working on
> publ-imp-sbl.lua and publ-imp-sbl.mkvi files. I knew I would need this for
> my own project soon, and I felt it would be useful to myself and the
> ConTeXt community if I could at least get a rudimentary version working.
> I'm presently using the reference for examples from the *SBL Handbook of
> Style*, 2nd edition, available at
> https://github.com/dcpurton/biblatex-sbl/blob/master/test/biblatex-sbl-examples.ref.txt
> .
>
> Like you say, some parts are tricky. SBL uses "entry"-style citations by
> default and doesn't seem to make use of other common alternatives (such as
> "authoryear"). I can think of some existing alternatives that might get
> used in specific cases (e.g., "author", "title"), but the
> recommended shorthand has the form "shortauthor, shorttitle" (i.e., the
> last name(s) of the author(s) only, followed by a comma and a shortened
> form of the title as specified in the "shorttitle" field). I could make
> this the sbl style's implementation of the "short" alternative, since the
> LaTeX-style bracketed number references are foreign to SBL style anyway,
> but if would be preferable just to introduce another alternative (something
> like "authortitle"), then I could also try to do that.
>
> For my immediate purposes, I won't need much more than the @book,
> @article, @inbook, and @incollection entries, so my focus will be on
> getting those right, but if anyone is interested in helping, I'll gladly
> take help. (But it would probably be better to discuss the details in a
> separate e-mail thread.)
>
> Joey
>
> On Mon, Aug 9, 2021 at 4:12 AM Denis Maier via ntg-context <
> ntg-context@ntg.nl> wrote:
>
>>
>>
>> > -Ursprüngliche Nachricht-
>> > Von: ntg-context  Im Auftrag von Henning
>> > Hraban Ramm via ntg-context
>> > Gesendet: Samstag, 7. August 2021 22:40
>> > An: mailing list for ConTeXt users 
>> > Cc: Henning Hraban Ramm 
>> > 

Re: [NTG-context] Unicode normalization and Hebrew in ConTeXt

2021-08-17 Thread Joey McCollum via ntg-context
Thankfully, it looks like this was just a problem with my implementation of
the OpenType feature and not with ConTeXt's handling of it! (I worried that
it might be ConTeXt when I saw that XeLaTeX was handing the feature
correctly.) Hans graciously helped me identify the problem, and everything
looks good now!

Joey

On Tue, Aug 17, 2021 at 8:56 AM Joey McCollum 
wrote:

> Shouldn't dlig automatically be enabled under the "hebrew" feature set? In
> font-pre.mkiv, hebrew inherits from semitic-complete, which sets dlig=yes.
>
> Still, if I explicitly add dlig, as in the following example, things
> change, but they still aren't right:
>
> ```
>
> \starttypescriptcollection[keteryg]
>
> \starttypescript[serif][keteryg]
>
> \definefontsynonym[Serif][file:../fonts/KeterYG/KeterYG-Medium.ttf][features=hebrew]
> % all the necessary Hebrew features, including dlig
>
> \stoptypescript
>
>
> \starttypescript[keteryg]
>
> \definetypeface[keteryg][rm][serif][keteryg][default]
>
> \stoptypescript
>
> \stoptypescriptcollection
>
>
> %Set up the main font:
>
> \setupbodyfont[keteryg]
>
> %Set up right-to-left alignment:
>
> \setupalign[r2l]
>
> %Explicitly add dlig (in case it wasn't there already):
>
> \definefontfeature[plus-dlig][dlig=yes]
>
>
> \starttext
>
> \addff{plus-dlig}
>
> שֹׂבַע
>
> עָשׂוֹר
>
> קֹשֶׁט
>
> שֹׁשַׁנִּים
>
> עָשׂוֹר
>
> מֹשֶׁה
>
> שַׁלֹשׁ
>
> \stoptext ``` In examples 1, 3, 4, and 6, the *holam *of the preceding
> letter (which should have been stripped in the contextual substitution)
> just seems to have been moved farther up. In fact, the output looks like it
> would look if I turned off the reordercombining feature. (And indeed, if I
> manually reorder the glyphs to the Hebrew Layout Intelligence order, then
> the results look like they did when I just used the "hebrew" feature.)
>
>
> I may have forgotten to attach the font file I was using for this test. If
> that is the case, it is available at
> https://github.com/jjmccollum/Keter-YG.
>
>
> Joey
>
> On Tue, Aug 17, 2021 at 5:19 AM Hans Hagen  wrote:
>
>> On 8/17/2021 2:07 AM, Joey McCollum wrote:
>>
>> > Sorry to bring this up after over a year, but I just noticed something
>> > that doesn't seem right. I implemented some contextual substitutions in
>> > my own fork of the Keter YG Hebrew font (.ttf file attached) under the
>> > "dlig" feature that should do the following two things:
>> but you don't enable dlig
>>
>> -
>>Hans Hagen | PRAGMA ADE
>>Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>> tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
>> -
>>
>
___
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
___


Re: [NTG-context] Unicode normalization and Hebrew in ConTeXt

2021-08-17 Thread Joey McCollum via ntg-context
Shouldn't dlig automatically be enabled under the "hebrew" feature set? In
font-pre.mkiv, hebrew inherits from semitic-complete, which sets dlig=yes.

Still, if I explicitly add dlig, as in the following example, things
change, but they still aren't right:

```

\starttypescriptcollection[keteryg]

\starttypescript[serif][keteryg]

\definefontsynonym[Serif][file:../fonts/KeterYG/KeterYG-Medium.ttf][features=hebrew]
% all the necessary Hebrew features, including dlig

\stoptypescript


\starttypescript[keteryg]

\definetypeface[keteryg][rm][serif][keteryg][default]

\stoptypescript

\stoptypescriptcollection


%Set up the main font:

\setupbodyfont[keteryg]

%Set up right-to-left alignment:

\setupalign[r2l]

%Explicitly add dlig (in case it wasn't there already):

\definefontfeature[plus-dlig][dlig=yes]


\starttext

\addff{plus-dlig}

שֹׂבַע

עָשׂוֹר

קֹשֶׁט

שֹׁשַׁנִּים

עָשׂוֹר

מֹשֶׁה

שַׁלֹשׁ

\stoptext ``` In examples 1, 3, 4, and 6, the *holam *of the preceding
letter (which should have been stripped in the contextual substitution)
just seems to have been moved farther up. In fact, the output looks like it
would look if I turned off the reordercombining feature. (And indeed, if I
manually reorder the glyphs to the Hebrew Layout Intelligence order, then
the results look like they did when I just used the "hebrew" feature.)


I may have forgotten to attach the font file I was using for this test. If
that is the case, it is available at https://github.com/jjmccollum/Keter-YG.


Joey

On Tue, Aug 17, 2021 at 5:19 AM Hans Hagen  wrote:

> On 8/17/2021 2:07 AM, Joey McCollum wrote:
>
> > Sorry to bring this up after over a year, but I just noticed something
> > that doesn't seem right. I implemented some contextual substitutions in
> > my own fork of the Keter YG Hebrew font (.ttf file attached) under the
> > "dlig" feature that should do the following two things:
> but you don't enable dlig
>
> -
>Hans Hagen | PRAGMA ADE
>Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -
>
___
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
___


Re: [NTG-context] Unicode normalization and Hebrew in ConTeXt

2021-08-16 Thread Joey McCollum via ntg-context
Hans,

Sorry to bring this up after over a year, but I just noticed something that
doesn't seem right. I implemented some contextual substitutions in my own
fork of the Keter YG Hebrew font (.ttf file attached) under the "dlig"
feature that should do the following two things:

   1. If a *shin *with a *sin *dot (שׂ) is pointed with a *holam *(the
   vowel point placed high and on the left), then the *shin*, *sin *dot,
   and *holam *are combined into a single ligature that depicts the *sin *dot
   and *holam *merged into a single point.
   2. If a *shin *with a *shin *dot (שׁ) follows another letter pointed
   with a *holam *(except for *vav*, which must be pointed with a *holam
   haser*), then the shin and shin dot are replaced with a ligature that
   moves the *shin* dot a bit to the right (so that it appears to be merged
   with the preceding *holam*), and the combination of the preceding letter
   and the actual holam is changed to just the preceding letter (thus
   effectively stripping the old *holam*).

I've tested both of these features in FontForge, and they work as expected
there. Likewise, if I test them in the following XeLaTeX script, XeLaTeX
handles both rules correctly:

```
\documentclass{article}
%Set fonts and font features:
\usepackage{fontspec}
\setmainfont[Path=../fonts/KeterYG/, UprightFont = *-Medium, Script=Hebrew,
Ligatures=Discretionary]{KeterYG} % I'm using a local copy of the attached
font
\begin{document}
שֹׂבַע

עָשׂוֹר

קֹשֶׁט

שֹׁשַׁנִּים

עָשׂוֹר

מֹשֶׁה

שַׁלֹשׁ
\end{document}
```

But in ConTeXt, only rule (1) above works as expected. Here is a minimal
(non-)working example:

```

\starttypescriptcollection[keteryg]

\starttypescript[serif][keteryg]

\definefontsynonym[Serif][file:../fonts/KeterYG/KeterYG-Medium.ttf][features=hebrew]
% use a local copy of the attached font, with all the necessary Hebrew
features (this includes dlig by default)

\stoptypescript


\starttypescript[keteryg]

\definetypeface[keteryg][rm][serif][keteryg][default]

\stoptypescript

\stoptypescriptcollection


%Set up the main font:

\setupbodyfont[keteryg]

%Set up right-to-left alignment:

\setupalign[r2l]

\starttext

שֹׂבַע

עָשׂוֹר

קֹשֶׁט

שֹׁשַׁנִּים

עָשׂוֹר

מֹשֶׁה

שַׁלֹשׁ

\stoptext
```

In examples 3, 4, 6, and 7, the *holam *dot still appears before the *shin*
-with-merged-*shin*-dot-and-*holam *ligature, when it should be absent. (I
realize that it may be difficult to tell; in the last two examples, the
presence of two dots is easier to make out.)

Do you have any idea why this might be happening in ConTeXt? Does the glyph
reordering in font-imp-combining.lua take place before any OpenType
features in the font are applied?

Thanks again!

Joey

On Thu, Apr 30, 2020 at 4:17 PM Joey McCollum 
wrote:

> Okay! I have not figured out how to add a new page to the wiki, but I was
> able to add a section to the end of the "Arabic and Hebrew" page (
> https://www.contextgarden.net/Arabic_and_Hebrew) discussing the issue,
> providing a test, and briefly describing the fix.
>
> Joey
>
> On Thu, Apr 30, 2020 at 11:14 AM Hans Hagen  wrote:
>
>> On 4/30/2020 4:28 PM, Joey McCollum wrote:
>> > Thanks so much, Hans! I should be able to add a wiki page summarizing
>> > the tests before the end of the week.
>> >
>> > For reference purposes, do you know which version of ConTeXt has (or
>> > will have) this update included?
>> todays upload
>>
>>
>> -
>>Hans Hagen | PRAGMA ADE
>>Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>> tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
>> -
>>
>
___
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
___


Re: [NTG-context] Progressively encouraging page/column breaks at \blank with penalties

2021-08-15 Thread Joey McCollum via ntg-context
That works for my purposes; thank you for letting me know about it!

Joey

On Sun, Aug 15, 2021 at 1:53 AM Aditya Mahajan via ntg-context <
ntg-context@ntg.nl> wrote:

> On Sun, 15 Aug 2021, Joey McCollum via ntg-context wrote:
>
> > Hi,
> >
> > I'm trying to implement a section break marker in a grid layout. At a
> > section break, two lines of space should separate the subsequent segments
> > of text (just plain paragraphs, in this case), and a symbol (in the
> example
> > below, "X") should be set in the middle of these two lines. For my
> > purposes, the section break symbol should never occur at the top of a
> page
> > or column, and it is more desirable to have a page or column end with the
> > section break symbol than to have a single orphaned line follow the
> symbol
> > at the end of the page or column. Based on these constraints, I thought
> > that using the "samepage" and "preference" options for the first and
> second
> > line breaks would work nicely:
> >
> > ```
> > \define\SectionBreak{%
> > \blank[halfline, samepage]% non-breaking to ensure that no column
> > begins with the section break symbol
> > \startalignment[middle]%
> > {X}% section break symbol
> > \stopalignment%
> > \blank[halfline, preference]% this can (and, if possible, should) be
> > broken across a column
> > ```
> >
> > This does successfully prevent the placement of the symbol at the top of
> a
> > page/column, but it doesn't encourage the placement of the symbol at the
> > end of a page/column as often as I would like.
>
> Depending on what you want, you can try adding \testpage[n] (where n is a
> number). This checks if the remainder of the page has enough space for n
> lines; if not, then it issues a page-break.
>
> Aditya
>
> ___
> 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
>
> ___
>
___
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] Progressively encouraging page/column breaks at \blank with penalties

2021-08-14 Thread Joey McCollum via ntg-context
Hi,

I'm trying to implement a section break marker in a grid layout. At a
section break, two lines of space should separate the subsequent segments
of text (just plain paragraphs, in this case), and a symbol (in the example
below, "X") should be set in the middle of these two lines. For my
purposes, the section break symbol should never occur at the top of a page
or column, and it is more desirable to have a page or column end with the
section break symbol than to have a single orphaned line follow the symbol
at the end of the page or column. Based on these constraints, I thought
that using the "samepage" and "preference" options for the first and second
line breaks would work nicely:

```
\define\SectionBreak{%
\blank[halfline, samepage]% non-breaking to ensure that no column
begins with the section break symbol
\startalignment[middle]%
{X}% section break symbol
\stopalignment%
\blank[halfline, preference]% this can (and, if possible, should) be
broken across a column
```

This does successfully prevent the placement of the symbol at the top of a
page/column, but it doesn't encourage the placement of the symbol at the
end of a page/column as often as I would like. I tried replacing the
"preference" option with options with better negative penalties, like
"penalty:-1000", "penalty:-2000", and even "penalty:-5000", but these
didn't make any difference. The option "penalty:-1" trivially works,
but it forces a page/column break at every section break marker, which is
far too extreme.

Is this normal behavior? I would have thought that progressively more
negative penalties would gradually encourage page/column breaks, but this
doesn't seem to happen. In the following MWE, the "preference" and
"penalty" options (apart from "penalty:-1") for the second line break
don't change the total page count or appearance of the final page at all
(which would be expected in a document of this size):

```

\setuplayout[

grid=yes %enable baseline grid

]


\setupinterlinespace[18bp] % text line spacing


%Define macro for section break:

\define\SectionBreak{%

\blank[halfline, samepage]%non-breaking to ensure that no column begins
with the section break symbol

\startalignment[middle]%

{X}% section break symbol

\stopalignment%

\blank[halfline]% a column break here is neither encouraged nor discouraged

% \blank[halfline, preference]% this should encourage a column break here,
but it doesn't seem to make a difference

% \blank[halfline, penalty:-1000]% still no difference

% \blank[halfline, penalty:-2000]% still no difference

% \blank[halfline, penalty:-5000]% still no difference

% \blank[halfline, penalty:-1]% this works, but it is too extreme!

}


%Set things up for fakewords:

\usemodule[visual]

\setupsystem[random=10]


\starttext

\dorecurse{400}{\fakewords{20}{100}\SectionBreak}

\stoptext
```

As always, any help is appreciated!

Joey
___
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] Conditional formatting with *frontpart, *bodypart, *backpart modes

2021-08-12 Thread Joey McCollum via ntg-context
Hi,

I was curious about the possibility of handling general formatting settings
(e.g., page layout, headers and footers, page numbering, alignment, default
body font assignment, etc.) conditionally for front, body, and back matter
using modes. According to the wiki page at
https://wiki.contextgarden.net/Modes, this should be doable with blocks
like \startmode[*frontpart] ... \stopmode, but even in the following
minimal example, the conditional formatting isn't getting applied:

```

\startmode[*frontpart]

\setupbodyfont[modern, 12pt]

\stopmode

\startmode[*bodypart]

\setupbodyfont[pagella, 12pt]

\stopmode

\startmode[*backpart]

\setupbodyfont[termes, 12pt]

\stopmode


\starttext

\startfrontmatter

\input knuth\par

\stopfrontmatter

\startbodymatter

\input knuth\par

\stopbodymatter

\startbackmatter

\input knuth\par

\stopbackmatter

\stoptext
```

Is there something obvious that I'm missing? Or is there a different
recommended approach to conditional formatting by front/body/back matter
division?

Thank you!

Joey
___
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
___


Re: [NTG-context] Different in-text and list citation renderings

2021-08-10 Thread Joey McCollum via ntg-context
It may also be relevant to mention a related feature of SBL style:
(3) The "et al." string is used for more than three authors for in-text
citations, but all authors are listed in full in the list of publications.

In publ-imp-chicago.mkvi (probably the most similar style to SBL), the
etallimit and etaldisplay parameters are set to the default values:

\definebtx
  [chicago:\s!list]
  [chicago]
 %[\c!otherstext={\btxcomma\btxnobreakspace\textellipsis\space},
 % \c!etallimit=7,
 % \c!etaldisplay=6,
 % \c!etaloption=last,
  [\c!authorconversion=inverted]

But the definition for in-text citations sets both of these parameters to 1:

\definebtx
  [chicago:\s!cite]
  [chicago]
  [\c!alternative=authoryear,
   \c!otherstext={\btxcomma\btxlabeltext{others}},
   \c!etallimit=1,
   \c!etaldisplay=1,
   \c!authorconversion=\v!name,
   \c!sorttype=normal, % \v!normal ?
   \c!style=,
   \c!compress=\v!yes] % note that cite sorts only work with compress=yes.

Now, if I cite a source in-text using the "author" alternative, this rule
is applied, but if I cite a source in-text using the "entry" alternative,
the printed citation follows the rules for [chicago:\s!list], even though
the citation style for the "entry" alternative is explicitly defined to
inherit from [chicago:\s!cite]:

\definebtx
  [chicago:\s!cite:entry]
  [chicago:\s!cite]
  [\c!left=,
   \c!right=,
   \c!inbetween={\btxspace},
   \c!separator:2={\btxsemicolon},
   \c!separator:3=\btxparameter{\c!separator:2},
   \c!separator:4=\btxparameter{\c!separator:2}]

Is the "entry" alternative just hardcoded to match the list citation, or am
I missing something?

Joey

On Tue, Aug 10, 2021 at 2:12 PM Joey McCollum 
wrote:

> Hi,
>
> I'm currently working on implementing a new citation rendering for SBL
> style. One of the challenges of this style is that it specifies slightly
> different rules for citations in the text (which are generally expected to
> look like citations made with the "entry" alternative) and entries in the
> final list of publications. The two most common differences are
> (1) Authors in the in-text citation are printed in normal form (i.e.,
> first name followed by last name), while authors in the list citation are
> printed in inverted for for the first author and normal form for all
> subsequent authors.
> (2) Most fields in the in-text citation are separated by commas, while the
> list citation uses periods in these places.
>
> Is there already a mechanism for handling this for another citation style?
> And if not, could anyone offer a suggestion on how I might go about
> implementing separate rules for in-text citations and list citations?
>
> Thanks!
>
> Joey
>
___
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] Different in-text and list citation renderings

2021-08-10 Thread Joey McCollum via ntg-context
Hi,

I'm currently working on implementing a new citation rendering for SBL
style. One of the challenges of this style is that it specifies slightly
different rules for citations in the text (which are generally expected to
look like citations made with the "entry" alternative) and entries in the
final list of publications. The two most common differences are
(1) Authors in the in-text citation are printed in normal form (i.e., first
name followed by last name), while authors in the list citation are printed
in inverted for for the first author and normal form for all subsequent
authors.
(2) Most fields in the in-text citation are separated by commas, while the
list citation uses periods in these places.

Is there already a mechanism for handling this for another citation style?
And if not, could anyone offer a suggestion on how I might go about
implementing separate rules for in-text citations and list citations?

Thanks!

Joey
___
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
___


Re: [NTG-context] Short forms and abbreviations in bibliography

2021-08-09 Thread Joey McCollum via ntg-context
Henning's suggestion for abbreviations should work fine for that issue. I
could simply use the shorthand in the "series" and "journal" fields and set
up the appropriate \abbreviation calls in the document or environment.

As for the larger issue of bibliographies, I've started working on
publ-imp-sbl.lua and publ-imp-sbl.mkvi files. I knew I would need this for
my own project soon, and I felt it would be useful to myself and the
ConTeXt community if I could at least get a rudimentary version working.
I'm presently using the reference for examples from the *SBL Handbook of
Style*, 2nd edition, available at
https://github.com/dcpurton/biblatex-sbl/blob/master/test/biblatex-sbl-examples.ref.txt
.

Like you say, some parts are tricky. SBL uses "entry"-style citations by
default and doesn't seem to make use of other common alternatives (such as
"authoryear"). I can think of some existing alternatives that might get
used in specific cases (e.g., "author", "title"), but the
recommended shorthand has the form "shortauthor, shorttitle" (i.e., the
last name(s) of the author(s) only, followed by a comma and a shortened
form of the title as specified in the "shorttitle" field). I could make
this the sbl style's implementation of the "short" alternative, since the
LaTeX-style bracketed number references are foreign to SBL style anyway,
but if would be preferable just to introduce another alternative (something
like "authortitle"), then I could also try to do that.

For my immediate purposes, I won't need much more than the @book, @article,
@inbook, and @incollection entries, so my focus will be on getting those
right, but if anyone is interested in helping, I'll gladly take help. (But
it would probably be better to discuss the details in a separate e-mail
thread.)

Joey

On Mon, Aug 9, 2021 at 4:12 AM Denis Maier via ntg-context <
ntg-context@ntg.nl> wrote:

>
>
> > -Ursprüngliche Nachricht-
> > Von: ntg-context  Im Auftrag von Henning
> > Hraban Ramm via ntg-context
> > Gesendet: Samstag, 7. August 2021 22:40
> > An: mailing list for ConTeXt users 
> > Cc: Henning Hraban Ramm 
> > Betreff: Re: [NTG-context] Short forms and abbreviations in bibliography
> >
> >
> >
> > > Am 07.08.2021 um 21:53 schrieb Joey McCollum via ntg-context  > cont...@ntg.nl>:
> > >
> > > A separate list of abbreviations would then list "LSAWS" alongside
> "Linguistic
> > Studies in Ancient West Semitic" (and likewise for other journal/series
> > abbreviations).
> >
> > Regarding abbreviations have a look at
> > https://wiki.contextgarden.net/Command/definesynonyms
> >
> > It should be as easy as
> >
> > \abbreviation{LSAWS}{Linguistic Studies in Ancient West Semitic}
> >
> > The full name of \quote{LSAWS} is \infull{LSAWS}.
> >
> > \placelistofabbreviations
> >
> >
> > I had a case where mostly abbreviations were used in the text but the
> full name
> > should appear in the index.
> > I can provide the setup (including Lua functions), if it might help you.
> >
> >
> > Can’t help with bibliographies, sorry.
>
> SBL is a tricky beast anyway. There were some discussions regarding
> implementing Chicago Manual of Style a couple of weeks ago. Develelopments
> on that front could also be useful for SBL. Don't know what came out of
> this though.
>
> Denis
>
> >
> > Hraban
> > 
> > ___
> > 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
> > 
> > ___
>
> ___
> 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
>
> ___
>
___
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] Referencing fonts by path within ConTeXt

2021-08-07 Thread Joey McCollum via ntg-context
Hi,

I'm interested in packaging a ConTeXt project in a self-contained way, so
that the environment/component/project .tex files, the bibliography .bib
file(s), and fonts used for typesetting are all provided in one place. (The
goal is that others can generate the PDFs themselves from the source files
as long as they have a sufficiently recent version of ConTeXt installed.)
The usual ConTeXt directory structure makes sense for most of this, but it
doesn't address the possibility of accessing fonts locally. I think I could
do this with a script that temporarily sets the OSFONTDIR variable to the
local fonts directory and then invokes ConTeXt to typeset the project-level
file, but I was wondering if there is an easier way to do this from within
ConTeXt. Specifically, is there a way to specify a font via a local path
with font setup commands in an environment file?

Thank you!

Joey
___
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] Short forms and abbreviations in bibliography

2021-08-07 Thread Joey McCollum via ntg-context
Hi,

It is a common practice to use short forms of titles for bibliographic
entries after they are cited the first time. Another practice is to use
abbreviations for journal names and book series (generally for citations in
the text, but possibly also in the references list), with a separate "List
of Abbreviations" provided to cross-reference the abbreviations and full
names. I think that these practices could be accommodated with multiple
bibliographies that contain short and long forms for corresponding entries,
but I wanted to ask: is there a simpler or preferred way to do this in
ConTeXt?

To illustrate what I mean, the biblatex-sbl package (
https://github.com/dcpurton/biblatex-sbl), which implements the SBL
citation style for (Xe)LaTeX, handles this using additional fields like
"shorttitle," "shortjournal," and "shortseries," so for the BibTeX-style
bibliographic entry

@book{Blau2010,
author = {Joshua Blau},
title = {Phonology and Morphology of Biblical Hebrew},
shorttitle = {Phonology},
series = {Linguistic Studies in Ancient West Semitic},
shortseries = {LSAWS},
volume = {2},
location = {Winona Lake, IN},
publisher = {Eisenbrauns},
year = {2010}
}

the initial in-text citation (in SBL style) would look something like

Joshua Blau, *Phonology and Morphology of Biblical Hebrew*, LSAWS 2 (Winona
Lake, IN: Eisenbrauns, 2010),

while subsequent in-text citations would look like

Blau, *Phonology*.

A separate list of abbreviations would then list "LSAWS" alongside
"Linguistic Studies in Ancient West Semitic" (and likewise for other
journal/series abbreviations).

Thank you!

Joey
___
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
___


Re: [NTG-context] Setting a heading text on its own page with \setuphead

2021-08-07 Thread Joey McCollum via ntg-context
Beautiful! This makes things even more succinct. I notice that if I try to
prevent paragraph indentation after a MyPart heading with the
"indentnext=no" argument, it doesn't work. Is this because of the
\page[blankpagebreak] command in the "after" argument? (In any case, I can
just change the "after" argument to
"after=\page[blankpagebreak]\noindentation" and things work as expected, so
this isn't a real problem. I'm just curious.)

Thanks!

Joey

On Sat, Aug 7, 2021 at 5:20 AM Wolfgang Schuster <
wolfgang.schuster.li...@gmail.com> wrote:

> Joey McCollum via ntg-context schrieb am 06.08.2021 um 19:12:
> > Hi,
> >
> > I'd like to define my own class of heading derived from the "part"
> > heading; in the MWE below, it's called "MyPart". I'd like this heading
> > to have the following features:
> >
> >   * Its title should appear in the ToC, but its number should never be
> > printed in the ToC or in the text.
> >   * It should always start on an odd page.
> >   * Its text should be in a larger size than the text of the body, set
> > in all caps, and set with extra letterspacing.
> >   * Most importantly, the title of the heading should appear on its own
> > page without a header or footer. The text of the body should begin
> > on the next odd page.
> >
> > I was hoping to accomplish all of this within the \setuphead command,
> > and it seems like this should be possible, but in the following example,
> > I'm not getting the text of the header at all:
> >
> > [...]
> >
> > I expect there's something obvious that I'm missing, but any help is
> > appreciated.
>
> Most of the stuff was already answered by Pablo. Below is my version how
> to set the layout to fit the requirements.
>
> \definefontfamily
>[garamond]
>[rm]
>[EBGaramond]
>
> \setupbodyfont
>[garamond,12pt]
>
> \definefont
>[MyPartFont]
>[Serif at 24pt]
>[line=36pt]
>
> \setuppagenumbering
>[alternative=doublesided,
> location=]
>
> \setupinterlinespace
>[line=18pt]
>
> \definepagebreak
>[blankpagebreak]
>[yes,header,footer,right]
>
> \definehead
>[MyPart]
>[part]
>
> \definecharacterkerning
>[mypartkerning]
>[factor=0.,
> features=letterspacing]
>
> \setuphead
>[MyPart]
>[placehead=yes,
> number=no,
> page=blankpagebreak,
> header=empty,
> footer=empty,
> align={flushleft,nothyphenated},
> style=MyPartFont,
>
> textstyle={\setcharacterkerning[mypartkerning]\setcharactercasing[WORD]},
> after={\page[blankpagebreak]}]
>
> \setupheadertexts
>[\structureuservariable{booktitle}] []
>[] [\structureuservariable{booktitle}]
>
> \setupfootertexts
>[pagenumber] []
>[] [pagenumber]
>
> \setupblank
>[line,fixed]
>
> \starttext
>
> \startMyPart [title={Title for Title Page}] [booktitle={Title for Header}]
> \dorecurse{6}{\input knuth\par}
> \stopMyPart
>
> \stoptext
>
> 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
___


Re: [NTG-context] Setting a heading text on its own page with \setuphead

2021-08-06 Thread Joey McCollum via ntg-context
Thank you so much! The piece I was missing was the "placehead=yes". Now
everything works as expected! I couldn't figure out how to increase letter
spacing for the "style" argument using just a \definefont macro, but I was
able to do it with a macro supplied as the "textcommand" argument.

Joey

On Fri, Aug 6, 2021, 1:54 PM Pablo Rodriguez via ntg-context <
ntg-context@ntg.nl> wrote:

> On 8/6/21 7:12 PM, Joey McCollum via ntg-context wrote:
> > Hi,
> >
> > I'd like to define my own class of heading derived from the "part"
> > heading; in the MWE below, it's called "MyPart".
>
> Hi Joey,
>
> these are options for \setuphead[part] (MyPart in your case):
>
> > I'd like this heading to have the following features:
> >
> >   * Its title should appear in the ToC, but its number should never be
> > printed in the ToC or in the text.
>
> number=no.
>
> >   * It should always start on an odd page.
>
> This is the default for \setuphead[part] (only noticeable in doublesided
> documents).
>
> >   * Its text should be in a larger size than the text of the body, set
> > in all caps, and set with extra letterspacing.
>
> style is the right option there.
>
> >   * Most importantly, the title of the heading should appear on its own
> > page without a header or footer. The text of the body should begin
> > on the next odd page.
>
> placehead=yes is required for \setuphead[part]. And also for MyPart.
>
> header=empty and footer=emtpy. For the page break before the body text,
> you need after=\page.
>
> > I was hoping to accomplish all of this within the \setuphead command,
> > and it seems like this should be possible, but in the following example,
> > I'm not getting the text of the header at all.
>
> See above. I hope it helps,
>
> Pablo
> --
> http://www.ousia.tk
>
> ___
> 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
>
> ___
>
___
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] Setting a heading text on its own page with \setuphead

2021-08-06 Thread Joey McCollum via ntg-context
Hi,

I'd like to define my own class of heading derived from the "part" heading;
in the MWE below, it's called "MyPart". I'd like this heading to have the
following features:

   - Its title should appear in the ToC, but its number should never be
   printed in the ToC or in the text.
   - It should always start on an odd page.
   - Its text should be in a larger size than the text of the body, set in
   all caps, and set with extra letterspacing.
   - Most importantly, the title of the heading should appear on its own
   page without a header or footer. The text of the body should begin on the
   next odd page.

I was hoping to accomplish all of this within the \setuphead command, and
it seems like this should be possible, but in the following example, I'm
not getting the text of the header at all:

```

\setuppagenumbering [alternative=doublesided, location=] %undo default page
numbering in middle of header; doublesided option will ensure that the
document has an even number of pages


%Define an odd page break between books that omits headers and footers in
blank pages

\definepagebreak[blankpagebreak][yes,header,footer,right]


%Setup body and title fonts (is any of this redundant, or can it be
consolidated?):

\definefontsynonym [EBGaramond] [name:EBGaramond-Regular] [features=default]

\definefontfamily[garamond] [rm] [EBGaramond] [features={default}]

\setupbodyfont[garamond, 12pt]

\setupinterlinespace[18pt] %text line spacing

\definefont[MyPartFont][EBGaramond at 24pt][line=36pt] %font command to be
used for setting MyPart heading texts


%Macro for adjusting kerning of MyPart heading texts (can any of this can
be handled in the \definefont call?):

\define[1]\MyPartTextCommand{%

\kerncharacters[0.]%increase letterspacing

\WORDS{#1}%set all letters in uppercase

}


%Macro for page break after MyPart headings:

\define\AfterMyPart{%

\page[blankpagebreak]%

}


%Define a new heading at the level of a part:

\definehead[MyPart][part]

\setuphead[MyPart][

number=no,%do not add a number to this heading

page=blankpagebreak,%always start this on an odd page

header=empty,%disable headers for this page

footer=empty,%disable footers for this page

align={flushleft, nothyphenated},%titling alignment settings

textstyle=\MyPartFont,%set text style

textcommand=\MyPartTextCommand,%set text formatting command

commandafter=\AfterBookTitle%add a double page break afterwards

]


%Setup header and footer text:

\setupheadertexts[{\structureuservariable{booktitle}}\hfill][][][\hfill
{\structureuservariable{booktitle}}] %even left, even right, odd left, odd
right

\setupfootertexts[\pagenumber][][][\pagenumber] %even left, even right, odd
left, odd right


%Ensure that whitespace respects the grid layout:

\setupblank[line,fixed]

\starttext

\startMyPart[title={Title for Title Page}][booktitle={Title for Header}]

\input knuth\par

\input knuth\par

\input knuth\par

\input knuth\par

\input knuth\par

\input knuth

\stopMyPart

\stoptext
```

I expect there's something obvious that I'm missing, but any help is
appreciated.

Thank you!

Joey
___
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
___