[Tex/LaTex] Use BibTeX to cite a website

bibliographiesbibtex

I looked on this page
How can I use BibTeX to cite a web page?
I used

@misc{keyword,
    title     = "Title",
    howpublished        = "\url{link}",
}

and the results is

Title.         URL.

on the same row but I'd like to use a style like this:

Title article
URL

without dots at the end of the title or URL and a new line for URL. Can I do this?

Best Answer

BibTeX

  1. Copy the unsrt.bst style file to your document's directory and rename to, say, unsrt-custom.bst. On GNU/Linux this can be achieved with

    cp $(kpsewhich unsrt.bst) ./unsrt-custom.bst
    
  2. Edit the unsrt-custom.bst file. Add the function

    FUNCTION {output.newline}
    { duplicate$ empty$
        'pop$
        'output.nonnull
      if$
      "\newline " write$
    }
    

    and adjust the FUNCTION {misc} accordingly

    FUNCTION {misc}
    { output.bibitem
      format.authors output
      title howpublished new.block.checkb
      format.title output
      howpublished new.block.checka
      howpublished output.newline % <-- changed
      format.date output
      new.block
      note output
      fin.entry
      empty.misc.check
    }
    
  3. Run the chain pdflatexbibtexpdflatexpdflatex on the following sample document.

    \begin{filecontents*}{\jobname.bib}
    @misc{keyword,
      title = "Title",
      howpublished = "\url{link}",
    }
    \end{filecontents*}
    \documentclass{article}
    \usepackage{url}
    \begin{document}
    
    \cite{keyword}
    
    \bibliographystyle{unsrt-custom}
    \bibliography{\jobname}
    \end{document}
    
  4. Enjoy the output.

enter image description here

BibLaTeX

biblatex comes with “batteries included” in the sense, that you can control the appearance of the style directly from the document. To achieve your desired style we modify the representation of the url field

\DeclareFieldFormat[online]{url}{\newline\url{#1}}

where we have used the new @online entry type, which is best suited to cite online sources. The full example boils down to the below document and the following chain of commands: pdflatexbiberpdflatexpdflatex

\begin{filecontents*}{\jobname.bib}
@online{keyword,
  title = "Title",
  url = "link"
}
\end{filecontents*}
\documentclass{article}
\usepackage[sorting=none]{biblatex}
\DeclareFieldFormat[online]{url}{\newline\url{#1}}
\addbibresource{\jobname}
\begin{document}

\cite{keyword}

\printbibliography

\end{document}

enter image description here