![용어집: 두 번째 사용 이후에는 약어가 나타나지 않습니다.](https://rvso.com/image/286968/%EC%9A%A9%EC%96%B4%EC%A7%91%3A%20%EB%91%90%20%EB%B2%88%EC%A7%B8%20%EC%82%AC%EC%9A%A9%20%EC%9D%B4%ED%9B%84%EC%97%90%EB%8A%94%20%EC%95%BD%EC%96%B4%EA%B0%80%20%EB%82%98%ED%83%80%EB%82%98%EC%A7%80%20%EC%95%8A%EC%8A%B5%EB%8B%88%EB%8B%A4..png)
나는 두 개의 용어집을 원합니다: 1) 명명법 2) 약어
명명법에는 4개의 열이 있고 약어에는 3개의 열이 있습니다.
두 번째 사용부터 약어가 나타나지 않는 것을 제외하면 모든 것이 잘 작동합니다.
내가 사용하고 있는 코드에 어떤 문제가 있나요?
명명법 파일: INP-00-glossary.tex
콘텐츠:
\newacronym[user1={K}]{T}{\textit{T}}{temperature}
약어 파일: INP-01-glossary.tex
콘텐츠:
\newglossaryentry{MC}
{
name={MC},
description={Monte Carlo},
first={\glsentrydesc{MC} (\glsentrytext{MC})}
}
MWE:
\documentclass[12pt,a4paper,times]{report}
\usepackage{hhline}%double line in table
\usepackage{lipsum,appendix}
%\usepackage[backref=page]{hyperref}%creates a reference with additional text corresponding to the target's type
\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=black, % red,color of internal links
citecolor=black, % color of links to bibliography
filecolor=black, % color of file links
urlcolor=black, % color of external links
anchorcolor=black
}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
%glossaries and acronym
\usepackage[acronym,xindy,sanitize=none,sort=def,toc,
numberline,indexonlyfirst,nomain]{glossaries} %nomain, if you define glossaries in a file, and you use \include{INP-00-glossary}
\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 Term & \bfseries Description & \bfseries Symbol &
\bfseries Units & \bfseries Dimensions & \bfseries Page List
\\\endhead}%
% No heading between groups:
\renewcommand*{\glsgroupheading}[1]{}%
% Main (level 0) entries displayed in a row optionally numbered:
\renewcommand*{\glossentry}[2]{%
\glsentryitem{##1}% Entry number if required
\glstarget{##1}{\glossentryname{##1}}% Name
& \glossentrydesc{##1}% Description
& \glossentrysymbol{##1}% Symbol
& \glsentryuseri{##1}% Units
& \glsentryuserii{##1}% Dimensions
& ##2% Page list
\tabularnewline % end of row
}%
% Similarly for sub-entries (no sub-entry numbers):
\renewcommand*{\subglossentry}[3]{%
% ignoring first argument (sub-level)
\glstarget{##2}{\glossentryname{##2}}% Name
& \glossentrydesc{##2}% Description
& \glossentrysymbol{##2}% Symbol
& \glsentryuseri{##2}% Units
& \glsentryuserii{##2}% Dimensions
& ##3% Page list
\tabularnewline % 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}{}%
}
%
\let\oldgls\gls
\renewcommand{\gls}[1]{%
\ifglsused{#1}%
{\glsentrylong{#1}}%
{\oldgls{#1}}%
}
%END: custom glossary style
\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}
\begin{document}
%\maketitle
\printglossary[style=long6col,type=nomenc]
\newpage
\printglossary[style=long6col1,type=abbrev]
\newpage
\gls{MC} used. another \gls{MC}
\gls{T} used , another \gls{T}
\end{document}
답변1
이 문제를 해결하는 가장 쉬운 방법은 불필요한 복잡성을 제거하는 것입니다.
먼저 INP-01-glossary.tex를 다음으로 변경합니다.
\newacronym{MC}{MC}{Monte Carlo}
이제 는 백그라운드에서 \newacronym
사용되며 이 작업을 수행하는 데 사용할 수 있지만 약어는 기본적으로 두문자어이므로 간단히 .\newglossaryentry
\newglossaryentry
\newacronym
둘째, 의 재정의로 시작하는 일부 코드를 제거합니다 \gls
. 바로 이 부분입니다:
\let\oldgls\gls
\renewcommand{\gls}[1]{%
\ifglsused{#1}%
{\oldgls{#1}}%
{\glsentrylong{#1}}%
}
\gls
원하는 방식으로 작동하며 불일치 없이 다른 용어집 매크로를 사용할 수 있습니다.
또한 \acronymtype
이 부분을 수정하여 제거할 수 있습니다.
\let\oldacronymtype\acronymtype
\def\acronymtype{nomenc}
\loadglsentries[nomenc]{INP-00-glossary}
\let\acronymtype\oldacronymtype
간단히:
\loadglsentries[nomenc]{INP-00-glossary}
이 변경으로 인해 용어집 패키지 옵션에서도 해당 옵션을 제거해야 합니다. acronym
그렇지 않으면 makeglossaries를 실행할 때 오류가 발생합니다.
귀하의 문서에 대해 결합된 모든 MWE는 이제 다음과 같습니다.
\documentclass[12pt,a4paper,times]{report}
\usepackage{hhline}%double line in table
\usepackage{lipsum,appendix}
\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=black, % red,color of internal links
citecolor=black, % color of links to bibliography
filecolor=black, % color of file links
urlcolor=black, % color of external links
anchorcolor=black
}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage[xindy,sanitize=none,sort=def,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 Term & \bfseries Description & \bfseries Symbol &
\bfseries Units & \bfseries Dimensions & \bfseries Page List
\\\endhead}%
% No heading between groups:
\renewcommand*{\glsgroupheading}[1]{}%
% Main (level 0) entries displayed in a row optionally numbered:
\renewcommand*{\glossentry}[2]{%
\glsentryitem{##1}% Entry number if required
\glstarget{##1}{\glossentryname{##1}}% Name
& \glossentrydesc{##1}% Description
& \glossentrysymbol{##1}% Symbol
& \glsentryuseri{##1}% Units
& \glsentryuserii{##1}% Dimensions
& ##2% Page list
\tabularnewline % end of row
}%
% Similarly for sub-entries (no sub-entry numbers):
\renewcommand*{\subglossentry}[3]{%
% ignoring first argument (sub-level)
\glstarget{##2}{\glossentryname{##2}}% Name
& \glossentrydesc{##2}% Description
& \glossentrysymbol{##2}% Symbol
& \glsentryuseri{##2}% Units
& \glsentryuserii{##2}% Dimensions
& ##3% Page list
\tabularnewline % 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
\renewcommand*{\glspostdescription}{}%removes dot at end
\glssetwidest{AAAAAAA}% widest name
\renewcommand*{\glsnamefont}[1]{\textmd{#1}}
\makeglossaries
\loadglsentries[nomenc]{INP-00-glossary}
\loadglsentries[abbrev]{INP-01-glossary}
\begin{document}
%\maketitle
\printglossary[style=long6col,type=nomenc]
\newpage
\printglossary[style=long6col1,type=abbrev]
\newpage
\gls{MC} used. another \gls{MC}
\gls{T} used , another \gls{T}
\end{document}
제작(세 번째 페이지용):