0

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?

  • Your question is tagged biblatex, but the title says BibTeX. Which one do you use? – Henri Menke Jun 4 '16 at 8:11
  • BibTeX. Sorry I didn't notice that. I'll edit the tag – Shika93 Jun 4 '16 at 8:37
  • Then you will have to edit the bibliography style. Which one are you using? – Henri Menke Jun 4 '16 at 8:50
  • \bibliographystyle{unsrt} – Shika93 Jun 4 '16 at 8:54
2

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

  • What if I change in BibLaTex? Would be easier? I'm using TeXStudio on Windows. – Shika93 Jun 4 '16 at 9:21
  • @Shika93 See updated answer. – Henri Menke Jun 4 '16 at 9:52
  • I'm using the first solution. Is there a way to set the width of urls? I have a long url that at the end of the line draws a large black space when goes in a new line. Is like http:\\urlurlurlurl.com\path\path\path\path\**blackblackblack**\path I hope you get it. I'll update the question with a screenshot if needed – Shika93 Jun 4 '16 at 18:26
  • 1
    @Shika93This question solves the problem: tex.stackexchange.com/questions/3033 The solution is to add the hyphens option to the url package as in \usepackage[hyphens]{url}. – Henri Menke Jun 4 '16 at 20:32

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.