1

I want to cite a reference about an onlien resource without an author name. My problem is exactly similar to the problem mentioned at [this SO post][1] but the solution there is not working for me.

I am putting the online reference as follows:

@online{memAccess,
  title = {Online reference about the section.},
  url = {http://docs.nvidia.com/cuda/cuda-c-programming-guide/#device-memory-accesses},
  urldate = {2015-09-08}
}

but by putting the reference in that way shows only the title of the reference in the bibliogrphy, I want the it to show other information also like the URL, date on which it is accessed.

My code:

\documentclass[12pt]{scrbook}
%\documentclass[12pt, hyphens]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[hyphens]{url}  %% be sure to specify the option 'hyphens'
\usepackage[hidelinks]{hyperref}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage[a4paper, width=425.196850394pt, top=70.866141732pt,bottom=70.866141732pt]{geometry}
\pagestyle{fancy}
\fancyhead{}
\fancyhead[RO, CE]{Chapter \thechapter}
\fancyfoot{}
\fancyfoot[LO,CE]{\rightmark}
\usepackage{tabu}
\usepackage{amsmath}
%%%%%%----------for bibliogtrapy to appear in the table of contents------%%%%%%%%%%%%%%%%
\usepackage{etoolbox}
\apptocmd{\thebibliography}{\csname phantomsection\endcsname\addcontentsline{toc}{chapter}{\bibname}}{}{}
\title{         
        {\large Company Name} \\[1.5in]
        {This is the title of the report}\\[1.5in] %Computation at GPU
    }
\author{XYZ}
\date{\today}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Document Begins from here %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\maketitle
\tableofcontents

% Include the chapters of the thesis, as separate files
\input{Chapters/1_introduction} % Introduction


%% ----------------------------------------------------------------bibliography
\addtocontents{toc}{\vspace{2em}}  
\backmatter
\label{Bibliography}
\lhead{\emph{Bibliography}}  % Change the left side page header to "Bibliography"
\bibliographystyle{plain}  % Use the "unsrtnat" BibTeX style for formatting the Bibliography
\bibliography{Chapters/biblio} 



\end{document}
  • 1
    You don't seem to use biblatex although you tagged your question with that tag. As far as I can see, the style plain.bst that you use does not support the url and urldate field. (The two are supported by biblatex and at least url is supported by newer styles such as plainurl). Unfortunately your MWE contains too much code not relate to the issue at hand (\renewcommand*\env@matrix, \inputs where we don't have the files, graphicx, ...), please make it truly minimal. – moewe Sep 8 '15 at 9:16
  • Thanks for updating your question. The few things I mentioned in my comment were just examples, you can get rid of much more things than that. It would probably be enough if the documentclass and just about \bibliographystyle{plain} \bibliography{Chapters/biblio} were left standing, most of the other stuff can be discarded. Please see How to write a MWEB (Minimal working example with Bibliography)?. – moewe Sep 8 '15 at 9:24
0

You're using a biblatex entry type, while using just simple bibtex.

To solve it add the following lines in your preamble:

 \usepackage[style=<name of your style>, backend=bibtex]{biblatex}
 \addbibresource{<name of your bib file>.bib} % This line is neccesary if the name is different than the name of your main file

Then, replace the lines the following lines:

\bibliographystyle{plain}  % Use the "unsrtnat" BibTeX style for formatting the Bibliography
\bibliography{Chapters/biblio}

By:

\printbibliography 

For a list of available styles see either the documentation or a list of available styles on CTAN.

Furthermore, in general you should at least once use the citation to show it in the bibliography. Unused citations by default are not displayed. As such add \cite{memAccess} somewhere in your text.

Example output with style alphabetic:


Alternatively, you could just go with plain BibTex:

In that case, add the \usepackage{hyperref} to your preamble to make the clickable url.

And change your bibresource for example in the following way:

@Misc{memAccess,
   Title                    = {Online reference about the section.},
   HowPublished             = {\url{http://docs.nvidia.com/cuda/cuda-c-programming-guide/\#device-memory-accesses}},
   Note                     = {Accessed: 2015-09-08},

   Url                      = {http://docs.nvidia.com/cuda/cuda-c-programming-guide/#device-memory-accesses},
}

The result with your plain style:

To remove the ugly colored links, change the hyperref package line to the following:

\usepackage[colorlinks=false, pdfborder={0 0 0}]{hyperref}

With \usepackage[hyphens]{url} and \raggedrightbefore bibliography:

  • It throws an error: ! Package biblatex Error: File 'Report_Work.bbl' not created by biblatex; where "Report_Work" is the name of my report. – skm Sep 8 '15 at 9:51
  • I added an alternative. However, you can fix that error by running the bibliography/bibtex command once. – QStar Sep 8 '15 at 9:55
  • It worked but there is unusual spacing among the words of the title. Actually the original title should be "Device memory access" and there is too much space among these three words. Can I do somethign for that? – skm Sep 8 '15 at 10:01
  • That's a different problem, which is caussed by the urls. For solutions, please see this question. – QStar Sep 8 '15 at 10:05
  • that answer suggests to use \usepackage[hypens]{url} but when I try to use it I get the error: ! LaTeX Error: Option clash for package url. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.15 \usepackage {subcaption} The package url has already been loaded with options: [] There has now been an attempt to load it with options [hyphens] Adding the global options: ,hyphens to your \documentclass declaration may fix this. – skm Sep 8 '15 at 10:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.