更改参考书目中文章标题的字体

更改参考书目中文章标题的字体

对于学校练习,我们需要更改参考书目格式。第一个子任务是将字体更改为 Arial(别评判我的教授,他其实是个好人)对于 类型的条目标题@article。我们必须使用authoryear作为样式和\DeclareFieldFormat作为 ... 命令/方法。很简单,对吧?天哪,我在这个网站和下面的文档里找了五个小时,但还是没找到答案。我现在需要出去透透气。

authoryear.bbx standard.bbx biblatex_.def以及 biblatex 文档(英语和德语版本,英语版本有作者章节,德语版本中没有)等。

它看起来应该是这样的:

据称正确的输出

好吧,让我告诉你,这不是正确的输出(但任务明确指出了 Arial 部分),因为出版物的标题(“提出新的...”和“威尔金森一年级...”)应该用 Arial 书写。请想象一下它们是用 Arial 书写的。绿色年份和 comic sans 页面是其他子任务的一部分。

这是我的输出,代码如下

这里最重要的部分是:

\DeclareFieldFormat[article]{title}
{\fontfamily{Arial}}

这是我现在的代码:

% -------------
% Header
% -------------
\documentclass[10pt,a4paper]{article}

\usepackage[left=3.00cm, right=3.00cm, top=3.00cm, bottom=3.00cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage{gentium}
\usepackage{fontspec}
\setmainfont{GentiumPlus}

\usepackage{xcolor} % gonna need this later

\usepackage[style=authoryear,backend=biber]{biblatex}
\addbibresource{references_0303.bib}

% ------------------------------------
% Task Descriptions
% ------------------------------------

% 1. use the authoryear style
% 2. use \DeclareFieldFormat to produce the following adaptations:
% (a) Titles of journal articles are to be written in the Arial font
\DeclareFieldFormat[article]{title}
{\fontfamily{Arial}} % I obviouly have no idea what I'm doing. See output.
% ...
% ... some other task descriptions ...
% ...

\begin{document}

\nocite{*}

% Having the bibliography split up like this is part of a later task for which I stumbled upon the solution while doing another exercise, so it's here already, it doesn't influence the task at hand.

\printbibliography[type=book,title=Books]

\printbibliography[type=article,title=Articles]

\printbibliography[nottype=article,nottype=book,title=Other]

\end{document}

这是 bibfile 的内容:

@phdthesis{bruno2003,
    address = {Ann Arbor},
    author = {Bruno, Ana Carla},
    school = {University of Arizona},
    title = {Waimiri Atroari Grammar},
    subtitle = {Some Phonological, Morphological, and Syntactic Aspects},
    year = {2003},
}

@book{olza1994,
    address = {Caracas},
    author = {Olza, Jesús and de Armellada, Cesáreo},
    publisher = {Universidad Católica Andrés Bello},
    title = {Gramática de la lengua Pemón (morfosintaxis)},
    year = {1994},
}

@article{gildea2004,
    author = {Gildea, Spike},
    journal = {Amerindia},
    pages = {7--32},
    title = {Proposing a new branch for the Cariban language family},
    volume = {28},
    year = {2004},
}

@incollection{koehn1986,
    title = {Apalai},
    author = {Koehn, Edward and Koehn, Sally},
    booktitle = {Handbook of Amazonian Languages},
    editor = {Derbyshire, Desmond C. and Pullum, Geoffrey K.},
    volume = {1},
    pages = {33--127},
    year = {1986},
    publisher = {Mouton de Gruyter},
    address = {Berlin/New York},
}

@book{derbyshire1979,
    address = {Amsterdam},
    author = {Derbyshire, Desmond C.},
    publisher = {North-Holland},
    series = {Lingua Descriptive Studies},
    title = {Hixkaryana},
    number = {1},
    year = {1979},
}

@online{glottolog,
    author = {Hammarström, Harald and Forkel, Robert and Haspelmath, Martin and Bank, Sebastian},
    year = {2016},
    title = {Glottolog 2.7},
    location = {Jena},
    school = {Max Planck Institute for the Science of Human History},
    url = {http://glottolog.org},
    urldate = {2016-06-22},
}

@inproceedings{salam,
    author = {Salam, Abdus},
    editor = {Svartholm, Nils},
    title = {Weak and Electromagnetic Interactions},
    date = {1968},
    booktitle = {Elementary particle theory},
    booksubtitle = {Relativistic groups and analyticity},
    booktitleaddon = {Proceedings of the Eighth Nobel Symposium},
    eventdate = {1968-05-19/1968-05-25}, % output: 19.-25. Mai 1968
    venue = {Aspenäsgarden, Lerum},
    publisher = {Almquist \& Wiksell},
    location = {Stockholm},
    pages = {367--377},
}

@collection{dixon2003word,
    title = {Word},
    subtitle = {A cross-linguistic typology},
    editor = {Dixon, Robert and Aikhenvald, Alexandra},
    year = {2003},
    address = {Cambridge},
    publisher = {Cambridge University Press},
}

@techreport{rfc1654,
    author = {Yakov Rekhter and Tony Li},
    title = {A Border Gateway Protocol 4 (BGP-4)},
    howpublished = {Internet Requests for Comments},
    type = {RFC},
    number = {1654},
    pages = {1-56},
    year = {1995},
    month = {07},
    issn = {2070-1721},
    publisher = {RFC Editor},
    institution = {RFC Editor},
    url = {http://www.rfc-editor.org/rfc/rfc1654.txt},
}

@misc{isotest,
    author = {{DIN ISO 8037-1:2003-05}},
    title = {Optik und optische Instrumente - Mikroskope; Objektträger - Teil 1},
    subtitle = {Maße, optische Eigenschaften und Kennzeichnung},
    year = {1986},
}

@article{spergel2003,
    author = {D. N. Spergel and L. Verde and H. V. Peiris and E. Komatsu and M. R. Nolta and C. L. Bennett and M. Halpern and G. Hinshaw and N. Jarosik and A. Kogut and M. Limon and S. S. Meyer and L. Page and G. S. Tucker and J. L. Weiland and E. Wollack and E. L. Wright},
    title = {First-Year Wilkinson Microwave Anisotropy Probe (WMAP) Observations},
    subtitle = {Determination of Cosmological Parameters},
    journal = {The Astrophysical Journal Supplement Series},
    volume = {148},
    number = {1},
    pages = {175--194},
    year = {2003},
}

答案1

我不知道正确的做法是什么,但这个问题不再需要回答,因为我问的是某件事,但问题是其他的。在这种情况下,版主可以评论正确的程序。

我只是想将这个问题从未回答的问题列表中删除,并暗示我们在问题的评论中找到了解决方案。我可以删除这个问题,但话又说回来,有人可能正在寻找最简单的方法来更改参考书目特定部分的字体并在整个文件中保持一致。

正确的插入方式如下:

\DeclareFieldFormat[article]{title}{\fontspec{Arial}{#1}}

其中{#1}是相应字段文本的占位符(在本例中为文章标题)。问题中缺少此内容,因此代码无法正确解析。此外,正如@johannes-b 在一条评论中指出的那样,\fontspec必须使用 而不是\fontfamily来选择所需的字体。

附言:我应该把这个作为社区维基检查吗?我还不太明白这样做的目的。哦,拜托,千万不要点赞,因为我会发现自己必须删除整篇文章(前提是我有这样做的特权)。

相关内容