![Glossários: Abreviaturas que não aparecem a partir do 2º uso](https://rvso.com/image/286968/Gloss%C3%A1rios%3A%20Abreviaturas%20que%20n%C3%A3o%20aparecem%20a%20partir%20do%202%C2%BA%20uso.png)
Quero dois glossários: 1) Nomenclatura 2) Abreviações
Na nomenclatura são quatro colunas e nas abreviações são três.
Tudo está funcionando bem, exceto que as abreviações não aparecem a partir do segundo uso.
Qual é o problema no código que estou usando?
Arquivo de nomenclatura: INP-00-glossary.tex
contente:
\newacronym[user1={K}]{T}{\textit{T}}{temperature}
Arquivo de abreviações: INP-01-glossary.tex
Contente:
\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}
Responder1
A maneira mais fácil de corrigir esse problema é remover alguma complexidade desnecessária.
Primeiro, altere seu INP-01-glossary.tex para:
\newacronym{MC}{MC}{Monte Carlo}
Agora, o \newacronym
does usa \newglossaryentry
em segundo plano e você pode usar \newglossaryentry
para fazer isso, mas como suas abreviações são essencialmente siglas, eu simplesmente usaria \newacronym
.
Segundo, remova algum código começando com sua redefinição de \gls
. Essa é esta parte:
\let\oldgls\gls
\renewcommand{\gls}[1]{%
\ifglsused{#1}%
{\oldgls{#1}}%
{\glsentrylong{#1}}%
}
\gls
funciona da maneira que você deseja e permitirá que você use outras macros do glossário sem quaisquer inconsistências.
Além disso, você pode remover suas \acronymtype
modificações fazendo esta parte:
\let\oldacronymtype\acronymtype
\def\acronymtype{nomenc}
\loadglsentries[nomenc]{INP-00-glossary}
\let\acronymtype\oldacronymtype
simplesmente:
\loadglsentries[nomenc]{INP-00-glossary}
Com esta mudança você também precisa remover a acronym
opção das opções do pacote glossários ou quando você executar makeglossaries você receberá um erro.
Tudo combinado, o MWE para o seu documento agora é:
\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}
Produção (para a 3ª página):