未打印缩写

未打印缩写

通过我在 TexMaker 中编译代码的方式,我没有在 pdf 中得到任何打印的缩写。

在此处输入图片描述

编译:
pdflatex -synctex=1 -interaction=nonstopmode -shell-escape %.tex|bib2gls --group %|bibtex %|pdflatex -synctex=1 -interaction=nonstopmode -shell-escape %.tex|pdflatex -synctex=1 -interaction=nonstopmode -shell-escape %.tex|"C:/Program Files/Adobe/Acrobat DC/Acrobat/Acrobat.exe" %.pdf

我的代码:

\documentclass[
    pdftex,a4paper,11pt,oneside,fleqn,
    bibliography=totoc,listof=totoc,
    headlines=2.1,headsepline,
    numbers=noenddot
]{scrreprt}

%%%----- Schriftart -----------------------------
\usepackage[utf8]{inputenc}     % Texcodierung ansinew
\usepackage[ngerman]{babel}             % deutsche Silbentrennung
\usepackage[T1]{fontenc}                    % T1 Schriften
\usepackage{textcomp}
\usepackage{lmodern}
    
%%%----- PDF Format -----------------------------
\usepackage{float}
\usepackage[pdftex,pdfpagelabels,bookmarks,bookmarksopen,bookmarksnumbered,
    bookmarksopenlevel      = 1,
    pdfstartpage                    = 1,
    pdfstartview                    = FitV, 
    pdfpagelayout                   = SinglePage,
    plainpages                      = false,
    hypertexnames                   = false,
    colorlinks                      = true, 
    linkcolor                           = black,
    citecolor                           = black,
    urlcolor                            = black
]{hyperref}

\usepackage[backend=bibtex]{biblatex}
\usepackage{siunitx}
\usepackage{tabu}

\usepackage[record,% using bib2gls
 abbreviations, % create list of abbreviations
 stylemods={longextra} % load glossary-longextra.sty
]{glossaries-extra}

\GlsXtrLoadResources[
  src={abbreviations},% data in abbreviations.bib
  sort-field={name}, % sort by name field
  sort={letter-nocase}, % case-insensitive letter sort
  type=abbreviations, % put the entries in this glossary
  save-locations=false % no number list required
]

\newglossarystyle{mystyle}{%
\renewenvironment{theglossary}%
 {\begin{longtabu} to \linewidth {p{0.15\linewidth}p{0.85\linewidth}}}%
 {\end{longtabu}}%
\renewcommand*{\glossaryheader}{}%
% indicate what to do at the start of each logical group
\renewcommand*{\glsgroupheading}[1]{}%
\renewcommand*{\glsgroupskip}{}%
\renewcommand*{\glossaryentryfield}[5]{%
\glsentryitem{##1}\glstarget{##1}{##2} 
   %\glstarget{##2}{##2}% Name
    & ##3% Description
    \\% end of row
    }
}

\begin{document}

    \glsaddall
    \renewcommand*{\arraystretch}{1.4}% default is 1
    \printunsrtglossary[type=abbreviations,style=mystyle,title={Abkürzungsverzeichnis}]
    
\end{document}

这是我的abbreviations.bib文件:

@abbreviation{pmsm,
  short = {PMSM},
  long = {Permanentmagnet-Synchronmaschine}
}

@abbreviation{fxlms,
  short = {FxLMS},
  long = {Filtered-$x$-Least-Mean-Squares}
}

@abbreviation{avc,
  short = {AVC},
  long = {Active Vibration Control}
}

@abbreviation{anc,
  short = {ANC},
  long = {Active Noise Cancelling}
}

@abbreviation{fir,
  short = {FIR},
  long = {Finite Impulse Response, dt.: Endliche Impulsantwort}
}

@abbreviation{lms,
  short = {LMS},
  long = {Least-Mean-Squares}
}

@abbreviation{np,
  short = {NP},
  long = {Nordpol}
}

@abbreviation{sp,
  short = {SP},
  long = {S\"udpol}
}

@abbreviation{ipmsm,
  short = {IPMSM},
  long = {Interior Permanent Magnet Synchronous Machine, dt.:Permanentmagnet-Synchronmaschine mit vergrabenen Magneten}
}

@abbreviation{gcd,
  short = {GCD},
  long = {Greatest Common Divisor, dt.: Gr\"osster gemeinsamer Teiler}
}

@abbreviation{lcm,
  short = {LCM},
  long = {Least Common Multiple, dt.: Kleinstes gemeinsames Vielfaches}
}

@abbreviation{emf,
  short = {EMF},
  long = {Electromotive Force, dt.: Elektromotorische Kraft}
}

@abbreviation{fft,
  short = {FFT},
  long = {Fast Fourier Transform, dt.: Schnelle Fourier-Transformation}
}

问题出在哪里?我该怎么办?

答案1

请参阅 glossaries-extra 手册:\glsaddall 和 \glsaddallunused 不适用于 bib2gls。如果您想将所有条目添加到词汇表中,您需要在选项列表中告知 bib2gls。

\GlsXtrLoadResources[
  ...
  selection={all}
]

此外,在 中\newglossarystyle{mystyle}必须定义\glossentry,而不是。我从的代码\glossaryentryfield中复制了 的定义。glossaries-extralongtable

\documentclass[
    pdftex,a4paper,11pt,oneside,fleqn,
    bibliography=totoc,listof=totoc,
    headlines=2.1,headsepline,
    numbers=noenddot
]{scrreprt}

%%%----- Schriftart -----------------------------
\usepackage[utf8]{inputenc}     % Texcodierung ansinew
\usepackage[ngerman]{babel}             % deutsche Silbentrennung
\usepackage[T1]{fontenc}                    % T1 Schriften
\usepackage{textcomp}
\usepackage{lmodern}
    
%%%----- PDF Format -----------------------------
\usepackage{float}
\usepackage[pdftex,pdfpagelabels,bookmarks,bookmarksopen,bookmarksnumbered,
    bookmarksopenlevel      = 1,
    pdfstartpage                    = 1,
    pdfstartview                    = FitV, 
    pdfpagelayout                   = SinglePage,
    plainpages                      = false,
    hypertexnames                   = false,
    colorlinks                      = true, 
    linkcolor                           = black,
    citecolor                           = black,
    urlcolor                            = black
]{hyperref}

\usepackage[backend=bibtex]{biblatex}
\usepackage{siunitx}
\usepackage{tabu}

\usepackage[record,% using bib2gls
 abbreviations, % create list of abbreviations
 stylemods={longextra} % load glossary-longextra.sty
]{glossaries-extra}

\GlsXtrLoadResources[
  src={abbreviations},% data in abbreviations.bib
  sort-field={name}, % sort by name field
  sort={letter-nocase}, % case-insensitive letter sort
  type=abbreviations, % put the entries in this glossary
  save-locations=false, % no number list required
  selection={all}
]

\newglossarystyle{mystyle}{%
\renewenvironment{theglossary}%
 {\begin{longtabu} to \linewidth {p{0.15\linewidth}p{0.85\linewidth}}}%
 {\end{longtabu}}%
\renewcommand*{\glossaryheader}{}%
% indicate what to do at the start of each logical group
\renewcommand*{\glsgroupheading}[1]{}%
\renewcommand*{\glsgroupskip}{}%
\renewcommand{\glossentry}[2]{%
   \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
   \glossentrydesc{##1}\glspostdescription
   \glsxtrprelocation ##2\tabularnewline
 }%
}

\begin{document}

    %\glsaddall
    \renewcommand*{\arraystretch}{1.4}% default is 1
    \printunsrtglossary[type=abbreviations,style=mystyle,title={Abkürzungsverzeichnis}]
    
\end{document}

在此处输入图片描述

相关内容