Biblatex:スタイルと並べ替えが異なる2つの参考文献

発生した問題のMWE:

\documentclass{article} \usepackage{filecontents} \begin{filecontents}{biblatextest1.bib} @BOOK{BookA03, author = {Author Aaa}, title = {Some Title}, publisher = {Some Publisher}, year = 2003 } @BOOK{BookB02, author = {Author Bbb}, title = {Some Title}, publisher = {Some Publisher}, year = 2002 } \end{filecontents} \begin{filecontents}{biblatextest2.bib} @MISC{LinkC04, author = {Author Ccc}, title = {Some Title}, year = 2004, url = www.test1.com/bild.jpg, } @MISC{LinkD01, author = {Author Ddd}, title = {Some Title}, year = 2001, url = www.test2.com/bild.jpg } \end{filecontents} \usepackage[backend = biber, defernumbers = true, style = alphabetic]{biblatex} \addbibresource{biblatextest1.bib} \addbibresource{biblatextest2.bib} %Append keywords to identify different bibliography entries. \DeclareSourcemap{ \maps[datatype=bibtex, overwrite]{ \map{ \perdatasource{biblatextest1.bib} \step[fieldset=KEYWORDS, fieldvalue=primary, append] } \map{ \perdatasource{biblatextest2.bib} \step[fieldset=KEYWORDS, fieldvalue=secondary, append] } } } %Declare new sorting scheme for refernence bibliography. \DeclareSortingScheme{appearance}{ \sort{\citeorder} } %Copied from numeric.cbx to imitate numerical citations. \providebool{bbx:subentry} \newbibmacro*{citenum}{%Note: the original macro was called "cite". I did not redefine "cite", but instead defined a new macro "citenum", because the author-year citations use the "cite" macro too. "\renewbibmacro*{cite}" would have caused all the author-year citations to become numeric too. \printtext[bibhyperref]{%If you ever want to use hyperref \printfield{prefixnumber}% \printfield{labelnumber}% \ifbool{bbx:subentry} {\printfield{entrysetcount}} {}}} %Copied from numeric.cbx to define a new numeric citation command for @online entries. \DeclareCiteCommand{\cnume}[\mkbibbrackets] {\usebibmacro{prenote}} {\usebibmacro{citeindex}% \usebibmacro{citenum}}%Note: this was originally "cite" but I changed it to "citenum" to avoid clashes with the author-year style. {\multicitedelim} {\usebibmacro{postnote}} \begin{document} The first two citations \cnume{LinkD01} and \cite{BookB02}. The others are \cnume{LinkC04} and \cite{BookA03}. \printbibliography[title=Bibliography, keyword=primary] %Redefine the bibliography environment to imitate the numeric citation style \defbibenvironment{bibliographyNUM} {\list {\printfield[labelnumberwidth]{labelnumber}} {\setlength{\labelwidth}{\labelnumberwidth}% \setlength{\leftmargin}{\labelwidth}% \setlength{\labelsep}{\biblabelsep}% \addtolength{\labelsep}{1em} \addtolength{\leftmargin}{\labelsep}% \setlength{\itemsep}{\bibitemsep}% \setlength{\parsep}{\bibparsep}}% \renewcommand*{\makelabel}[1]{\hss##1}} {\endlist} {\item} \DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{#1}\hspace{-1.1em}} \newrefcontext[sorting=none] \printbibliography[env=bibliographyNUM,title=References, keyword=secondary, resetnumbers] \end{document} 

問題:2つの参考文献が必要です。最初の参考文献はアルファベットスタイルで、著者名でソートされています。引用順でソートされた数値スタイルの2番目。どちらにも共通の参照はありません。どういうわけか私はbiblatexでこのようなものを探しています:

\bibliographystyle{style = alphabetic} \printbibliography{books.bib} \bibliographystyle{style = numerical, sorting = none} \printbibliography{links.bib} 

biblatexは特に複数の参考文献で動作するように書かれていると思いましたが、見つかりませんでしたMWEに示されている方法以外の方法(これは明らかにハックです)。実際、他の並べ替えが必要になるまでは、かなりうまく機能します。使用すると

\newrefcontext[sorting=none] 

引用番号がゼロになります。

コメント

  • biblatexは、(他の多くの機能の中でも)分割/複数の参考文献をサポートするように作成されていますが、’異なる参考文献の混合を公式にサポートしていません。 1つのドキュメントのスタイル。

回答

オプションlabelnumberからbiblatex style=alphabeticでも数値引用を使用できます。

citeコマンドはに基づいて切り替えることができますキーワードなので、keywordに関係なくすべてのエントリに\citeを使用できます。

数値書誌については数値引用を印刷する新しい書誌環境を定義します。 bibliographyNUMnumeric.bbxから直接コピーされます。参考文献の並べ替えを設定するには、数値参考文献の前に

\newrefcontext[sorting=none] \printbibliography[env=bibliographyNUM, title=References, keyword=secondary, resetnumbers] 

と言ってください。以前の参考文献では、アルファスタイルの参考文献に適したグローバルソートスキームanytを使用します。並べ替えスキームの割り当てをローカルに保つ必要がある場合(数値の参考文献はアルファの参考文献の前にあるため)、

\begin{refcontext}[sorting=none] \printbibliography[env=bibliographyNUM, title=References, keyword=secondary, resetnumbers] \end{refcontext} 

MWE pを使用します。 >

\documentclass{article} \usepackage[style=alphabetic, labelnumber, defernumbers=true, backend=biber]{biblatex} \usepackage{hyperref} % Append keywords to identify different bibliography entries. % appendstrict only appends if the field is nonempty, % we use that to add a comma to avoid mushing together two keywords \DeclareSourcemap{ \maps[datatype=bibtex, overwrite]{ \map{ \perdatasource{biblatextest1.bib} \step[fieldset=KEYWORDS, fieldvalue={, }, appendstrict] \step[fieldset=KEYWORDS, fieldvalue=primary, append] } \map{ \perdatasource{biblatextest2.bib} \step[fieldset=KEYWORDS, fieldvalue={, }, appendstrict] \step[fieldset=KEYWORDS, fieldvalue=secondary, append] } } } \DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{#1}} \renewbibmacro*{cite}{% \printtext[bibhyperref]{% \printfield{labelprefix}% \ifkeyword{secondary} {\printfield{labelnumber}} {\printfield{labelalpha}% \printfield{extraalpha}}}} \defbibenvironment{bibliographyNUM} {\list {\printtext[labelnumberwidth]{% \printfield{labelprefix}% \printfield{labelnumber}}} {\setlength{\labelwidth}{\labelnumberwidth}% \setlength{\leftmargin}{\labelwidth}% \setlength{\labelsep}{\biblabelsep}% \addtolength{\leftmargin}{\labelsep}% \setlength{\itemsep}{\bibitemsep}% \setlength{\parsep}{\bibparsep}}% \renewcommand*{\makelabel}[1]{\hss##1}} {\endlist} {\item} \begin{filecontents}{biblatextest1.bib} @BOOK{BookA03, author = {Author Aaa}, title = {Some Title}, publisher = {Some Publisher}, year = 2003, keywords = {hello}, } @BOOK{BookB02, author = {Author Bbb}, title = {Some Title}, publisher = {Some Publisher}, year = 2002, } \end{filecontents} \begin{filecontents}{biblatextest2.bib} @MISC{LinkC04, author = {Author Ccc}, title = {Some Title}, year = 2004, url = {www.test1.com/bild.jpg}, keywords = {bye}, } @MISC{LinkD01, author = {Author Ddd}, title = {Some Title}, year = 2001, url = {www.test2.com/bild.jpg}, } \end{filecontents} \addbibresource{biblatextest1.bib} \addbibresource{biblatextest2.bib} \begin{document} The first two citations \cite{LinkD01} and \cite{BookB02}. The others are \cite{LinkC04} and \cite{BookA03}. \printbibliography[title=Bibliography, keyword=primary] \newrefcontext[sorting=none] \printbibliography[env=bibliographyNUM, title=References, keyword=secondary, resetnumbers] \end{document} 

出力例

コメント

  • biblatex + biberパッケージ(MikTexユーザー)を再インストールした後は、完全に正常に動作し、エレガントに見えます。誰かが”初期化されていない値”エラーについても疑問に思っている場合は、これを残したかっただけです。また、.texを除くすべてのファイルを削除してください。これらのファイルも、問題を引き起こす可能性があります。良い回避策、ありがとう。
  • @Jannik biblatexとBIberの両方の最新バージョンでは、”初期化されていない値”が飛び交っています。ただし、バージョンが古いか、’一致しない場合、上記は機能しません。更新後、一時ファイルを削除して古いものが残って問題が発生しないようにすることはめったにありません。
  • \newcommand{\letbibmacro}[2]{% \csletcs{abx@macro@#1}{abx@macro@#2}% } \letbibmacro{original-cite}{cite}を追加すると、

    新しい\cite定義内に、ロード時に選択したスタイル(authoryearなど)を挿入します()。

  • @opatutいいアイデアです。ただし、状況によっては、コードの配置が重要になります。また、標準マクロをまったく呼び出さないことも必ずしも良い考えではない場合があります(特に、マクロがより複雑になり、クリーンアップ作業を実行する場合は、’ -icompスタイルはこちら)。ここでは問題はありません。\if...を移動することによってのみ行を保存できましたが、それを再度分離することもできます。
  • @GandalfLechner必要に応じて元のキーワードを保持するには、少し改善することができます。編集した回答をご覧ください。

回答

ありがとうございます。問題の適応バージョンを共有したいと思いました。さまざまな引用語を定義することで、ビブをカテゴリに分類しました。これは、しっかりしたドリフトネットソース、特に biblatex:異なる.bibファイルによって分類された複数の参考文献をコピーしたため、ベストプラクティスではありませんが、機能します。うまくいけば、biblatexは将来的に混合書誌スタイルをネイティブにサポートするでしょう。

\documentclass[fontsize=11pt,a4paper,bibliography=totoc]{scrbook} \usepackage[style=alphabetic,backend=biber,defernumbers = true]{biblatex} \addbibresource{bib/references.bib} \DeclareBibliographyCategory{pubA} \DeclareBibliographyCategory{contA} \DeclareBibliographyCategory{refs} \DeclareBibliographyCategory{relT} \defbibheading{pubA}{\section*{Publications of the Author}} \defbibheading{contA}{\section*{Contributions of the Author}} \defbibheading{refs}{\section*{References}} \defbibheading{relT}{\section*{Related Theses}} \newcommand*{\citeA}[2][]{\addtocategory{pubA}{#2}\cite[#1]{#2}} \newcommand*{\citeC}[2][]{\addtocategory{contA}{#2}\cite[#1]{#2}} \newcommand*{\citeR}[2][]{\addtocategory{refs}{#2}\cite[#1]{#2}} \renewbibmacro*{cite}{% \printtext[bibhyperref]{% \printfield{labelprefix}% \ifcategory{refs} {\printfield{labelnumber}} {\printfield{labelalpha}% \printfield{extraalpha}}}} \newcommand*{\citeT}[2][]{\addtocategory{relT}{#2}\cite[#1]{#2}} \DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{#1}} % important to get [] in bib \defbibenvironment{refsEnv} {\list {\printtext[labelnumberwidth]{% \printfield{prefixnumber}% \printfield{labelnumber}}} {\setlength{\labelwidth}{\labelnumberwidth}% \setlength{\leftmargin}{\labelwidth}% \setlength{\labelsep}{\biblabelsep}% \addtolength{\leftmargin}{\labelsep}% \setlength{\itemsep}{\bibitemsep}% \setlength{\parsep}{\bibparsep}}% \renewcommand*{\makelabel}[1]{\hss##1}} {\endlist} {\item} \begin{document} some text \citeR{<citekey>} \citeT{<citekey>}... \printbibheading[heading=bibintoc] \printbibliography[heading=subbibliography,title={Publications of the Author},category=pubA] \printbibliography[heading=subbibliography,title={Contributions of the Author},category=contA] \newrefcontext[sorting=none] \printbibliography[heading=subbibliography,title={References},category=refs,env=refsEnv,resetnumbers] \printbibliography[heading=subbibliography,title={Related Theses},category=relT] \end{document} 

回答

@moeweの言うことを実行してstyle=alphabetic

さまざまな並べ替え順序の場合、はるかに簡単な方法であるrefcontext環境があります。並べ替えオプション。まず、Biblatexを使用してメインの書誌を生成します。

\printbibliography[title=Bibliography, keyword=primary] 

次に、で囲むことにより、異なる並べ替え、フィルター、スタイルで2番目の書誌を作成します。 refcontextとそれらをパラメーターとして使用します。

\begin{refcontext}[sorting=ydnt]{} % sort chronologically \printbibliography[title=References, keyword=secondary, resetnumbers] \end{refcontext} 

refcontextの最後のパラメーターとしての空の{} 他に何も宣言せずにアドホックな環境を作成できます。

これは、学校で論文の最後に履歴書を含める必要があるときに使用したため、逆に自分の作品の参考文献を生成する必要がありました。 論文の通常のAZ書誌に加えて時系列。 私が持っていたものよりずっときれいでした。

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です