![如果 \AtEndDocument 命令中有 \printbibliography,如何强制平衡列与参考书目](https://linux22.com/image/464524/%E5%A6%82%E6%9E%9C%20%5CAtEndDocument%20%E5%91%BD%E4%BB%A4%E4%B8%AD%E6%9C%89%20%5Cprintbibliography%EF%BC%8C%E5%A6%82%E4%BD%95%E5%BC%BA%E5%88%B6%E5%B9%B3%E8%A1%A1%E5%88%97%E4%B8%8E%E5%8F%82%E8%80%83%E4%B9%A6%E7%9B%AE.png)
我在使用该包平衡参考书目时遇到了问题flushend
。当\printbibliography
命令位于序言中时(在我的例子中,整个代码都在类文件中),flushend
停止平衡最后一列。如果我仍然需要按指示使用\printbibliography
,有没有办法解决这个问题?
% !TeX program = lualatex
% !TeX encoding = utf8
\documentclass[twocolumn]{article}
\begin{filecontents*}{bibdata.bib}
@InProceedings{Cao,
author="Cao, Cheng
and Caverlee, James",
editor="Hanbury, Allan
and Kazai, Gabriella
and Rauber, Andreas
and Fuhr, Norbert",
title="Detecting Spam URLs in Social Media via Behavioral Analysis",
booktitle="Advances in Information Retrieval",
year="2015",
publisher="Springer International Publishing",
address="Cham",
pages="703--714",
}
@article{Ramesh,
title = {An efficacious method for detecting phishing webpages through target domain identification},
journal = {Decision Support Systems},
volume = {61},
pages = {12-22},
year = {2014},
issn = {0167-9236},
doi = {https://doi.org/10.1016/j.dss.2014.01.002},
url = {https://www.sciencedirect.com/science/article/pii/S0167923614000037},
author = {Gowtham Ramesh and Ilango Krishnamurthi and K. Sampath Sree Kumar},
}
@misc{Xu,
title={A Transformer-based Model to Detect Phishing URLs},
author={Pingfan Xu},
year={2021},
eprint={2109.02138},
archivePrefix={arXiv},
primaryClass={cs.CR}
}
@misc{Le,
title={URLNet: Learning a URL Representation with Deep Learning for Malicious URL Detection},
author={Hung Le and Quang Pham and Doyen Sahoo and Steven C. H. Hoi},
year={2018},
eprint={1802.03162},
archivePrefix={arXiv},
primaryClass={cs.CR}
}
@article{Wolpert,
title = {Stacked generalization},
journal = {Neural Networks},
volume = {5},
number = {2},
pages = {241-259},
year = {1992},
issn = {0893-6080},
doi = {https://doi.org/10.1016/S0893-6080(05)80023-1},
url = {https://www.sciencedirect.com/science/article/pii/S0893608005800231},
author = {David H. Wolpert},
}
@inproceedings{Choi,
author = {Choi, Hyunsang and Zhu, Bin B. and Lee, Heejo},
title = {Detecting Malicious Web Links and Identifying Their Attack Types},
year = {2011},
publisher = {USENIX Association},
address = {USA},
pages = {11},
numpages = {1},
location = {Portland, OR},
series = {WebApps'11}
}
\end{filecontents*}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures={TeX}}
\usepackage[math-style=TeX]{unicode-math}
\usepackage[english]{babel}
\usepackage{flushend}
\usepackage{lipsum}
\RequirePackage[backend=biber, %
bibstyle=gost-numeric,
maxnames = 10,
babel=other,
isbn=true,
url=true,
doi=true,
% defernumbers=true,
sorting=none,
backend=biber,
]{biblatex}
\addbibresource{bibdata.bib}
\setlength\bibitemsep{0.5\itemsep}
\setlength{\biblabelsep}{1ex}
\AtEndDocument{
\printbibliography
}
\begin{document}
\lipsum[1-6]
\nocite{*}
\end{document}
答案1
flushend 包将代码添加到前面\enddocument
,这意味着您的代码太晚了。如果 flushend 也使用钩子会更好,然后可以使用规则来获取正确的顺序:
\documentclass[twocolumn]{article}
\begin{filecontents*}{bibdata.bib}
@InProceedings{Cao,
author="Cao, Cheng
and Caverlee, James",
editor="Hanbury, Allan
and Kazai, Gabriella
and Rauber, Andreas
and Fuhr, Norbert",
title="Detecting Spam URLs in Social Media via Behavioral Analysis",
booktitle="Advances in Information Retrieval",
year="2015",
publisher="Springer International Publishing",
address="Cham",
pages="703--714",
}
@article{Ramesh,
title = {An efficacious method for detecting phishing webpages through target domain identification},
journal = {Decision Support Systems},
volume = {61},
pages = {12-22},
year = {2014},
issn = {0167-9236},
doi = {https://doi.org/10.1016/j.dss.2014.01.002},
url = {https://www.sciencedirect.com/science/article/pii/S0167923614000037},
author = {Gowtham Ramesh and Ilango Krishnamurthi and K. Sampath Sree Kumar},
}
@misc{Xu,
title={A Transformer-based Model to Detect Phishing URLs},
author={Pingfan Xu},
year={2021},
eprint={2109.02138},
archivePrefix={arXiv},
primaryClass={cs.CR}
}
@misc{Le,
title={URLNet: Learning a URL Representation with Deep Learning for Malicious URL Detection},
author={Hung Le and Quang Pham and Doyen Sahoo and Steven C. H. Hoi},
year={2018},
eprint={1802.03162},
archivePrefix={arXiv},
primaryClass={cs.CR}
}
@article{Wolpert,
title = {Stacked generalization},
journal = {Neural Networks},
volume = {5},
number = {2},
pages = {241-259},
year = {1992},
issn = {0893-6080},
doi = {https://doi.org/10.1016/S0893-6080(05)80023-1},
url = {https://www.sciencedirect.com/science/article/pii/S0893608005800231},
author = {David H. Wolpert},
}
@inproceedings{Choi,
author = {Choi, Hyunsang and Zhu, Bin B. and Lee, Heejo},
title = {Detecting Malicious Web Links and Identifying Their Attack Types},
year = {2011},
publisher = {USENIX Association},
address = {USA},
pages = {11},
numpages = {1},
location = {Portland, OR},
series = {WebApps'11}
}
\end{filecontents*}
%\usepackage{fontspec}
%\defaultfontfeatures{Ligatures={TeX}}
%\usepackage[math-style=TeX]{unicode-math}
\usepackage[english]{babel}
\usepackage{flushend}
\makeatletter
\def\initialize@flushend{%
%%
%% Activates flushend package functionality.
%%
\global\let\saved@orig@@outputdblcol\@outputdblcol
\global\let\balanced@@outputdblcol\last@outputdblcol
% use hook instead of patching:
\AddToHook{enddocument}[flushend]{\let\@outputdblcol\balanced@@outputdblcol}%
\g@addto@macro\footnoterule{\vskip\z@}%
\savingvdiscards=\@ne
}
\makeatother
\usepackage{lipsum}
\RequirePackage[backend=biber, %
bibstyle=gost-numeric,
maxnames = 10,
babel=other,
isbn=true,
url=true,
doi=true,
% defernumbers=true,
sorting=none,
backend=biber,
]{biblatex}
\addbibresource{bibdata.bib}
\setlength\bibitemsep{0.5\itemsep}
\setlength{\biblabelsep}{1ex}
\AddToHook{enddocument}[my]{\printbibliography}
\DeclareHookRule{enddocument}{my}{before}{flushend} %ensure that flushend is later
\begin{document}
\lipsum[1-6] \nocite{*}
\end{document}