使用 biblatex 編碼 latin1 時出現問題

使用 biblatex 編碼 latin1 時出現問題

我在包裹方面遇到了一些麻煩biblatex。當我嘗試編譯(使用 pdflatex)時,返回以下警告訊息:

Process started: biber.exe AuxDirectory/"example"

INFO - This is Biber 2.12
INFO - Logfile is 'AuxDirectory/example.blg'
INFO - Reading 'AuxDirectory/example.bcf'
INFO - Found 2 citekeys in bib section 0
INFO - Processing section 0
INFO - Looking for bibtex format file 'example.bib' for section 0
INFO - LaTeX decoding ...
INFO - Found BibTeX data source 'example.bib'
INFO - Overriding locale 'pt-BR' defaults 'variable = shifted' with 'variable = non-ignorable'
INFO - Overriding locale 'pt-BR' defaults 'normalization = NFD' with 'normalization = prenormalized'
INFO - Sorting list 'none/global//global/global' of type 'entry' with template 'none' and locale 'pt-BR'
INFO - No sort tailoring available for locale 'pt-BR'
INFO - Writing 'AuxDirectory/example.bbl' with encoding 'latin1'
WARN - The entry 'Adam2009' has characters which cannot be encoded in 'latin1'.
       - Recoding problematic characters into macros.
WARN - The entry 'Adam2010' has characters which cannot be encoded in 'latin1'.
       - Recoding problematic characters into macros.
INFO - Output to AuxDirectory/example.bbl
INFO - WARNINGS: 2

Process exited normally

我在 tex 檔案中使用了以下最少程式碼:

\documentclass[a4paper,twoside,openright,final]{memoir}%
\usepackage{fouriernc}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{lastpage}
\usepackage{indentfirst}
\usepackage[backend=biber,style=numeric-comp,sorting=none,sortlocale=auto,bibencoding=auto,backref=true,date=year]%
{biblatex}
\usepackage{url}
\usepackage[english,brazilian]{babel}
\usepackage{csquotes}


\settrimmedsize{297mm}{210mm}{*}
\setlength{\trimtop}{0pt}
\setlength{\trimedge}{\stockwidth}
\addtolength{\trimedge}{-\paperwidth}
\settypeblocksize{247mm}{160mm}{*}
\setulmargins{3cm}{*}{*}
\setlrmargins{*}{*}{1.5}
\setmarginnotes{17pt}{51pt}{\onelineskip}
\setheadfoot{\onelineskip}{2\onelineskip}
\setheaderspaces{*}{2\onelineskip}{*}
\checkandfixthelayout
\frenchspacing
\addbibresource{example.bib}

\makeatother


\begin{document}
    \cite{Adam2009}
    \cite{Adam2010}
    \printbibliography
\end{document}

下面,我還提供了帶有問題的兩個參考文獻的最小參考書目代碼。

@Article{Adam2009,
  author    = {Adam, C. and Klimas, P. and S{\'a}nchez-Guill{\'e}n, J. and Wereszczy{\'n}ski, A.},
  title     = {Compact baby Skyrmions},
  journal   = {Physical Review D},
  year      = {2009},
  volume    = {\bfseries 80},
  issue     = {10},
  month     = {11},
  pages     = {105013},
  doi       = {10.1103/PhysRevD.80.105013},
  url       = {https://link.aps.org/doi/10.1103/PhysRevD.80.105013},
  urldate   = {2019-01-31},
  numpages  = {14},
  publisher = {American Physical Society},
}


@Article{Adam2010,
  author       = {Adam, C. and Roma{\'n}czukiewicz, T. and S{\'a}nchez-Guill{\'e}n, J. and Wereszczy{\'n}ski, A.},
  title        = {Investigation of restricted baby Skyrme models},
  journaltitle = {Phys.ical Review D},
  year         = {2010},
  volume       = {\bfseries 81},
  number       = {8},
  month        = {4},
  pages        = {085007},
  doi          = {10.1103/PhysRevD.81.085007},
  url          = {https://link.aps.org/doi/10.1103/PhysRevD.81.085007},
  urldate      = {2019-01-31},
  numpages     = {10},
  publisher    = {American Physical Society},
}

顯然,出現問題是因為{\'n}字元無法編碼為“ latin1”。我嘗試更改程式碼,但沒有成功。如果有人知道要解決這個問題,我將非常感激。

答案1

這條訊息只是一個警告,如果您認為採取行動(即使用utf8而不是latin1)對您來說不值得,那麼可以安全地忽略它(讓我補充一點,我絕對認為用 UTF-8 編碼所有內容)將是這裡最好的解決方案,但你會有你的理由)。

出現警告的原因是ñ不包含在 Latin-1 中,因此如果您堅持使用 Latin-1,則只能匯出為 LaTeX 巨集組合而不是真正的字元(事實上 Biber 比這裡可能需要的更激進一些:它將寫出整個帶有ASCII 巨集的條目,而不僅僅是有問題的字元)。這與字元的輸入無關,因為 Biber 在內部將所有內容轉換為 UTF-8 以便能夠進行排序。它只關心如何將字元寫入檔案.bbl以供進一步處理biblatex

您可以透過使用以下選項呼叫 Biber 來避免警告--output-safechars,即

biber --output-safechars <filename>

這將使所有非 ASCII 字元保留為巨集形式,並且不會嘗試將任何字元轉換為 Latin-1 的非 ASCII 範圍。 (因此.bbl,如果您的條目全部包含 Latin-1 字符,您會看到差異。)


注意

volume    = {\bfseries 80},

不太語義化。嘗試

volume    = {80},

\DeclareFieldFormat[article,periodical]{volume}{\mkbibbold{#1}}% volume of a journal

反而。

相關內容