Babel 和词汇表中的首字母缩略词语言复数不正确

Babel 和词汇表中的首字母缩略词语言复数不正确

我收到了错误的语言复数缩写词,glossaries并且babel很难追踪问题。这是我破译的最小失败示例代码:

\documentclass{report}
\usepackage[swedish,english]{babel}
\usepackage{glossaries}

\begin{document}
\setacronymstyle{long-short}
\newacronym{gui}{GUI}{graphical user interface}
\newacronym{ui}{UI}{user interface}

Singular: \gls{ui}. Plural: \glspl{gui}.

\end{document}

错误地输出了带有瑞典语复数形式的文本:

单数:用户界面(UI)。复数:图形用户界面(GUI)。

更改软件包的顺序可以解决问题,但我babel之前看到的所有示例都是加载的glossaries,我担心这可能会破坏过程中的其他内容。我发现了这个相关问题,但它似乎确实解决了我的问题:词汇表的首字母缩略词后缀实际上不适用于最后加载的语言

我在用着LaTeX 研讨会用来构建我的项目latexmk,我猜问题可能就在那里。以下是输出日志,希望对您有帮助:

Latexmk: This is Latexmk, John Collins, 26 Dec. 2019, version: 4.67.
Rule 'pdflatex': The following rules & subrules became out-of-date:
      'pdflatex'
------------
Run number 1 of rule 'pdflatex'
------------
------------
Running 'pdflatex  -synctex=1 -interaction=nonstopmode -file-line-error -recorder -output-directory="/Users/andreasnasman/Desktop/masters-thesis/coppy"  "/Users/andreasnasman/Desktop/masters-thesis/coppy/thesis.tex"'
------------
Latexmk: applying rule 'pdflatex'...
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(/Users/andreasnasman/Desktop/masters-thesis/coppy/thesis.tex
LaTeX2e <2019-10-01> patch level 3
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/report.cls
Document Class: report 2019/10/25 v1.4k Standard LaTeX document class
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/size10.clo)) (/usr/local/texlive/2019/texmf-dist/tex/generic/babel/babel.sty (/usr/local/texlive/2019/texmf-dist/tex/generic/babel/switch.def) (/usr/local/texlive/2019/texmf-dist/tex/generic/babel-swedish/swedish.ldf (/usr/local/texlive/2019/texmf-dist/tex/generic/babel/babel.def (/usr/local/texlive/2019/texmf-dist/tex/generic/babel/txtbabel.def))) (/usr/local/texlive/2019/texmf-dist/tex/generic/babel-english/english.ldf)) (/usr/local/texlive/2019/texmf-dist/tex/latex/glossaries/base/glossaries.sty (/usr/local/texlive/2019/texmf-dist/tex/latex/base/ifthen.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/xkeyval/xkeyval.sty (/usr/local/texlive/2019/texmf-dist/tex/generic/xkeyval/xkeyval.tex (/usr/local/texlive/2019/texmf-dist/tex/generic/xkeyval/xkvutils.tex (/usr/local/texlive/2019/texmf-dist/tex/generic/xkeyval/keyval.tex)))) (/usr/local/texlive/2019/texmf-dist/tex/latex/mfirstuc/mfirstuc.sty (/usr/local/texlive/2019/texmf-dist/tex/latex/etoolbox/etoolbox.sty)) (/usr/local/texlive/2019/texmf-dist/tex/latex/textcase/textcase.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/xfor/xfor.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/datatool/datatool-base.sty (/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/local/texlive/2019/texmf-dist/tex/latex/substr/substr.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/datatool/datatool-fp.sty (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp.sty `Fixed Point Package', Version 0.8, April 2, 1995 (C) Michael Mehlich (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/defpattern.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp-basic.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp-addons.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp-snap.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp-exp.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp-trigo.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp-pas.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp-random.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp-eqn.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp-upn.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp-eval.sty)))) (/usr/local/texlive/2019/texmf-dist/tex/latex/glossaries/base/glossaries-compatible-307.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/tracklang/tracklang.sty (/usr/local/texlive/2019/texmf-dist/tex/generic/tracklang/tracklang.tex)) (/usr/local/texlive/2019/texmf-dist/tex/latex/translator/translator.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/glossaries-english/glossaries-english.ldf) (/Users/andreasnasman/Library/texmf/tex/latex/glossaries-swedish.ldf (/Users/andreasnasman/Library/texmf/tex/latex/glossaries-swedish-utf8.ldf)) (/usr/local/texlive/2019/texmf-dist/tex/latex/glossaries/styles/glossary-hypernav.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/glossaries/styles/glossary-list.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/glossaries/styles/glossary-long.sty (/usr/local/texlive/2019/texmf-dist/tex/latex/tools/longtable.sty)) (/usr/local/texlive/2019/texmf-dist/tex/latex/glossaries/styles/glossary-super.sty (/usr/local/texlive/2019/texmf-dist/tex/latex/supertabular/supertabular.sty)) (/usr/local/texlive/2019/texmf-dist/tex/latex/glossaries/styles/glossary-tree.sty)) (/Users/andreasnasman/Desktop/masters-thesis/coppy/thesis.aux) (/Users/andreasnasman/Library/texmf/tex/latex/glossaries-dictionary-Swedish.dict) [1{/usr/local/texlive/2019/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (/Users/andreasnasman/Desktop/masters-thesis/coppy/thesis.aux) )</usr/local/texlive/2019/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on /Users/andreasnasman/Desktop/masters-thesis/coppy/thesis.pdf (1 page, 14735 bytes).
SyncTeX written on /Users/andreasnasman/Desktop/masters-thesis/coppy/thesis.synctex.gz.
Transcript written on /Users/andreasnasman/Desktop/masters-thesis/coppy/thesis.log.
Latexmk: Log file says output to 'thesis.pdf'
Rule 'pdflatex': File changes, etc:
   Changed files, or newly in use since previous run(s):
      '/Users/andreasnasman/Desktop/masters-thesis/coppy/thesis.aux'
      'thesis.aux'
------------
Run number 2 of rule 'pdflatex'
------------
------------
Running 'pdflatex  -synctex=1 -interaction=nonstopmode -file-line-error -recorder -output-directory="/Users/andreasnasman/Desktop/masters-thesis/coppy"  "/Users/andreasnasman/Desktop/masters-thesis/coppy/thesis.tex"'
------------
=== TeX engine is 'pdfTeX'
Latexmk: applying rule 'pdflatex'...
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(/Users/andreasnasman/Desktop/masters-thesis/coppy/thesis.tex
LaTeX2e <2019-10-01> patch level 3
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/report.cls
Document Class: report 2019/10/25 v1.4k Standard LaTeX document class
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/size10.clo)) (/usr/local/texlive/2019/texmf-dist/tex/generic/babel/babel.sty (/usr/local/texlive/2019/texmf-dist/tex/generic/babel/switch.def) (/usr/local/texlive/2019/texmf-dist/tex/generic/babel-swedish/swedish.ldf (/usr/local/texlive/2019/texmf-dist/tex/generic/babel/babel.def (/usr/local/texlive/2019/texmf-dist/tex/generic/babel/txtbabel.def))) (/usr/local/texlive/2019/texmf-dist/tex/generic/babel-english/english.ldf)) (/usr/local/texlive/2019/texmf-dist/tex/latex/glossaries/base/glossaries.sty (/usr/local/texlive/2019/texmf-dist/tex/latex/base/ifthen.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/xkeyval/xkeyval.sty (/usr/local/texlive/2019/texmf-dist/tex/generic/xkeyval/xkeyval.tex (/usr/local/texlive/2019/texmf-dist/tex/generic/xkeyval/xkvutils.tex (/usr/local/texlive/2019/texmf-dist/tex/generic/xkeyval/keyval.tex)))) (/usr/local/texlive/2019/texmf-dist/tex/latex/mfirstuc/mfirstuc.sty (/usr/local/texlive/2019/texmf-dist/tex/latex/etoolbox/etoolbox.sty)) (/usr/local/texlive/2019/texmf-dist/tex/latex/textcase/textcase.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/xfor/xfor.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/datatool/datatool-base.sty (/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/local/texlive/2019/texmf-dist/tex/latex/substr/substr.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/datatool/datatool-fp.sty (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp.sty `Fixed Point Package', Version 0.8, April 2, 1995 (C) Michael Mehlich (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/defpattern.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp-basic.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp-addons.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp-snap.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp-exp.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp-trigo.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp-pas.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp-random.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp-eqn.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp-upn.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp-eval.sty)))) (/usr/local/texlive/2019/texmf-dist/tex/latex/glossaries/base/glossaries-compatible-307.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/tracklang/tracklang.sty (/usr/local/texlive/2019/texmf-dist/tex/generic/tracklang/tracklang.tex)) (/usr/local/texlive/2019/texmf-dist/tex/latex/translator/translator.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/glossaries-english/glossaries-english.ldf) (/Users/andreasnasman/Library/texmf/tex/latex/glossaries-swedish.ldf (/Users/andreasnasman/Library/texmf/tex/latex/glossaries-swedish-utf8.ldf)) (/usr/local/texlive/2019/texmf-dist/tex/latex/glossaries/styles/glossary-hypernav.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/glossaries/styles/glossary-list.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/glossaries/styles/glossary-long.sty (/usr/local/texlive/2019/texmf-dist/tex/latex/tools/longtable.sty)) (/usr/local/texlive/2019/texmf-dist/tex/latex/glossaries/styles/glossary-super.sty (/usr/local/texlive/2019/texmf-dist/tex/latex/supertabular/supertabular.sty)) (/usr/local/texlive/2019/texmf-dist/tex/latex/glossaries/styles/glossary-tree.sty)) (/Users/andreasnasman/Desktop/masters-thesis/coppy/thesis.aux) (/Users/andreasnasman/Library/texmf/tex/latex/glossaries-dictionary-Swedish.dict) (/Users/andreasnasman/Desktop/masters-thesis/coppy/thesis.glsdefs) [1{/usr/local/texlive/2019/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (/Users/andreasnasman/Desktop/masters-thesis/coppy/thesis.aux) )</usr/local/texlive/2019/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on /Users/andreasnasman/Desktop/masters-thesis/coppy/thesis.pdf (1 page, 14735 bytes).
SyncTeX written on /Users/andreasnasman/Desktop/masters-thesis/coppy/thesis.synctex.gz.
Transcript written on /Users/andreasnasman/Desktop/masters-thesis/coppy/thesis.log.
Latexmk: Log file says output to 'thesis.pdf'
Rule 'pdflatex': File changes, etc:
   Changed files, or newly in use since previous run(s):
      'thesis.glsdefs'
------------
Run number 3 of rule 'pdflatex'
------------
------------
Running 'pdflatex  -synctex=1 -interaction=nonstopmode -file-line-error -recorder -output-directory="/Users/andreasnasman/Desktop/masters-thesis/coppy"  "/Users/andreasnasman/Desktop/masters-thesis/coppy/thesis.tex"'
------------
=== TeX engine is 'pdfTeX'
Latexmk: applying rule 'pdflatex'...
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(/Users/andreasnasman/Desktop/masters-thesis/coppy/thesis.tex
LaTeX2e <2019-10-01> patch level 3
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/report.cls
Document Class: report 2019/10/25 v1.4k Standard LaTeX document class
(/usr/local/texlive/2019/texmf-dist/tex/latex/base/size10.clo)) (/usr/local/texlive/2019/texmf-dist/tex/generic/babel/babel.sty (/usr/local/texlive/2019/texmf-dist/tex/generic/babel/switch.def) (/usr/local/texlive/2019/texmf-dist/tex/generic/babel-swedish/swedish.ldf (/usr/local/texlive/2019/texmf-dist/tex/generic/babel/babel.def (/usr/local/texlive/2019/texmf-dist/tex/generic/babel/txtbabel.def))) (/usr/local/texlive/2019/texmf-dist/tex/generic/babel-english/english.ldf)) (/usr/local/texlive/2019/texmf-dist/tex/latex/glossaries/base/glossaries.sty (/usr/local/texlive/2019/texmf-dist/tex/latex/base/ifthen.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/xkeyval/xkeyval.sty (/usr/local/texlive/2019/texmf-dist/tex/generic/xkeyval/xkeyval.tex (/usr/local/texlive/2019/texmf-dist/tex/generic/xkeyval/xkvutils.tex (/usr/local/texlive/2019/texmf-dist/tex/generic/xkeyval/keyval.tex)))) (/usr/local/texlive/2019/texmf-dist/tex/latex/mfirstuc/mfirstuc.sty (/usr/local/texlive/2019/texmf-dist/tex/latex/etoolbox/etoolbox.sty)) (/usr/local/texlive/2019/texmf-dist/tex/latex/textcase/textcase.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/xfor/xfor.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/datatool/datatool-base.sty (/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/local/texlive/2019/texmf-dist/tex/latex/substr/substr.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/datatool/datatool-fp.sty (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp.sty `Fixed Point Package', Version 0.8, April 2, 1995 (C) Michael Mehlich (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/defpattern.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp-basic.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp-addons.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp-snap.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp-exp.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp-trigo.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp-pas.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp-random.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp-eqn.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp-upn.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/fp/fp-eval.sty)))) (/usr/local/texlive/2019/texmf-dist/tex/latex/glossaries/base/glossaries-compatible-307.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/tracklang/tracklang.sty (/usr/local/texlive/2019/texmf-dist/tex/generic/tracklang/tracklang.tex)) (/usr/local/texlive/2019/texmf-dist/tex/latex/translator/translator.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/glossaries-english/glossaries-english.ldf) (/Users/andreasnasman/Library/texmf/tex/latex/glossaries-swedish.ldf (/Users/andreasnasman/Library/texmf/tex/latex/glossaries-swedish-utf8.ldf)) (/usr/local/texlive/2019/texmf-dist/tex/latex/glossaries/styles/glossary-hypernav.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/glossaries/styles/glossary-list.sty) (/usr/local/texlive/2019/texmf-dist/tex/latex/glossaries/styles/glossary-long.sty (/usr/local/texlive/2019/texmf-dist/tex/latex/tools/longtable.sty)) (/usr/local/texlive/2019/texmf-dist/tex/latex/glossaries/styles/glossary-super.sty (/usr/local/texlive/2019/texmf-dist/tex/latex/supertabular/supertabular.sty)) (/usr/local/texlive/2019/texmf-dist/tex/latex/glossaries/styles/glossary-tree.sty)) (/Users/andreasnasman/Desktop/masters-thesis/coppy/thesis.aux) (/Users/andreasnasman/Library/texmf/tex/latex/glossaries-dictionary-Swedish.dict) (/Users/andreasnasman/Desktop/masters-thesis/coppy/thesis.glsdefs) [1{/usr/local/texlive/2019/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (/Users/andreasnasman/Desktop/masters-thesis/coppy/thesis.aux) )</usr/local/texlive/2019/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on /Users/andreasnasman/Desktop/masters-thesis/coppy/thesis.pdf (1 page, 14735 bytes).
SyncTeX written on /Users/andreasnasman/Desktop/masters-thesis/coppy/thesis.synctex.gz.
Transcript written on /Users/andreasnasman/Desktop/masters-thesis/coppy/thesis.log.
Latexmk: Log file says output to 'thesis.pdf'
=== TeX engine is 'pdfTeX'
Latexmk: All targets () are up-to-date

答案1

使用notranslate加载glossaries包的选项:

\usepackage[notranslate]{glossaries} 

然后glossaries将使用其默认(英语)定义。进行更改后,重新编译之前必须删除 .glsdefs 文件,否则该行的更改\usepackage不会对之前定义的首字母缩略词的复数产生影响。

我认为如果在加载其语言定义时使用文档语言会更好glossaries;这会更直观。但在当前版本 (4.46) 中情况并非如此。

顺便说一句,原作者担心使用latexmk会导致问题。但事实并非如此。Latexmksimplepdflatex多次调用了它认为必要的 。如果直接使用 编译文档,也会出现完全相同的现象pdflatex

相关内容