hushidong / biblatex-gb7714-2015

A biblatex implementation of the GB/T7714-2015 bibliography style || GB/T 7714-2015 参考文献著录和标注的biblatex样式包
761 stars 83 forks source link

用法:特殊字符映射问题--\textquotesingle 似乎被转为了别的字符 #136

Open septsea opened 2 years ago

septsea commented 2 years ago

您好。我最近在写文档。我引用了一些参考文献。不过,我发现,不知为何,若使用您的 gb7714-2015(也许是因为 biblatex?),\textquotesingle 被转为了别的字符。不过,若使用 gb7714,则虽 \textquotesingle 正常,但人名无法被正确地打印。

一个不怎么小的极小例:

\documentclass[fontset=fandol]{ctexart}

\begin{filecontents*}{test.bib}
@article{Goursat:CauchyTheorem,
  title     = {Sur la d\'efinition g\'en\'erale des fonctions analytiques, d\textquotesingle{}apr\`es {Cauchy}},
  author    = {Goursat, \'Edouard},
  journal   = {Transactions of the American Mathematical Society},
  volume    = {1},
  number    = {1},
  pages     = {14-16},
  year      = {1900}
}
\end{filecontents*}

% bibliography à la gb7714-2015
\usepackage[backend=biber,style=gb7714-2015]{biblatex}
\addbibresource{test.bib}

% bibliography à la gbt7714
% \usepackage{gbt7714}
% \bibliographystyle{gbt7714-numerical}

\begin{document}

Here is how \verb`\textquotesingle` is supposed to look: \textquotesingle

The paper\cite{Goursat:CauchyTheorem} is a key to analytic functions.

% bibliography à la gb7714-2015
\printbibliography

% bibliography à la gbt7714
% \bibliography{test}

\end{document}

您可以帮我看看这是怎么一回事吗?谢谢!


我在 Windows 11 Pro Build 22616.100 上使用 TeXLive 2022,安装了所有的包,并且已使用 tlmgr update --reinstall-forcibly-removed --all --self 更新了所有能更新的包。

zepinglee commented 2 years ago

\textquotesingle 被转为了别的字符。

西文印刷品中的撇号 apostrophe 几乎都用弯的形式,只有在打字机或者相关的内容中才会用直的形式。在我看来,示例中使用弯的撇号是正确的用法,使用 \textquotesingle 命令有些多余。

Screen Shot 2022-05-11 at 07 35 08

参考:

  1. https://doi.org/10.1090/S0002-9947-1900-1500519-7 的标题中“d’après”是弯的;
  2. 原始论文中的撇好也是弯的:https://www.ams.org/journals/tran/1900-001-01/S0002-9947-1900-1500519-7/S0002-9947-1900-1500519-7.pdf Screen Shot 2022-05-11 at 07 37 10

biber 应该是将内容转成了 Unicode 再处理的,bibtex 不能很好地直接处理扩展拉丁字符,需要将姓名写成 {Goursat, {\'E}douard} 的形式。

septsea commented 2 years ago

@zepinglee 感谢您的回复。事实上,我并非一开始就想用奇怪的 \textquotesingle 。不过,文档的英语是 BE,用英式拼写,还主要用单引号。不幸地,我就遇到了一对单引号内有撇号的表达。比方说:

`It's nice.'

所以,我就代 's\textquotesingle{}s;这样,就区分了右单引号跟撇号。自然地,为了统一,我就改全文所有的撇号为 \textquotesingle{}。不过,参考文献里的那个撇号就没变。我自己手写撇号也不会是 '。或许,撇号确实应该是弯的,但我就是想问问怎么才能在参考文献里显示直的(这样就能跟正文统一了)。也许这个问题跟 gb7714-2015gbt7714 无关,但是我没在 biblatexbibtex 的文档里找到我想要的。

zepinglee commented 2 years ago

所以,我就代 's\textquotesingle{}s;这样,就区分了右单引号跟撇号。自然地,为了统一,我就改全文所有的撇号为 \textquotesingle{}

据我了解,这种用法在印刷物中不符合英文的习惯,撇号通常跟右单引号在编码上和字形上不作区分。建议咨询 native speaker 确认这个需求的合理性。

hushidong commented 2 years ago

这个问题可以解决,只是看你需不需要了。

具体的思路是:需要修改biber给的字符映射表,可以避免biber将宏转换为utf8编码字符。

具体做法如下:

  1. 找到biber的临时工作路径中的,recode_data.xml (搜索能找到)
  2. 复制一个到其它位置,并定义为,比如c:\recodeudf.xml
  3. 打开该文件,并找到textquotesingle那一项删除,将所有的set修改为special,并保存
  4. 编译的时候:biber这一步使用命令:
    biber testsb3.bcf --recodedata=c:\recodeudf.xml --decodecharsset=special
  5. xelatex编译正常就可以

我是在win下做的,你若是其它系统那么路径修改一下就行。

参考:biber.PDF

\documentclass{ctexart}

\begin{filecontents*}{\jobname.bib}
@article{Goursat:CauchyTheorem,
  title     = {Sur la d\'efinition g\'en\'erale des fonctions analytiques, d{\textquotesingle{}}apr\`es {Cauchy}},
  author    = {Goursat, \'Edouard},
  journal   = {Transactions of the American Mathematical Society},
  volume    = {1},
  number    = {1},
  pages     = {14-16},
  year      = {1900}
}
@BOOK{张伯伟2002--,
  AUTHOR = {张伯伟},
  LOCATION = {南京},
  PUBLISHER = {江苏古籍出版社},
  DATE = {2002-09-01},
  PAGES = {288},
  TITLE = {全唐五代诗格会考},
}
\end{filecontents*}

% bibliography à la gb7714-2015
\usepackage[backend=biber,style=gb7714-2015]{biblatex}
\addbibresource{\jobname.bib}

% bibliography à la gbt7714
% \usepackage{gbt7714}
% \bibliographystyle{gbt7714-numerical}

\begin{document}

Here is how \verb`\textquotesingle` is supposed to look: \textquotesingle

The paper\cite{Goursat:CauchyTheorem} is a key to analytic functions.\cite{张伯伟2002--}

% bibliography à la gb7714-2015
\printbibliography

% bibliography à la gbt7714
% \bibliography{test}

\end{document} 

biber 编译后bbl为:

% $ biblatex auxiliary file $
% $ biblatex bbl format version 3.2 $
% Do not modify the above lines!
%
% This is an auxiliary file used by the 'biblatex' package.
% This file may safely be deleted. It will be recreated by
% biber as required.
%
\begingroup
\makeatletter
\@ifundefined{ver@biblatex.sty}
  {\@latex@error
     {Missing 'biblatex' package}
     {The bibliography requires the 'biblatex' package.}
      \aftergroup\endinput}
  {}
\endgroup

\refsection{0}
  \datalist[entry]{none/global//global/global}
    \entry{Goursat:CauchyTheorem}{article}{}
      \name{author}{1}{}{%
        {{hash=5f6df81c181ccb84998fe83a278d722d}{%
           family={Goursat},
           familyi={G\bibinitperiod},
           given={Édouard},
           giveni={É\bibinitperiod}}}%
      }
      \name{namea}{1}{}{%
        {{hash=5f6df81c181ccb84998fe83a278d722d}{%
           family={Goursat},
           familyi={G\bibinitperiod},
           given={Édouard},
           giveni={É\bibinitperiod}}}%
      }
      \list{language}{1}{%
        {english}%
      }
      \strng{namehash}{5f6df81c181ccb84998fe83a278d722d}
      \strng{fullhash}{5f6df81c181ccb84998fe83a278d722d}
      \strng{bibnamehash}{5f6df81c181ccb84998fe83a278d722d}
      \strng{authorbibnamehash}{5f6df81c181ccb84998fe83a278d722d}
      \strng{authornamehash}{5f6df81c181ccb84998fe83a278d722d}
      \strng{authorfullhash}{5f6df81c181ccb84998fe83a278d722d}
      \strng{nameabibnamehash}{5f6df81c181ccb84998fe83a278d722d}
      \strng{nameanamehash}{5f6df81c181ccb84998fe83a278d722d}
      \strng{nameafullhash}{5f6df81c181ccb84998fe83a278d722d}
      \field{sortinit}{1}
      \field{sortinithash}{4f6aaa89bab872aa0999fec09ff8e98a}
      \field{labelnamesource}{author}
      \field{labeltitlesource}{title}
      \field{journaltitle}{Transactions of the American Mathematical Society}
      \field{langid}{english}
      \field{languageid}{english}
      \field{lansortorder}{4}
      \field{number}{1}
      \field{title}{Sur la définition générale des fonctions analytiques, d{\textquotesingle{}}après {Cauchy}}
      \field{usera}{J}
      \field{userd}{english}
      \field{userf}{english}
      \field{volume}{1}
      \field{year}{1900}
      \field{dateera}{ce}
      \field{pages}{14\bibrangedash 16}
      \range{pages}{3}
      \keyw{Goursat:CauchyTheorem}
    \endentry
    \entry{张伯伟2002--}{book}{}
      \name{author}{1}{}{%
        {{hash=c79f4f4abda79329aeccf1d7b3ca2106}{%
           family={张伯伟},
           familyi={张\bibinitperiod}}}%
      }
      \name{namea}{1}{}{%
        {{hash=c79f4f4abda79329aeccf1d7b3ca2106}{%
           family={张伯伟},
           familyi={张\bibinitperiod}}}%
      }
      \list{language}{1}{%
        {chinese}%
      }
      \list{location}{1}{%
        {南京}%
      }
      \list{publisher}{1}{%
        {江苏古籍出版社}%
      }
      \strng{namehash}{c79f4f4abda79329aeccf1d7b3ca2106}
      \strng{fullhash}{c79f4f4abda79329aeccf1d7b3ca2106}
      \strng{bibnamehash}{c79f4f4abda79329aeccf1d7b3ca2106}
      \strng{authorbibnamehash}{c79f4f4abda79329aeccf1d7b3ca2106}
      \strng{authornamehash}{c79f4f4abda79329aeccf1d7b3ca2106}
      \strng{authorfullhash}{c79f4f4abda79329aeccf1d7b3ca2106}
      \strng{nameabibnamehash}{c79f4f4abda79329aeccf1d7b3ca2106}
      \strng{nameanamehash}{c79f4f4abda79329aeccf1d7b3ca2106}
      \strng{nameafullhash}{c79f4f4abda79329aeccf1d7b3ca2106}
      \field{sortinit}{2}
      \field{sortinithash}{8b555b3791beccb63322c22f3320aa9a}
      \field{labelnamesource}{author}
      \field{labeltitlesource}{title}
      \field{day}{1}
      \field{langid}{english}
      \field{languageid}{chinese}
      \field{lansortorder}{1}
      \field{month}{9}
      \field{title}{全唐五代诗格会考}
      \field{usera}{M}
      \field{userd}{chinese}
      \field{userf}{chinese}
      \field{year}{2002}
      \field{dateera}{ce}
      \field{pages}{288}
      \range{pages}{1}
      \keyw{张伯伟2002--}
    \endentry
  \enddatalist
\endrefsection
\endinput

自然结果为: 图片

septsea commented 2 years ago

感谢各位的评论。

经过讨论后,我跟其他人决定不区分撇号跟单引号。

毕竟,虽然我能成功地编出带 \textquotesingle 的参考文献,但身边的其他人显然还都只会用(早已被配置好的) TeXstudio;有的人甚至不懂什么叫“终端”。

这也算是解决了问题。