在 ConTeXt APA 样式书目中显示书籍页码

在 ConTeXt APA 样式书目中显示书籍页码

我使用 APA 格式来编写参考书目(比 APS 格式更能覆盖@film条目)。在法国人文主义书目中,通常需要提供书籍的页码。

我看见这篇 TEX SE 帖子一个包含一些字段的 .bib 示例pagetotal,这让我很惊讶,因为这个示例没有在 Hans Hagen 和 Alan Braslau 的“参考书目。ConTeXt 方式”中记录。无论如何,这个字段没有显示在我的参考书目中。

我该如何调整 APA 样式以使其显示?我阅读了文档的自定义渲染章节,但不知道如何完成。

\setuppapersize[S4]
\mainlanguage[fr]
\language[fr]

\startbuffer[bib]

@book{Manuel5,
   editor = {Martin Ivernel and Benjamin Villemagne and Jean Hubac},
   title = {Histoire Géographie EMC 5\high{ème}, cycle 4},
   publisher = {Hatier},
   address = {Paris},
   year = {2016},
   pagetotal = {398},
   language = {french}
}
@book{Buhrer-Thierry,
   author = {Geneviève Bührer-Thierry},
   title = {L’Europe carolingienne (714--888)},
   publisher = {SEDES},
   address = {Paris},
   year = {1999},
   pagetotal = {192},
   language = {french}
}
@book{ExpoReich,
        editor = {Matthias Puhle and Claus-Peter Hasse},
        title = {Heiliges Römisches Reich Deutscher Nation 962--1806},
        subtitle = {Von Otto dem Grossen bis zum Ausgang des Mittelalters},
        publisher = {Sandstein Verlag},
        address = {Dresde},
        language = {german},
        pagetotal = {515},
        year = {2006}
}
\stopbuffer

\usebtxdataset[bib.buffer]
\definebtxrendering
   [biblio]
   [apa]
   [numbering=no,
    sorttype=cite]

\starttext
\nocite[Manuel5]
\nocite[Buhrer-Thierry]
\nocite[ExpoReich]
\placelistofpublications
\stoptext

答案1

根据@Henri Menke的建议,我决定创建自己的风格,遵循iso690规范。我将在几天内提交此模块。这里我仅给出添加页面所需的步骤。

让我们调用一种mydefault样式,它只是更改默认样式以添加书籍页面,并且只有书籍条目。我必须在您的中创建两个文件$TEXMFHOME/tex/context/,即publ-imp-mydefault.luap-publ-imp-mydefault.mkiv(我想将此样式作为私有模块加载)。为了使这个示例尽可能简洁,我删除了与文章和引文相关的任何默认样式。

这是 publ-imp-mydefault.lua。对默认样式的唯一更改(除了剥离)是我"pages"在 book 中添加了一个字段。

return {
    -- derived (combinations of) fields (all share the same default set)
    --
    virtual = {
        "authoryear",
        "authoryears",
        "authornum",
        "num",
        "suffix",
    },
    --
    -- special datatypes
    --
    types = {
        author   = "author",     -- interpreted as name(s)
        editor   = "author",     -- interpreted as name(s)
        page     = "pagenumber", -- number or range: f--t -- maybe just range
        pages    = "pagenumber", -- number or range: f--t -- maybe just range
        volume   = "range",      -- number or range: f--t
        number   = "range",      -- number or range: f--t
        keywords = "keyword",    -- comma|-|separated list
    },
    --
    -- categories with their specific fields
    --
    categories = {
        book = {
            sets = {
                author     = { "author", "editor", },
                editionset = { "edition", "volume", "number" },
            },
            required = {
                "title",
                "year",
            },
            optional = {
                "author", -- a set
                "subtitle",
                "keywords",
                "publisher", "address",
                "editionset",
                "note",
                "pages",
            },
        },
    },
}

这是 p-publ-imp-mydefault.mkiv

\startbtxrenderingdefinitions[mydefault]

\definebtxrendering
  [mydefault]
  [\c!specification=mydefault,
   \c!sorttype=\v!default,
   \c!numbering=num]

\setupbtxlist
  [default]
  [\c!align={normal,verytolerant,stretch}]

\definebtx
  [mydefault]
  [\c!default=, % we do not want to fall|-|back on ourself.
   \c!otherstext={\btxspace\btxlabeltext{mydefault:others}},
   %c!journalconversion=\v!normal,
   \c!monthconversion=\v!number,
   \c!separator:names:2={\btxcomma},
   \c!separator:names:3={\btxspace\btxlabeltext{mydefault:and}\space},
   \c!separator:names:4={\btxspace\btxlabeltext{mydefault:and}\space}]

\definebtx
  [mydefault:\s!list]
  [mydefault]
  [\c!authorconversion=normalshort]

\definebtx
  [mydefault:\s!list:\s!page]
  [mydefault:\s!list]
  [\c!separator:2={\btxcomma},
   \c!separator:3={\btxcomma\btxlabeltext{mydefault:and}\space},
   \c!separator:4={\btxspace\btxlabeltext{mydefault:and}\space},
   \c!left={\btxleftparenthesis},
   \c!right={\btxrightparenthesis}]

\definebtx
  [mydefault:\s!list:numbering]
  [mydefault:\s!list]

\definebtx
  [mydefault:\s!list:numbering:default]
  [mydefault:\s!list:numbering]

\definebtx
  [mydefault:\s!list:numbering:num]
  [mydefault:\s!list:numbering]

\definebtx
  [mydefault:\s!list:numbering:short]
  [mydefault:\s!list:numbering:num]

\definebtx
  [mydefault:\s!list:numbering:tag]
  [mydefault:\s!list:numbering:num]

\definebtx
  [mydefault:\s!list:numbering:index]
  [mydefault:\s!list:numbering:num]

\definebtx
  [mydefault:\s!list:author]
  [mydefault:\s!list]

\definebtx
  [mydefault:\s!list:editor]
  [mydefault:\s!list:author]

\definebtx
  [mydefault:\s!list:short]
  [mydefault:\s!list]

\definebtx
  [mydefault:\s!list:title]
  [mydefault:\s!list]
  [\c!style=\v!italic,
   \c!command=\Word]

\definebtx
  [mydefault:\s!list:title:book]
  [mydefault:\s!list:title]

% First some helpers:

\starttexdefinition btx:mydefault:composed-title
    \begingroup
        \language[\currentbtxlanguage]
        \btxflush{title}
        \btxdoif {subtitle} {
            \btxcolon
            \btxflush{subtitle}
        }
    \endgroup
\stoptexdefinition

\starttexdefinition btx:mydefault:title
    \btxdoif {title} {
        \btxspace
        \btxstartstyleandcolor [default:list:title:\currentbtxcategory]
            \btxusecommand [default:list:title:\currentbtxcategory] {
                \texdefinition{btx:mydefault:composed-title}
            }
        \btxstopstyleandcolor
        \btxcomma
    }
\stoptexdefinition

\starttexdefinition btx:mydefault:author
    \btxdoif {author} {
        \btxflush{author}
        \doif {\btxfoundname{author}} {editor} {
            \btxcomma
            \btxsingularorplural {editor} {
                \btxlabeltext{mydefault:Editor}
            } {
                \btxlabeltext{mydefault:Editors}
            }
        }
        \btxcomma
    }
\stoptexdefinition

\starttexdefinition btx:mydefault:year
    \btxflush{year}
    \btxflushsuffix
    \btxcomma
\stoptexdefinition

\starttexdefinition btx:mydefault:editionset
    \btxdoif {editionset} {
        \removeunwantedspaces
        \removepunctuation
        \btxleftparenthesis
        \doif {\btxfoundname{editionset}} {edition} {
            \btxflush{edition}
            \btxspace
            \btxlabeltext{mydefault:edition}
            \btxcomma
        }
        \btxdoif {volume} {
            \btxoneorrange {volume} {
                \btxlabeltext{mydefault:Volume}
            } {
                \btxlabeltext{mydefault:Volumes}
            }
            \btxspace
            \btxflush{volume}
            \btxcomma
        }
        \btxdoifelse {number} {
            \btxlabeltext{mydefault:number}
            \btxspace
            \btxflush{number}
        } {
            \removeunwantedspaces
            \removepunctuation
        }
        \btxrightparenthesiscomma
    }
\stoptexdefinition

\starttexdefinition btx:mydefault:publisher
    \btxdoif {publisher} {
        \btxflush{publisher}
        \btxcomma
    }
    \btxdoif {address} {
        \btxflush{address}
        \btxcomma
    }
\stoptexdefinition

\starttexdefinition unexpanded btx:mydefault:pages
    \btxdoif {pages} {
        \btxflush{pages}
        \btxnbsp
        \btxlabeltext{p.}
    }
\stoptexdefinition


% Then a minimal number of setups:

\startsetups btx:mydefault:list:book
    \texdefinition{btx:mydefault:author}
    \texdefinition{btx:mydefault:title}
    \texdefinition{btx:mydefault:editionset}
    \texdefinition{btx:mydefault:publisher}
    \texdefinition{btx:mydefault:year}
    \texdefinition{btx:mydefault:pages}
    \removeunwantedspaces
    \removepunctuation
    \btxperiod
\stopsetups

\stopbtxrenderingdefinitions

与默认样式文件的区别是:删除了文章和引用内容。我添加了一个助手:

\starttexdefinition unexpanded btx:mydefault:pages
    \btxdoif {pages} {
        \btxflush{pages}
        \btxnbsp
        \btxlabeltext{p.}
    }
\stoptexdefinition

然后我将其添加到btx:mydefault:list:book设置中。

所以现在,如果我继续这个 MWE(我只在缓冲区保留了一本书,这已经足够长了)

\setuppapersize[S4]
\mainlanguage[fr]
\language[fr]
\usemodule[publ-imp-mydefault]

\startbuffer[bib]

@book{Buhrer-Thierry,
   author = {Geneviève Bührer-Thierry},
   title = {L’Europe carolingienne (714--888)},
   publisher = {SEDES},
   address = {Paris},
   year = {1999},
   pages = {192},
   language = {french}
}
\stopbuffer

\usebtxdataset[bib.buffer]
\usebtxdefinitions [mydefault]

\starttext
\nocite[Buhrer-Thierry]
\placelistofpublications
\stoptext

我得到:

输出。页面现在位于描述列表的末尾

原始 ConTeXt 文件publ-imp-default.luapubl-imp-default.mkvi代码是 BSD 许可证(如果我理解得没错的话)并且归 ConTeXt 开发小组所有。

相关内容