Skip to content

Instantly share code, notes, and snippets.

@nheeren
Last active August 29, 2018 00:41
Show Gist options
  • Save nheeren/c216e928f1d897d0336ff33c95a5562d to your computer and use it in GitHub Desktop.
Save nheeren/c216e928f1d897d0336ff33c95a5562d to your computer and use it in GitHub Desktop.
Latex code snippets that are useful for scientific / paper writing.

Latex code snippets

Code snippets that are useful for scientific / paper writing.

Bibtex

Only show DOI if URL is also present

% Show only DOI if URL and DOI are present
% inspired by https://tex.stackexchange.com/a/154875/67042 and https://tex.stackexchange.com/a/424799/67042

\DeclareSourcemap{
	\maps[datatype=bibtex]{
		\map{
			\step[fieldsource=doi,final]
	    		\step[fieldset=url,null]
}}}

PDF metadata

% Add metadata to the final PDF file
% https://tex.stackexchange.com/a/26530/67042
\usepackage[pdftex,
            pdfauthor={Niko Heeren},
	    pdftitle={My title},
	    pdfsubject={},
	    pdfkeywords={},
	    pdfproducer={},
	    pdfcreator={}]{hyperref}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment