0

enter image description here

In my 2nd and 3rd reference, there is a large space after URL, why and how can I remove it?

\usepackage{natbib}

\begin{document}

\bibliographystyle{agsm} % Harvard style \bibliography{ref.bib}

\end{document}

And the ref.bib entries with the problem.

@article{Tabish2007,
   author = {Syed Amin Tabish},
   issn = {1658-3639},
   issue = {2},
   journal = {International journal of health sciences},
   month = {7},
   pages = {V-VIII},
   pmid = {21475425},
   publisher = {Qassim University, Kingdom of Saudi Arabia},
   title = {Is Diabetes Becoming the Biggest Epidemic of the Twenty-first Century?},
   volume = {1},
   url = {https://pubmed.ncbi.nlm.nih.gov/21475425 https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3068646/},
   year = {2007},
}

@article{Ramachandran2014, author = {A Ramachandran}, issn = {0971-5916}, issue = {5}, journal = {The Indian journal of medical research}, keywords = {Physical Examination,Diabetes Mellitus/diagnosis/epidemiology/physiopathology,Humans,Prediabetic State/*diagnosis/epidemiology/physiopathology,Risk Factors}, month = {11}, pages = {579-581}, pmid = {25579136}, publisher = {Medknow Publications & Media Pvt Ltd}, title = {Know the signs and symptoms of diabetes}, volume = {140}, url = {https://pubmed.ncbi.nlm.nih.gov/25579136 https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4311308/}, year = {2014}, }

Mzq
  • 259
  • I guess the content of ref.bib might be helpful. – ttnick May 18 '21 at 14:11
  • I have added the ref.bib entries. – Mzq May 18 '21 at 14:24
  • What if right before the \bibliography you issue \raggedright? (The large space seems to be due to the paragraphs being justified.) – Willie Wong May 18 '21 at 14:32
  • 1
    Note that it does not make any sense to provide two URLs in the url field. It is only meant for one. Additionally the & in the publisher needs to be \& – daleif May 18 '21 at 14:37
  • \raggedright works, but 2 urls is my problem, I downloaded it from the article website, did not notice there are 2 URLs. – Mzq May 18 '21 at 15:15

2 Answers2

1

I'd recommend using something like this (after you pare down the url field in the bib file to contain only one url, and not two). The redefinition of \harvardurl enables proper URL breaking, the default does not, additionally the xurl package modifies \url such that it can break a URL at basically any char.

\documentclass[a4paper]{article}

\usepackage{natbib} \usepackage{xurl}

\renewcommand\harvardurl[1]{\textbf{URL:} {\itshape\urlstyle{same}\url{#1}}}

\begin{filecontents}[overwrite]{\jobname.bib} @article{Tabish2007, author = {Syed Amin Tabish}, issn = {1658-3639}, issue = {2}, journal = {International journal of health sciences}, month = {7}, pages = {V-VIII}, pmid = {21475425}, publisher = {Qassim University, Kingdom of Saudi Arabia}, title = {Is Diabetes Becoming the Biggest Epidemic of the Twenty-first Century?}, volume = {1}, url = {https://pubmed.ncbi.nlm.nih.gov/21475425}, year = {2007}, }

@article{Ramachandran2014, author = {A Ramachandran}, issn = {0971-5916}, issue = {5}, journal = {The Indian journal of medical research}, keywords = {Physical Examination,Diabetes Mellitus/diagnosis/epidemiology/physiopathology,Humans,Prediabetic State/*diagnosis/epidemiology/physiopathology,Risk Factors}, month = {11}, pages = {579-581}, pmid = {25579136}, publisher = {Medknow Publications & Media Pvt Ltd}, title = {Know the signs and symptoms of diabetes}, volume = {140}, url = {https://pubmed.ncbi.nlm.nih.gov/25579136}, year = {2014}, } \end{filecontents}

\begin{document}

\nocite{*}

\bibliographystyle{agsm} % Harvard style \bibliography{\jobname}

\end{document}

Willie Wong
  • 24,733
  • 8
  • 74
  • 106
daleif
  • 54,450
0

It seems that bibtex doesn't like multiple URLs just separated by a whitespace. A quick fix that did work is to replace this space with a ~. However, the line becomes very wide and does not respect margins. Also possible would be a linebreak just enforced by \\.

@article{Tabish2007,
   author = {Syed Amin Tabish},
   issn = {1658-3639},
   issue = {2},
   journal = {International journal of health sciences},
   month = {7},
   pages = {V-VIII},
   pmid = {21475425},
   publisher = {Qassim University, Kingdom of Saudi Arabia},
   title = {Is Diabetes Becoming the Biggest Epidemic of the Twenty-first Century?},
   volume = {1},
   url = {https://pubmed.ncbi.nlm.nih.gov/21475425,\\https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3068646/},
   year = {2007},
}

@article{Ramachandran2014, author = {A Ramachandran}, issn = {0971-5916}, issue = {5}, journal = {The Indian journal of medical research}, keywords = {Physical Examination,Diabetes Mellitus/diagnosis/epidemiology/physiopathology,Humans,Prediabetic State/*diagnosis/epidemiology/physiopathology,Risk Factors}, month = {11}, pages = {579-581}, pmid = {25579136}, publisher = {Medknow Publications & Media Pvt Ltd}, title = {Know the signs and symptoms of diabetes}, volume = {140}, url = {https://pubmed.ncbi.nlm.nih.gov/25579136,\https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4311308/}, year = {2014}, }

ttnick
  • 225