Glosarios: Abreviaturas que no aparecen a partir del 2º uso

Glosarios: Abreviaturas que no aparecen a partir del 2º uso

Quiero dos glosarios: 1) Nomenclatura 2) Abreviaturas

En nomenclatura hay cuatro columnas y en abreviaturas tres.

Todo funciona bien, excepto que las abreviaturas no aparecen a partir del segundo uso.

¿Cuál es el problema en el código que estoy usando?

Archivo de nomenclatura: INP-00-glossary.tex

contenido:

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

Archivo de abreviaturas: INP-01-glossary.tex

Contenido:

\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}

Respuesta1

La forma más sencilla de solucionar este problema es eliminar algunas complejidades innecesarias.

Primero, cambie su INP-01-glossary.tex a:

\newacronym{MC}{MC}{Monte Carlo}

Ahora \newacronymse usa \newglossaryentryen segundo plano y puedes usarlo \newglossaryentrypara hacer esto, pero como tus abreviaturas son esencialmente acrónimos, yo simplemente usaría \newacronym.

En segundo lugar, elimine parte del código que comienza con su redefinición de \gls. Esa es esta parte:

\let\oldgls\gls
\renewcommand{\gls}[1]{%
  \ifglsused{#1}%
    {\oldgls{#1}}%
    {\glsentrylong{#1}}%
}

\glstambién funciona como usted lo desea y le permitirá utilizar otras macros de glosario sin inconsistencias.

Además, puedes eliminar tus \acronymtypemodificaciones haciendo esta parte:

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

simplemente:

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

Con este cambio también necesita eliminar la acronymopción de las opciones del paquete de glosarios o cuando ejecute makeglossaries obtendrá un error.


Todo el MWE combinado para su documento ahora es:

\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}

Produciendo (para la tercera página):

salida mwe

información relacionada