# Citing URL in latex

I've already asked this question on stackoverflow.com, but someone considered me to ask the question in this forum

I am trying to write my bachelor's thesis in latex but I'm struggling with the URL in the literature. I use Citavi and converted it to a bib file. However, when inserting in latex, the URL citation doesn't look properly.

My prerequisites are: Windows 10 Pro Texmaker 5.0.2 Citavi 6.0.0.2

This is what my compiled file looks like:

Literatur (2017): "Deforestation and Forest Degradation," .

That is what I'd need:

International Union for Conservation of Nature (Hg.) (2017): Deforestation and Forest Degradation (Issues Brief). URL: https://www.iucn.org/sites/dev/files/deforestation-forest_degradation_issues_brief_final.pdf, zuletzt geprüft am 07.07.2018.

My Bib file, generated from Citavi, looks like this:

% This file was created with Citavi 6.0.0.2
@misc{InternationalUnionforConservationofNature.2017,
editor = {{International Union for Conservation of Nature}},
year = {2017},
title = {Deforestation and Forest Degradation},
urldate = {07.07.2018},
series = {Issues Brief}
}


and that is my current tex file. I've removed text and sections for clearity. But I've used all packages as in the original file.

\documentclass[12pt,a4paper]{article}
\usepackage[left=4cm, right=3cm, top=3cm, bottom=3cm]{geometry}
\usepackage{german}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{graphicx}
\usepackage{booktabs}
\renewcommand{\baselinestretch}{1.5}
\usepackage{natbib}
\bibliographystyle{ecta}
\sloppy

\begin{document}
\cite{InternationalUnionforConservationofNature.2017}
\section{Literaturverzeichnis}
\bibliography{Literatur1.2}
\end{document}


Thanks a lot for your help - I'am a totally newbee and therefore thankful for every advice. Even if it's a different approach to citing properly. Magdalena

• Aside: You may be able to inform Citavi that you use BibTeX and natbib with a fairly old bibliography style, and hence that bib entries shouldn't use the url and urldate field names. Ideally, Citavi would place the URL string in a field called note. – Mico Aug 17 '18 at 22:30

The ecta (Econometrica, right?) bibliography style doesn't recognize fields named url, urldate, and series for entries of type @misc. Moreover, for entries of type @misc, it doesn't process editor fields either. You need to change the name of the url field to note, and you need to change the editor field name to author. If you want the information contained in the urldate field to be shown in the formatted bib entry as well, be sure to make it part of the note field. And, copy the information in the series field ("Issues Brief") to the end of the author field.

For the \url macro to work, you must load either the url package and/or the hyperref package. If you want the citation call-outs and any URL strings in the bibliography to be made into hyperlinks, you should definitely load the hyperref package.

Two additional comments. First, the german and ngerman packages are obsolete. Don't load them. Instead, load the babel package with the option german or ngerman; use the latter option if your document is supposed to adhere to post-1997 (1998?) spelling and hyphenation conventions. Second, don't manipulate the low-level \baselinestretch parameter directly. Instead, load the setspace package and issue a suitable \setstretch directive.

\RequirePackage{filecontents} % just to make this answer self-contained
\begin{filecontents}{Literatur12.bib}
@misc{InternationalUnionforConservationofNature.2017,
author = {{International Union for Conservation of Nature}},
year   = {2017},
title  = {Deforestation and Forest Degradation (Issues Brief)},
zuletzt geprüft am 07.07.2018},
urldate = {07.07.2018},
series = {Issues Brief}
}
\end{filecontents}

\documentclass[12pt,a4paper]{article}
\usepackage[left=4cm, right=3cm, vmargin=3cm]{geometry}

%%\usepackage{german} % 'german' package is obsolete
\usepackage[ngerman]{babel}
\renewcommand{\refname}{Literaturverzeichnis}}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{graphicx}
\usepackage{booktabs}
%%\renewcommand{\baselinestretch}{1.5}  % don't modify this low-level parameter directly
\usepackage{setspace} % instead, use the 'setspace' package
\setstretch{1.5}

\usepackage[round,authoryear]{natbib}
\bibliographystyle{ecta}

\usepackage[hyphens]{url} % 'hyphens' option allows line breaks after "-" characters

\begin{document}
\cite{InternationalUnionforConservationofNature.2017}
%\section{Literaturverzeichnis} % not necessary
\bibliography{Literatur12}
\end{document}

• thanks a lot for your very helpful response and your further advice! this works very well! – Magdalena Aug 18 '18 at 10:11

Another way to solve the problem is modifying your bibliography template (ecta). There is the package named urlbst containing Perl script doing some tricky things.

The package adds new entry type (webpage) and recognizes new fields: url and lastchecked (instead of urldate). On the other hand there will be needed sam minor changes to generated BibTeX template to meet your needs.

After some minor changes to your files: bibliography file:

@webpage{InternationalUnionforConservationofNature.2017,
Title                    = {Deforestation and Forest Degradation},
Editor                   = {International Union for Conservation of Nature},
LastChecked              = {07.07.2018},
Series                   = {Issues Brief},
Year                     = {2017}
}


and LaTeX file:

\documentclass[12pt,a4paper]{article}
\usepackage[left=4cm, right=3cm, top=3cm, bottom=3cm]{geometry}
\usepackage{german}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{graphicx}
\usepackage{booktabs}
\renewcommand{\baselinestretch}{1.5}
\usepackage{natbib}
\bibliographystyle{ecta_url}  %%% <----------- CHANGED
\sloppy

\begin{document}
\cite{InternationalUnionforConservationofNature.2017}
\section{Literaturverzeichnis}
\bibliography{literatur}
\end{document}


The result is:

And the BibTeX template: ecta-url (created by urlbst).

• thanks a lot for your answer! I've already solved the problem and therefore did not try this one out - but I may do so in further files – Magdalena Aug 18 '18 at 18:27
• The contents of the editor field (a "corporate" author) must be enclosed in a double pair of curly braces. Otherwise -- as is shown in your screenshot -- BibTeX parses the name quite incorrectly: Given-name components International and Union, "von" component for, and surname component Conservation of Nature. Yikes! Do write editor = {{International Union for Conservation of Nature}} to avoid this problem. A separate issue: Are you sure that @webpage is the correct entry type for the document at hand? The document is a pdf file, not an html file or other type of webpage. – Mico Aug 18 '18 at 21:41

One approach you could use is manually format the bibliography using \begin{thebibliography}{9} and \end{thebibliography}.

Additionally, I suspect you want to customize the citation style, an example is available at https://www.sharelatex.com/learn/Natbib_citation_styles

The best situation would be read the natbib documentation.

• The OP's issues are related mainly to the formatting of a bibliographic entry. The natbib package does not affect these formatting matters directly. Hence, suggesting to the OP that he/she read the natbib documentation is probably not all that helpful. – Mico Aug 17 '18 at 22:27
• darn, I'm new hmm. – GrandFleet Aug 17 '18 at 22:59