使用软件包词汇表的两个单独的缩写列表

使用软件包词汇表的两个单独的缩写列表

我想创建两个单独的首字母缩略词列表。一个有 3 列,另一个有 4 列。我为两种类型的首字母缩略词列表定义了两种样式,style1style2

我有我的缩写文件INP-00-glossary.texINP-01-glossary.tex

如何在不同的页面上打印两个不同的首字母缩略词列表?

编辑:

我需要的两个列表如下:列表 1:(我称之为命名法)此列表包含我使用过的所有数学符号。例如

**Nomenclature** 
**Symbol     Description     Units       First used on Page No.** 

T            Temperature      K                    5

我有第二个列表,如下所示

**Abbreviations** 
**Term     Description                First used on Page No.** 

MD          molecular dynamics                       7

我已将命名法定义为 \acronym。例如

\newacronym[user1={K}]{T}{\textit{T}}{temperature} 

我将缩写定义为词汇表。例如

\newglossaryentry{md}
{
  name={MD},
  description={molecular dynamics},
}

现在当我引用\gls{T}. 时,它会在第一次出现时展开并将符号 T 放在括号中。但是当我引用 时\gls{md},它只会写 MD。我希望它像我创建的第一个列表一样,括号中既有扩展名,也有缩写。

所以我希望将这两个列表都定义为首字母缩略词。

梅威瑟:

\documentclass[12pt,a4paper]{article}




%hyperlink
%\usepackage[backref=page]{hyperref}
\usepackage{hyperref}
\hypersetup{
    bookmarks=true,         % show bookmarks bar?
    unicode=false,          % non-Latin characters in Acrobat’s bookmarks
    pdftoolbar=true,        % show Acrobat’s toolbar?
    pdfmenubar=true,        % show Acrobat’s menu?
    pdffitwindow=false,     % window fit to page when opened
    pdfstartview={FitH},    % fits the width of the page to the window
    pdftitle={My title},    % title
    pdfauthor={Author},     % author
    pdfsubject={Subject},   % subject of the document
    pdfcreator={Creator},   % creator of the document
    pdfproducer={Producer}, % producer of the document
    pdfkeywords={keyword1} {key2} {key3}, % list of keywords
    pdfnewwindow=true,      % links in new window
    colorlinks=true,       % false: boxed links; true: colored links
    linkcolor=red,          % color of internal links
    citecolor=blue,        % color of links to bibliography
    filecolor=magenta,      % color of file links
    urlcolor=cyan           % color of external links
}


\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{enumerate}


\usepackage{tocloft}% deal with Tables of Con­tents
\usepackage[T1]{fontenc} %font encoding
\usepackage{lmodern} % better font
\usepackage{lipsum,appendix}
\usepackage{booktabs}%beautiful table
\usepackage{siunitx} %angstrom use: \si{\angstrom}
\usepackage{setspace}%one and half space
\usepackage[english]{babel}
\usepackage[round]{natbib}
\usepackage{upgreek}
\usepackage{pdflscape} %landscape page
\usepackage{mhchem} %left superscript subscipt
\usepackage{float}%exact location
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption} % for subfigures




%glossaries and acronym
\usepackage[acronym,xindy,toc,numberline,indexonlyfirst, nomain]{glossaries}


\newglossary[nlg]{nomenc}{not}{ntn}{Nomenclature}
\newglossary[slg]{abbrev}{sot}{stn}{Abbreviations}



%custom glossary style
\newglossarystyle{long6col}{%
% put the glossary in a longtable environment:
\renewenvironment{theglossary}%
{\begin{longtable}{lp{\glsdescwidth}cccp{\glspagelistwidth}}}%
{\end{longtable}}%
% Set the table’s header:
\renewcommand
*
{\glossaryheader}{%
\bfseries Symbol & \bfseries Description & &
\bfseries Units & & \bfseries Page List
\\\endhead}%
% No heading between groups:
\renewcommand
*
{\glsgroupheading}[1]{}%
% Main (level 0) entries displayed in a row optionally numbered:
\renewcommand
*
{\glossaryentryfield}[5]{%
\glsentryitem{##1}% Entry number if required
\glstarget{##1}{##2}% Name
& ##3% Description
& ##4% Symbol
& \glsentryuseri{##1}% Units
& \glsentryuserii{##1}% Dimensions
& ##5% Page list
\\% end of row
}%
% Similarly for sub-entries (no sub-entry numbers):
\renewcommand
*
{\glossarysubentryfield}[6]{%
% ignoring first argument (sub-level)
\glstarget{##2}{##3}% Name
& ##4% Description
& ##5% Symbol
& \glsentryuseri{##2}% Units
& \glsentryuserii{##2}% Dimensions
& ##6% Page list
\\% end of row
}%
% Nothing between groups:
\renewcommand
*
{\glsgroupskip}{}%
}
%END: custom glossary style



%custom glossary1 style
\newglossarystyle{long6col1}{%
% put the glossary in a longtable environment:
\renewenvironment{theglossary}%
{\begin{longtable}{lp{\glsdescwidth}cccp{\glspagelistwidth}}}%
{\end{longtable}}%
% Set the table’s header:
\renewcommand
*
{\glossaryheader}{%
\bfseries Term & \bfseries Description & &
 & & \bfseries Page List
\\\endhead}%
% No heading between groups:
\renewcommand
*
{\glsgroupheading}[1]{}%
% Main (level 0) entries displayed in a row optionally numbered:
\renewcommand
*
{\glossaryentryfield}[5]{%
\glsentryitem{##1}% Entry number if required
\glstarget{##1}{##2}% Name
& ##3% Description
& ##4% Symbol
& \glsentryuseri{##1}% Units
& \glsentryuserii{##1}% Dimensions
& ##5% Page list
\\% end of row
}%
% Similarly for sub-entries (no sub-entry numbers):
\renewcommand
*
{\glossarysubentryfield}[6]{%
% ignoring first argument (sub-level)
\glstarget{##2}{##3}% Name
& ##4% Description
& ##5% Symbol
& \glsentryuseri{##2}% Units
& \glsentryuserii{##2}% Dimensions
& ##6% Page list
\\% end of row
}%
% Nothing between groups:
\renewcommand
*
{\glsgroupskip}{}%
}
%END: custom glossary style





%START hyperlink glossaries of 2nd instance onward off
\usepackage{etoolbox}
\makeatletter
%% patch first occurence of "\@gls@link[#1]{#2}{\@glo@text}", as this is the one for \glsused{#2}
\patchcmd{\@gls@}
  {\@gls@link[#1]{#2}{\@glo@text}}
  {\@gls@link[#1,hyper=false]{#2}{\@glo@text}}
  {}{}


\patchcmd{\@Gls@}
  {\@gls@link[#1]{#2}}
  {\@gls@link[#1,hyper=false]{#2}}
  {}{}

\patchcmd{\@GLS@}
  {\@gls@link[#1]{#2}{\MakeUppercase{\@glo@text}}}
  {\@gls@link[#1,hyper=false]{#2}{\MakeUppercase{\@glo@text}}}
  {}{}
\makeatother
%END hyperlink glossaries of 2nd instance onward off




\renewcommand*{\glspostdescription}{}%removes dot at end
\glssetwidest{AAAAAAA}% widest name
\renewcommand*{\glsnamefont}[1]{\textmd{#1}}



\makeglossaries

%\loadglsentries[nomenc]{INP-00-glossary}
\let\oldacronymtype\acronymtype
\def\acronymtype{nomenc}
\loadglsentries[nomenc]{INP-00-glossary}
\let\acronymtype\oldacronymtype

\loadglsentries[abbrev]{INP-01-glossary}


%table header multiline START
\newcommand{\specialcell}[2][c]{%
  \begin{tabular}[#1]{@{}c@{}}#2\end{tabular}}
%table header multiline END


\usepackage[showframe=false]{geometry}
\geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1.5in,rmargin=1in}


\renewcommand*\appendixpagename{Appendix}
\renewcommand*\appendixtocname{Appendix}

\renewcommand*{\acronymname}{Nomenclature}%
\renewcommand*{\pagelistname}{First used on page no.}%
%\renewcommand*{\glossaryname}{Abbreviations}
\usepackage{longtable}%for example, manual nomenclature






\begin{document}

%\maketitle
\pagenumbering{alph}
\renewcommand*{\glossaryname}{Abbreviations}



\begin{titlepage}
\begin{center}
\linespread{1}
\Huge\bf{\uppercase{ The Title Page}}\\




\end{center}
\end{titlepage}







\pagenumbering{roman}

\newpage
\onehalfspace
\tableofcontents
\newpage

%list of tables
\phantomsection \label{listoftab}
\addcontentsline{toc}{section}{List of Tables}
\listoftables
\newpage


%list of figures
\phantomsection \label{listoffig}
\addcontentsline{toc}{section}{List of Figures}
\listoffigures
\newpage



\glsaddall

\printglossary[style=long6col,type=nomenc]
\newpage
\printglossary[style=long6col1,type=abbrev]




%\setcounter{page}{3}
\newpage


\setcounter{secnumdepth}{0}
%\include{nomeclature_manual}
%\include{abbreviations}
\setcounter{secnumdepth}{4}
\pagenumbering{arabic}
\include{textbody}



\end{document}

INP-00-glossary.tex 的内容

\newacronym[user1={$\AA$}]{a}{\textit{a}}{lattice constant}
\newacronym[user1={$K^{-1}$}]{alphat}{$\alpha_T$}{linear thermal expansion coefficient}

INP-01-glossary.tex 的内容

\newglossaryentry{MC}
{
  name={MC},
  description={Monte Carlo},
  first={\glsentrydesc{MC} (\glsentrytext{MC})}
}
\newglossaryentry{MD}
{
  name={MD},
  description={molecular dynamics},
  first={\glsentrydesc{MD} (\glsentrytext{MD})}
}

textbody.tex 的内容

\section{My First Section}

text first page \gls{MD}
\newpage
text second page \gls{a}
\newpage
text third page \gls{alphat}
\newpage
text fourth page \gls{MC}

词汇表样式的名称

long6collong6col1

答案1

这是正确的方法。

\glsaddall只是添加了列表中的所有条目。

\documentclass{article}

\usepackage{glossaries}

\newglossary[nlg]{nomenc}{not}{ntn}{Nomenclature}
\newglossary[slg]{abbrev}{sot}{stn}{Abbreviations}

% Your custom styles here
% \newglossarystyle{style1}{.....}
% \newglossarystyle{style2}{.....}

\makeglossaries

\loadglsentries[nomenc]{INP-00-glossary}
\loadglsentries[abbrev]{INP-01-glossary}

\begin{document}

\glsaddall

\printglossary[style=style1,type=nomenc]
\printglossary[style=style2,type=abbrev]

\end{document}

编辑

如果您需要glossaries使用选项加载包acronym

\usepackage[acronym]{glossaries}

然后你可以使用这个解决方法将首字母缩略词加载到数据库中:用以下行替换

\loadglsentries[nomenc]{INP-00-glossary}

\let\oldacronymtype\acronymtype
\def\acronymtype{nomenc}
\loadglsentries[nomenc]{INP-00-glossary}
\let\acronymtype\oldacronymtype

编辑2

要解决您的问题\gls{md},您应该定义first键,它决定了第一次使用时如何打印词汇表条目(对于首字母缩略词是自动的,但对于常见的词汇表条目则不是)。

这意味着您必须将您的条目重写为:

\newglossaryentry{md}
{
  name={MD},
  description={molecular dynamics},
  first={\glsentrydesc{md} (\glsentrytext{md})}
}

相关内容