Acro 版本 3.2

Acro 版本 3.2

我正在用 acro 包编写一份文档,列出首字母缩略词和术语。我在文件中定义了缩写Abbrev.tex,在文件中定义了术语Nomen.tex。我使用导入这些文件\input。是否可以在两个文件中为定义的首字母缩略词设置不同的样式?我尝试了以下方法,但没有效果。

\documentclass[12pt,twoside,openright]{book}

\usepackage{acro} %list of abbreviations
\acsetup{first-style=long-short,list/display = used}
\input{Abbrev.tex} %define abbreviations in this file.
\acsetup{first-style=short,list/display = used}
\input{Nomen.tex} %define nomenclature in this file.

\begin{document}
\ac{afm} is a good technique.
\newline
\ac{L} is used in the calculation.
\end{document}

缩写

\DeclareAcronym{afm}{ 
    short = {AFM}, 
    long  = {Atomic Force Microscopy},
    tag = {abbrev}
}
\DeclareAcronym{ofet}{
    short = {OFET},
    long  = {Organic field effect transistor},
    tag = {abbrev}
}

诺门特克斯

\DeclareAcronym{A}{ 
    short = {A}, 
    long  = {Area},
    tag = {nomen}
}
\DeclareAcronym{L}{
    short = {L},
    long  = {Length of channel},
    tag = {nomen}
}

答案1

Acro 版本 3.2

下面是使用 acro 版本 3.2 的示例。我添加了几个选项,以便您可以看到它acro的功能:

\documentclass[12pt]{article}

\usepackage[version=3]{acro} %list of abbreviations
\acsetup{
    first-style = long,
    list/display = used,
    pages/display = first
}

\DeclareAcronym{afm}{ 
    short = {AFM}, 
    long  = {Atomic Force Microscopy},
    tag = {abbrev},
}
\DeclareAcronym{ofet}{
    short = {OFET},
    long  = {Organic field effect transistor},
    tag = {abbrev},
}

\DeclareAcronym{A}{ 
    short = {A}, 
    long  = {Area},
    tag = {nomen},
    first-style = short,
}
\DeclareAcronym{L}{
    short = {L},
    long  = {Length of channel},
    tag = {nomen},
    first-style = short,
}

\begin{document}

\section{Some of my best Abbreviations}

\ac{afm} is a good technique.
\newline
\ac{L} is used in the calculation.

\printacronyms[name=Abbreviations, include=abbrev, heading=section*]
\printacronyms[name=Nomenclature, include=nomen]

\end{document}

acro v3.2

Acro 版本 2.1

在与 acro v3 斗争之后,我发现我的 TeX 发行版不是最新的,只附带 acro v. 2.10。你一定要先检查一下你正在运行的是哪个版本。

对于 2.1 版本,你可以这样做:

\documentclass[12pt,twoside,openright]{book}

\usepackage{acro} %list of abbreviations

\DeclareAcronym{afm}{ 
    short = {AFM}, 
    long  = {Atomic Force Microscopy},
    class = {abbrev},
    first-style = long,
}
\DeclareAcronym{ofet}{
    short = {OFET},
    long  = {Organic field effect transistor},
    class = {abbrev},
    first-style = long,
}

\DeclareAcronym{A}{ 
    short = {A}, 
    long  = {Area},
    class = {nomen},
    first-style = short,
}
\DeclareAcronym{L}{
    short = {L},
    long  = {Length of channel},
    class = {nomen},
    first-style = short,
}

\begin{document}

\chapter{Some of my best Abbreviations}

\ac{afm} is a good technique.
\newline
\ac{L} is used in the calculation.

\printacronyms[include-classes=abbrev,name=Abbreviations]
\printacronyms[include-classes=nomen,name=Nomenclature]

\end{document}

缩写

答案2

将我的评论扩展为答案:

如果“不同的样式”是指不同的first-styles,那么您的 MWE 将无法工作。第一种样式是在第一次使用首字母缩略词时确定的在文中使用不是在定义时在序言中。您可以做的是将 分配first-style给首字母缩略词本身(如shortlong属性)。结合自定义宏,这可能是一种有效定义具有两种不同首字母样式的首字母缩略词类别的方法:

\documentclass{article}
\usepackage{acro}

\NewDocumentCommand\NewAbbrev{mm}{%
  \DeclareAcronym{#1}{
    #2,
    first-style=long-short,
    tag=abbrev
  }%
}
\NewDocumentCommand\NewNomen{mm}{%
  \DeclareAcronym{#1}{
    #2,
    first-style=short,
    tag=nomen
  }%
}

\NewAbbrev{afm}{ 
  short = AFM , 
  long  = Atomic Force Microscopy
}
\NewAbbrev{ofet}{
  short = OFET ,
  long  = Organic field effect transistor
}
\NewNomen{A}{ 
  short = $A$ ,
  long  = Area
}
\NewNomen{L}{
  short = $L$ ,
  long  = Length of channel
}

\acsetup{list/display = used}

\begin{document}

\ac{afm} is a good technique. \par
\ac{L} is used in the calculation.

\printacronyms[name=Abbreviations, include=abbrev]
\printacronyms[name=Nomenclature, include=nomen]

\end{document}

在此处输入图片描述

相关内容