![使用 \hapto 且后面不带连字符来表示一个 .bib 条目](https://linux22.com/image/333743/%E4%BD%BF%E7%94%A8%20%5Chapto%20%E4%B8%94%E5%90%8E%E9%9D%A2%E4%B8%8D%E5%B8%A6%E8%BF%9E%E5%AD%97%E7%AC%A6%E6%9D%A5%E8%A1%A8%E7%A4%BA%E4%B8%80%E4%B8%AA%20.bib%20%E6%9D%A1%E7%9B%AE.png)
我正在使用achemso
、chemmacros
和chemformula
来格式化论文。我使用coord-use-hyphen = true
中的选项编写了整个chemmacros
文档。但是,现在我遇到了一篇论文,它不适用,我想知道我是否必须重新做所有其他 .bib 条目。
最简单的方法似乎是创建一个\haptonohypen{}
类似的命令\hapto{}
,但无论coord-use-hyphen
设置为何,它都不会生成连字符?
另一种方法是,如果我可以设置\iupac
一个条目的选项(类似于\iupac[coord-use-hyphen=true]{stuff here}
,但我不知道是否可能(我尝试过仅指定上述内容)。
下面是一个 MWE,其中包含我对其他 79 个 .bib 条目使用的选项:
\documentclass[journal=cgdefu]{achemso}
\AtBeginDocument{\let\latin\relax} %So chemarcos works woth achemso
\usepackage{chemmacros}
\chemsetup{
formula=chemformula, %use chemformula instead of say, mhchem
nomenclature/coord-use-hyphen=true, %Puts hypens after bridging and hapto
}
\begin{filecontents}{MWE.bib}
@article{Masci2005,
author = {Masci, Bernardo and Thu\'{e}ry, Pierre},
doi = {10.1016/j.poly.2004.11.002},
journal = {Polyhedron},
number = {2},
pages = {229--237},
title = {{Uranyl complexes with the pyridine-2,6-dicarboxylato ligand: new dinuclear species with \iupac{\bridge{}\hapto{2},\hapto{2}peroxide}, \iupac{\bridge{2}hydroxide} or \iupac{\bridge{2}methoxide bridges}}},
volume = {24},
year = {2005}
}
\end{filecontents}
\title{MWE}
\author{Canageek}
\affiliation{TeX.SX}
\email{Canageek}
\date{}
\begin{document}
This is a test text.\cite{Masci2005}
\bibliography{MWE}
\end{document}
答案1
从 v5.7 (2016/06/07) 开始(或者由于一些拼写错误而从 v5.7a 开始)chemmacros
使用函数
\chemmacros_coordination_symbol:nnnn
用于定义协调符号。通过它,可以轻松定义一个永远不会输出以下破折号的适合宏。
此外,从 v5.7 开始\iupac
有一个用于设置选项的可选参数,在这种情况下甚至可能是更好的选择:
\documentclass{article}
\usepackage{chemmacros}[2016/06/08] % v5.7a
\chemsetup{
formula = chemformula
}
\ExplSyntaxOn
\cs_new_protected:Npn \chemmacros_hapto_nohyp:n #1
{
\chemmacros_coordination_symbol:nnnn
{ \c_false_bool } % boolean: use hyphen or don't
{ \c_false_bool } % boolean: use superscript (true) or subscript (false)
{ \chemeta } % symbol
{#1} % sub-/superscript
}
\NewChemIUPAC \haptoNH { \chemmacros_hapto_nohyp:n }
\ExplSyntaxOff
\begin{document}
\hapto{2} \par
Option one: \haptoNH{2} \par
Option two: \iupac[coord-use-hyphen=false]{\hapto{2}}
\end{document}
答案2
您可以定义一个\haptonohyphen
命令:
\documentclass[journal=cgdefu]{achemso}
\AtBeginDocument{\let\latin\relax} %So chemarcos works woth achemso
\usepackage{chemmacros}
\chemsetup{
formula=chemformula, %use chemformula instead of say, mhchem
nomenclature/coord-use-hyphen=true, %Puts hypens after bridging and hapto
}
\ExplSyntaxOn
\NewChemIUPAC \haptonohyphen { \chemformula_hapto_nohyphen:n }
\cs_new_protected:Npn \chemformula_hapto_nohyphen:n #1
{
\chemeta \chemformula_superscript:n { #1 }
}
\ExplSyntaxOff
\begin{filecontents}{\jobname.bib}
@article{Masci2005,
author = {Masci, Bernardo and Thu\'{e}ry, Pierre},
doi = {10.1016/j.poly.2004.11.002},
journal = {Polyhedron},
number = {2},
pages = {229--237},
title = {{Uranyl complexes with the pyridine-2,6-dicarboxylato ligand:
new dinuclear species with \iupac{\bridge{}\haptonohyphen{2},\hapto{2}peroxide},
\iupac{\bridge{2}hydroxide} or \iupac{\bridge{2}methoxide bridges}}},
volume = {24},
year = {2005}
}
\end{filecontents}
\title{MWE}
\author{Canageek}
\affiliation{TeX.SX}
\email{Canageek}
\date{}
\begin{document}
This is a test text.\cite{Masci2005}
Uranyl complexes with the pyridine-2,6-dicarboxylato
ligand: new dinuclear species with \iupac{\bridge{}\haptonohyphen{2},\hapto{2}peroxide},
\iupac{\bridge{2}hydroxide} or \iupac{\bridge{2}methoxide bridges},
\bibliography{\jobname}
\end{document}