ConTeXt:自定义书目列表字段渲染

ConTeXt:自定义书目列表字段渲染

我正在尝试为一份文档(称为“NTC1486”)重新创建参考书目渲染样式。

期望输出示例

其结构基本如下:

SECOND NAME, First Names. Title of the article. City. Editorial, Year.

提供的书目客户端仅包含一堆 URL 链接。我设置了一个 .bib 文件,如下所示,任何条目均未提供年份:

@manual{iso27000,
    title  = "Normatividad y certificaciones aplicadas a SGSI",
    author = "Agustín López Neira and Javier Ruiz Spohr",
    url    = "http://www.iso27000.es/download/doc_iso27000_all.pdf",
    year   = "consultado el 29 de septiembre de 2017"
}

但 MkIV 参考书目的文档对我来说似乎很混乱。我试过弄乱

\usebtxdataset[bibliografia][bibliografia.bib]

\usebtxdefinitions[apa]
\definebtxrendering[bibliografia][apa][specification=apa,sorttype=authoryear,numbering=no,dataset=bibliografia,group=examples]
\setupbtxlist[apa][alternative=paragraph,width=fit,distance=0mm,margin=0mm]
\setupbtx[apa:list:author][separator:names:3={\btxspace y \btxspace},separator:names:4={\btxspace y \btxspace\btxcomma},authorconversion={normal},textstyle={\WORDS},textstyle={\WORDS}]
\setupbtx[apa:list:title][textstyle={\normal}]

\starttext
\placelistofpublications[bibliografia][method=dataset]
\stoptext

但是它会将所有内容都显示为小写。如果我设置\setupbtxlist[apa][textstyle={\WORDS}],它会将除文章标题之外的所有内容都设置为大写。

是我操作错误了吗?还是有 bug 之类的?

答案1

你说的对separator:names。为了保持一致性,只解决了几个问题。但是你对的理解错了setupbtxlist。我也是,因为我没能“完全”正确地完成它。

不要投票,我只是将其留在这里作为提醒。

看看 Aditya 是否可以帮助您,或者邮件列表中的某个人是否可以提供帮助。

以下是代码:

 \definebtxdataset[template]
 \usebtxdataset[template]
 [bibliografia.bib]


 \loadbtxdefinitionfile[apa]

 \definebtxrendering
 [template]
 [apa]
 [dataset=template, 
    group=examples]

 \setupbtx[apa:list:author]
 [separator:names:4={\btxspace y \btxspace},
 authorconversion={normal}]


 \setupbtxlist[apa]
    [state=start,
    margin=5\emwidth, 
    textstyle={\sc\texdefinition{btx:default:author} \it{\texdefinition{btx:default:title}}} ]


 \starttext

 \startbodymatter
 a citation: \cite[num][template::iso27000::]
 \stopbodymatter

 \startbackmatter
 \startchapter[title=Bibliografía]
 \placebtxrendering[template][method=dataset]
 \stopchapter
 \stopbackmatter



 \stoptext

在此处输入图片描述

这是另一个例子。它复制自http://ftp.math.utah.edu/pub/tex/bib/tugboat.html

 \definebtxdataset[template]
 \usebtxdataset[template]
 [tugbib.bib]


 \loadbtxdefinitionfile[apa]

 \definebtxrendering
 [template]
 [apa]
 [dataset=template, 
    group=examples]

 \setupbtx[apa:list:author]
 [separator:names:4={\btxspace y \btxspace},
 authorconversion={normal}]


 \setupbtxlist[apa]
    [state=start,
    margin=5\emwidth, 
    textstyle={\sc\texdefinition{btx:default:author} \it{\texdefinition{btx:default:title}}} ]

 \starttext

 \startbodymatter
 a citation: \cite[num][template::Gregorio:TB26-3-273::]
 \stopbodymatter

 \startbackmatter
 \startchapter[title=Bibliografía]
 \placebtxrendering[template][method=dataset]
 \stopchapter
 \stopbackmatter



 \stoptext

在此处输入图片描述

答案2

目前,APA 书目格式缺乏使用以下格式格式化作者的能力:

\setupbtx
  [apa:list:author]
  [command=\WORD]

因此您必须自己修补该命令btx:apa:author-or-editor。我还向维护人员提交了一个补丁,因此也许它会在下一个测试版中得到修复。

% macros: mkvi

\startbuffer[bibliografia]
@manual{iso27000,
  title  = "Normatividad y certificaciones aplicadas a SGSI",
  author = "López Neira, Agustín and Ruiz Spohr, Javier",
  url    = "http://www.iso27000.es/download/doc_iso27000_all.pdf",
  year   = "consultado el 29 de septiembre de 2017"
}

@inbook{Bunge1970,
  title   = "La ciencia. Su método y su filosfía",
  author  = "Bunge, Mario",
  address = "Buenos Aires: Ariel",
  year    = "1970",
  pages   = "120"
}
\stopbuffer

\mainlanguage[es]

\setuppagenumbering[location=footer]

\setuplayout
  [backspace=4cm,
   leftmargin=0pt,
   width=middle,
   rightmargin=0pt,
   cutspace=2cm,
   %
   topspace=3cm,
   header=0pt,
   headerdistance=0pt,
   height=middle,
   footerdistance=\dimexpr1cm-\lineheight\relax,
   footer=\lineheight,
   bottomspace=2cm]

\setuphead
  [title]
  [style=\WORD,
   align=middle,
   after={\blank[2*line]}]

\usebtxdefinitions[apa]

\usebtxdataset[bibliografia][bibliografia.buffer]

\definebtxrendering
  [bibliografia][apa]
  [dataset=bibliografia,
   group=examples]

\setupbtxlist
  [apa]
  [alternative=paragraph,
   width=fit,
   distance=0mm,
   margin=0mm,
   after={\blank[2*line]}]

\setupbtx
  [apa:list]
  [separator:names:2={\btxcomma},
   separator:names:3={\btxcomma\btxlabeltext{and}\space},
   separator:names:4={\btxspace\btxlabeltext{and}\space},
   authorconversion=normal]

\setupbtx
  [apa:list:author]
  [command=\WORD]

\setupbtx
  [apa:list:title]
  [style=normal]

\unprotect
% patch btx:apa:author-or-editor, copied from publ-imp-apa.mkvi
\starttexdefinition unexpanded btx:apa:author-or-editor #author
    \btxdoifelse {#author} {
        \btxstartstyleandcolor[apa:\s!list:#author]
            \btxusecommand [apa:\s!list:#author]{
                \btxflush{#author}
            }
        \btxstopstyleandcolor
        % use \processaction [] [] here?
        \doifelse {\btxfoundname{#author}} {editor} {
            \btxleftparenthesis
            \btxsingularorplural {editor} {
                \btxlabeltext{apa:Editor}
            } {
                \btxlabeltext{apa:Editors}
            }
            \btxrightparenthesis
        } {\doif {\btxfoundname{#author}} {ineditor} {
            \btxleftparenthesis
            \btxsingularorplural {ineditor} {
                \btxlabeltext{apa:Editor}
            } {
                \btxlabeltext{apa:Editors}
            }
            \btxrightparenthesis
        } }
        \doif {\currentbtxcategory} {film} {
            \btxleftparenthesis
            \doifelse {\btxfoundname{#author}} {director} {
                \btxsingularorplural {director} {
                    \btxlabeltext{apa:Director}
                } {
                    \btxlabeltext{apa:Directors}
                }
            } {
                \doif {\btxfoundname{#author}} {author} {
                    \btxsingularorplural {author} {
                        \btxlabeltext{apa:Writer}
                    } {
                        \btxlabeltext{apa:Writers}
                    }
                }
                \doif {\btxfoundname{#author}} {producer} {
                    \btxsingularorplural {producer} {
                        \btxlabeltext{apa:Producer}
                    } {
                        \btxlabeltext{apa:Producers}
                    }
                }
                \btxdoif {director} {
                    \btxrightparenthesis
                    \removeunwantedspaces
                    \btxparameter{\c!separator:names:3}
                    \btxflush{director}
                    \btxleftparenthesis
                    \btxsingularorplural {director} {
                        \btxlabeltext{apa:Director}
                    } {
                        \btxlabeltext{apa:Directors}
                    }
                }
            }
            \btxrightparenthesis
        }
        \btxdoif {withauthor} {
            \btxleftparenthesis
            \btxlabeltext{with}
            \btxspace
            \btxflush{withauthor}
            \btxrightparenthesis
        }
    } {
        \texdefinition{btx:apa:title}
    }
\stoptexdefinition
\protect

\starttext

\starttitle[title=Bibliografía]
  \placelistofpublications[bibliografia][method=dataset]
\stoptitle

\stoptext

在此处输入图片描述

相关内容