我正在使用它\nocite{*}
来创建所有 .bib 文件完整内容的排版书目。在 Ubuntu 18 (TexLive 2017) 下,这非常有效,并生成了一份 200 页的文档。现在,在 Ubuntu 20 (TexLive 2019) 中,当文档大小超过 150 页时,我会收到“TeX 容量超出”的信息。确切的错误消息是:
Overfull \hbox (5.53261pt too wide) in paragraph at lines 182--182
[][]\T1/zgmx/m/n/10 Laur, Wolf-gang (1954), `Sli-esthorp, Schleswig, Hedeby und
Had-deby. Die Na-men von Schleswig-
[125]
Runaway argument?
Lennard:Lawshall|Lennard:satellite|Lennard_1959|Lepelley:Normandiedia\ETC.
! TeX capacity exceeded, sorry [main memory size=5000000].
\blx@segm@0@0 ...nshire|Padel:Parochia|Padel:chang
e|commodity|JEPNS-39-Padel...
l.182 ...ibliography[heading=bibliography-heading]
! ==> Fatal error occurred, no output PDF file produced!
以下文件给出了 MWE。python 脚本生成一个带有随机条目的虚拟 .bib 文件。
制作bibtex文件.py:
# python3 make_bibtex_file.py >| foo.bib && texclean && latexmk -pdf bibliography_all
from random import seed,random,randrange,choices,choice
book='''@book{%s,
author= {%s},
title= {%s},
publisher={%s},
address= {%s},
year= {%d},
}
'''
article='''@article{%s,
author= {%s},
title= {%s},
journal={%s},
volume= {%d},
pages= {%d--%d},
year= {%d},
}
'''
def go(na,nb):
alphabet='abcdefghijklmonpqrstuvwxyz'
for i in range(na):
k=''.join(choices(alphabet,k=10)).title()
a=choice(alphabet).upper()+'. '+(('',choice(alphabet).upper()+'. ')[random()<0.7])+''.join(choices(alphabet,k=8)).title()
t=''.join(choices(alphabet,k=randrange(3,12))).title()+' '+''.join(choices(alphabet,k=randrange(3,12))).title()+' '+''.join(choices(alphabet,k=randrange(3,12))).title()
j=''.join(choices(alphabet,k=randrange(3,12))).title()+' '+''.join(choices(alphabet,k=randrange(3,12))).title()
v=randrange(1,200)
p=''.join(choices(alphabet,k=randrange(5,12))).title()
l=''.join(choices(alphabet,k=randrange(6,12))).title()
p0=randrange(1,200)
p1=p0+randrange(1,40)
y=randrange(1900,2023)
print(article%(k,a,t,j,v,p0,p1,y))
for i in range(nb):
k=''.join(choices(alphabet,k=10)).title()
a=choice(alphabet).upper()+'. '+(('',choice(alphabet).upper()+'. ')[random()<0.7])+''.join(choices(alphabet,k=8)).title()
t=''.join(choices(alphabet,k=randrange(3,12))).title()+' '+''.join(choices(alphabet,k=randrange(3,12))).title()+' '+''.join(choices(alphabet,k=randrange(3,12))).title()
p=''.join(choices(alphabet,k=randrange(5,12))).title()
l=''.join(choices(alphabet,k=randrange(6,12))).title()
y=randrange(1900,2023)
print(book%(k,a,t,p,l,y))
if __name__=='__main__':
seed(1)
go(na=3000,nb=3000) # 3000,3000 ok => 123 pages
#go(na=4000,nb=3000) # not ok
#go(na=3500,nb=3000) # not ok
#go(na=3400,nb=3000) # not ok
#go(na=3300,nb=3000) # not ok
#go(na=4000,nb=4000) # not ok => (./bibliography_all.bbl Runaway text? Szurrycplj|Dpopvymmif|Khzggpogfj|Iazmfsnmey|Wpczdiuelp|Yyktvieuhz|Mku\ETC. ! TeX capacity exceeded, sorry [main memory size=5000000]. \blx@dlist@entry@0@nyt/global//global/global ...kj ggsjyc|Elfwxhwise|Lhznuyxn... l.206098 \endentry
书目_全部.tex:
\documentclass[10pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[german,american,english]{babel}
\usepackage[babel]{csquotes}
\usepackage{time}
\usepackage{garamondx}
\usepackage[lmargin=60mm,rmargin=15mm,tmargin=20mm,bmargin=20mm]{geometry}
\usepackage{ragged2e}
\usepackage{showkeys}
\usepackage[style=authoryear,sorting=nyt,hyperref,dashed=true,backend=biber,bibencoding=utf8,texencoding=ascii]{biblatex}
\bibliography{foo}
\usepackage[colorlinks,linkcolor=blue,anchorcolor=blue,citecolor=blue,urlcolor=blue,pdfauthor={Keith Briggs},pdfmenubar=false,pdffitwindow=true,pdfwindowui=false,pdftitle={A big bibliography},plainpages=false]{hyperref}
\title{A big bibliography}
\author{Keith Briggs}
\def\Today{\number\year\space
\ifcase\month\or January\or February\or March\or April\or May\or June\or
July\or August\or September\or October\or November\or December\fi
\space\number\day
}
\date{Last revised \Today\ \now}
\begin{document}
\renewcommand{\baselinestretch}{1.1}
\maketitle
\nocite{*}
\printbibliography
\end{document}
答案1
为了获得基准,我使用 Overleaf 的 TeX Live 2017 和 TeX Live 2019 运行了以下文档。
文档 1
\documentclass{article}
\usepackage[utf8]{inputenc}
\begin{document}
Lorem
\end{document}
文档 2
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[style=authoryear]{biblatex}
\addbibresource{biblatex-examples.bib}
\begin{document}
\section{Introduction}
Lorem
\autocite{sigfridsson}
\nocite{*}
\printbibliography
\end{document}
下表显示了在给定的 TeX Live 版本中每个文档使用了 5000000 个 TeX 中的多少个内存字。
文档 | 2017 | 2019 | 不同之处 |
---|---|---|---|
1 | 56297 | 62012 | ~10% |
2 | 555443 | 594316 | ~7% |
恐怕情况就是这样:新功能有时会伴随更复杂或新的实现,需要更多的内存。
您可以尝试使用 LuaTeX 编译文档,它具有动态内存分配功能,通常更适合内存密集型文档。(还有如何扩展 TeX 的“主内存大小”?(pgfplots 内存过载)建议一些方法来增加 TeX 的内存,但仍然存在硬编码限制,并且乌尔丽克·菲舍尔的评论建议这还不够)。