\usepackage[
sortcites=false,%sorts the citations in the order of the references if more than one is cited in a single command. Didnt trust the package option and sorted all references of a given citation command manually. Other sort styles may be possible, see https://tex.stackexchange.com/questions/361031/biblatex-how-to-automatically-sort-citation-by-year-sortcites-ynt-when-refere
%sorting=ynt,%sorting command may be discontinued due to bugs. try referencecontext instead.
style=alphabetic,%changing style to numeric saves only 2 pages at a total of 326 references. Could try numeric+superscript if pagecount becomes an issue.
natbib=true,
backend=bibtex,
maxnames=\globalmaxnames,%sets maximum number of names in citations for both intext (maxcitenames) as well as bibliography.
maxalphanames=2,%not sure what max|minalphanames do differently from max|mincitenames, but if I use them it looks like I want it to.
minalphanames=1,
minnames=1,%if number of names in citation is larger than maxnames, cut after minnames-many names and add '+'
maxbibnames=99,%overwrite maximum number of names bevor truncations in bibliography
uniquelist=true,%allows deviations from maxnames to make lists unique
backref,%references the pages where the citation was used
%url=false,%url can be set to false to ignore the url-fields of the .bib file. Do not want to generically throw away urls here, because I want to cite e.g. the grace-website. URLs are handled below.
]{biblatex}

\usepackage{xurl}% load after biblatex. Avoids URLS of references reaching into the margin. see https://tex.stackexchange.com/questions/686510/break-line-in-bibliography-for-doi

%avoid references with (chemicals in) titles reaching into the margins by adding discretionary hyphens (\-) in the affected entries of the .bib file. see https://tex.stackexchange.com/questions/381542/article-title-not-linebreaking-correctly-in-bibliography

%failed to have bibliography in two columns, except for the title. Contending myself with smaller font to keep required space reasonable.
%https://tex.stackexchange.com/questions/137100/two-columns-10pt-bibliography-specific-pages-only-in-a-one-column-12pt-text
\appto{\bibfont}{\small}%onecolumn, normal fontsize: 40 pages. small: 32 pages. footnotesize: 28 pages
%\appto{\bibsetup}{\raggedright\twocolumn}
%\AtEndBibliography{\onecolumn}
%https://tex.stackexchange.com/questions/20758/bibliography-in-two-columns-section-title-in-one
%\usepackage{multicol}
%\usepackage{etoolbox}
%\patchcmd{\thebibliography}{\section*{\refname}}
%{\begin{multicols}{2}[\section*{\refname}]}{}{}
%\patchcmd{\endthebibliography}{\endlist}{\endlist\end{multicols}}{}{}

\AtBeginRefsection{\GenRefcontextData{sorting=ynt}}%ensure that (also) a ynt sorted refcontext is created
\AtEveryCite{\localrefcontext[sorting=ynt]}%use the ynt refcontext for sorting within a citation. Did not trust this and sorted references manually, if there were multiple references in a single citation command

%different devices use had the .bib files stored in different directories. Could have used relative paths, but didnt.
%\addbibresource{C:/Users/saeck/Promotion/Sync_Seafile/Literatur_Promotion/Library/Promotion_Literatur.bib}%Laptop
%\addbibresource{F:/Seafile/Seafile/Sync_Seafile/Literatur_Promotion/Library/Promotion_Literatur.bib}%(Home Desktop)
\addbibresource{Promotion_Literatur.bib}%(path to bibliography file. In the case of this template, the file is in the same directory as the .tex documents)

%do not cite fields like 'comment' in the bibliography
\AtEveryBibitem{%
	\clearfield{note}%
%	\clearfield{url}%handled below
	\clearfield{eprint}%
	\clearfield{isbn}%
	\clearfield{issn}%
	\clearfield{month}%
	\clearfield{abstract}%
	\clearfield{creationdate}%
	\clearfield{pages}%
	\clearfield{file}%
	\clearfield{issue}%
	\clearfield{number}%
	\clearfield{keywords}%
	\clearfield{numpages}%
	\clearfield{printed}%
	\clearfield{ranking}%
	\clearfield{readstatus}%
	\clearfield{edition}%did not enter edition for every book and want to keep output consistent. Also, output formatting for first editions ("First") is for some reason different from other editions ("2nd ed.")
}
% want to show specific URLs only. Solution stolen from: https://tex.stackexchange.com/questions/152869/show-url-only-for-one-reference, 2024-11-04
%create a new category, for which the URL will be printed in the references
\DeclareBibliographyCategory{needsurl}
\newcommand{\entryneedsurl}[1]{\addtocategory{needsurl}{#1}}
\renewbibmacro*{url+urldate}{%
	\ifcategory{needsurl}
	{\printfield{url}%
		\iffieldundef{urlyear}
		{}
		{\setunit*{\addspace}%
			\printurldate}}
	{}}
%manually mark bib-entries which should have their URL printed in the references
\entryneedsurl{PubChem2005NIPAM}
\entryneedsurl{PubChem2005NIPPA}
\entryneedsurl{grace1991}%grace
\entryneedsurl{Demuth2023}%nmreval
\entryneedsurl{MarvinDemo}%free demo version of marvin sketch