0

I am using Overleaf for my paper.

I have an issue, when I add a note in my references (in bibfile.bib) such as:

@article{jack2015new,
  title={paper title},
  author={Jack and roben and bryan},
  year={2015},
  note={this is available at abc.com}
}

My latex is:

 \documentclass [12pt]{article}
\usepackage{cite}
\usepackage[natbibapa]{apacite}
 \usepackage{natbib}
 \renewcommand{\&}{and} %makes all references and
 \linespread{2}
\usepackage{paralist}
\usepackage{graphicx}
\usepackage{titlesec}
\usepackage{color}
\usepackage{xcolor}
\usepackage{longtable}
\usepackage{chngcntr} 
\usepackage{times}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage[justification=centering]{caption}
\usepackage{pdfpages}
\usepackage{amsfonts}
\usepackage{booktabs}
\usepackage{amssymb}
\usepackage{paralist}
\usepackage{graphicx}
\usepackage{amsthm}
\usepackage{latexsym}
\usepackage{subfig}
\usepackage{esint}
\usepackage{authblk}
\usepackage{comment}
\usepackage{float}
\usepackage{lineno}
\usepackage[toc,page]{appendix}
\usepackage{eso-pic}
 \usepackage{array}
\usepackage{tabu}
\usepackage{pdflscape}
 \usepackage[fleqn]{amsmath}
\setlength{\mathindent}{0pt}
\usepackage{hyperref}
\hypersetup{breaklinks=true}
\usepackage[nottoc,numbib]{tocbibind}
\usepackage{chngcntr}
\counterwithin{table}{section}
\counterwithin{figure}{section}
\counterwithin{equation}{section}
 \usepackage[left=2.5cm,right=2.5cm,top=2.5cm,bottom=2.5cm]      {geometry}%margins
\usepackage{setspace}
   \begin{titlepage}
      \begin{center}
       \vspace*{1cm}
        \textbf{\large{ project title}}
        \vspace{1.5cm}
       \small{
    paper title
       }
       \vspace{1.5cm}
       \vspace{.5cm}
       \textsuperscript{\textcopyright} \text{Author Name}
  \end{center}
  \pagenumbering{gobble} 
  \author{}
\pagebreak
\end{titlepage}
  \date{} 
\begin{document}

\maketitle
\onehalfspacing

\pagenumbering{roman}
\frontmatter

\mainmatter

\newcommand{\sectionbreak} {\clearpage}

\section{Introduction} \pagenumbering{arabic} introduction

\clearpage

\renewcommand{\biband}{&} %makes all references and

\bibliographystyle{apacite} \bibliography{bibfile}

\end{document}

When it generates the output I see it shows the note in one line after my reference. So, for example:

jack and roben and bryan (2015), title,

(this is available at abc.com)

Is there anyway I prevent line break and put the not just after the reference following the same line? Also, I do not want those parenthesizes.

I use the following bibliography:

\bibliographystyle{apacite}
\bibliography{bibfile}

P.S: Is my font Times New Roman?

  • 1
    Usually the lines are not randomly broken in the bibliography, especially if there is still space to fit additional content into the line. But it may well be that some of your settings make a line break more probably. We can only say that with certainty, though, if you can show us a full example document that reproduces what you are doing, a so-called MWE (https://tex.meta.stackexchange.com/q/228/35864) or MWEB (https://tex.meta.stackexchange.com/q/4407/35864). – moewe Feb 02 '19 at 08:45
  • Note that author={Jack, roben, bryan}, is quite likely wrong. Several authors should be separated with and: author = {Anne Elk and James Hacker and Humphrey Appleby} (see https://tex.stackexchange.com/q/36396/35864 and https://tex.stackexchange.com/q/557/35864). While theoretically it is possible to use up to two commas for single name (in the format von Last, Jr, First) that is almost never what people want. – moewe Feb 02 '19 at 08:48
  • @moewe about your second comment, it is just example, In my references it is fine. – questionaskerprogrammer Feb 02 '19 at 08:52
  • It seems like an openbib option is activated. References as formated by bibtex usually contain \newblock commands which normally generate just some spacing. One \newblock must be present before your note in the .bbl generated by bibtex. The openbib option changes the meaning of \newblock into \par. – Eric Domenjoud Feb 02 '19 at 10:04
  • @EricDomenjoud How can I I fix this? – questionaskerprogrammer Feb 02 '19 at 10:35
  • First of all, provide a MWE so that we can figure out exactly what happens and see whether the problem is really what I suggested. – Eric Domenjoud Feb 02 '19 at 10:45
  • @EricDomenjoud I hope this works – questionaskerprogrammer Feb 02 '19 at 11:37
  • 1
    You're example seems far from minimal. Moreover, it does not compile. – Eric Domenjoud Feb 02 '19 at 11:53
  • 2
    Ok. I managed to compile your example by suppressing almost everything. The problem has nothing to do with \newblock and an openbib option. It comes from your reference itself in which a journal field is missing. The apalike style will insert a blank line in the reference which causes a paragraph break. – Eric Domenjoud Feb 02 '19 at 12:08
  • @EricDomenjoud It occurs even when I use technical report format. – questionaskerprogrammer Feb 02 '19 at 22:00
  • 1
    Then please show us a minimal example of what you are doing. Remove the unnecessary and unrelated packages from the preamble and show us a .bib entry that reproduces the issue. The code shown in the question produces a plethora of unrelated error messages and warnings that should definitely be fixed, but have no bearing on the issue at hand. FWIW in a short test I just ran changing the example entry to @techreport or @misc worked fine and did not produce the unwanted line break in the bibliography. – moewe Feb 03 '19 at 09:14

1 Answers1

1

The problem comes from a bug in the bibtex style apacite.bst which sometimes adds blank lines in the middle of a reference when some fields are missing. In your case, the field journal is missing in the reference

@article{jack2015new,
  title={paper title},
  author={Jack and roben and bryan},
  year={2015},
  note={this is available at abc.com}
}

The output of bibtex is

\begin{thebibliography}{}

\bibitem [\protect \citeauthoryear {%
Jack%
, roben%
\BCBL {}\ \BBA {} bryan%
}{%
Jack%
\ \protect \BOthers {.}}{%
{\protect \APACyear {2015}}%
}]{%
jack2015new}
\APACinsertmetastar {%
jack2015new}%
\begin{APACrefauthors}%
Jack%
, roben%
\BCBL {}\ \BBA {} bryan.%
\end{APACrefauthors}%
\unskip\
\newblock
\APACrefYearMonthDay{2015}{}{}.
\newblock
{\BBOQ}\APACrefatitle {paper title} {paper title}.{\BBCQ}
\newblock

\newblock
\APACrefnote{this is available at abc.com}
\PrintBackRefs{\CurrentBib}

\end{thebibliography}

which has a blank line between the two \newblock commands near the end of the reference. This causes a paragraph break in the reference.

It seems however that the problem does not occur as long as your bibliographic database is correct. Thus it is easy to avoid it. In the previous example, bibtex warns about the missing journal fields.

  • +1 I'd hesitate to call this a bug, though. If this only happens when required fields are missing (journal for @article, as in this case), then this could be considered user error. There is even a warning in the .blg file: Warning--No journal in jack2015new. On the one hand it might be nicer if the output did not look that weird, on the other hand I don't think it is reasonable to expect the developer to put lots of effort into fixing the output one gets for incorrect input. – moewe Feb 03 '19 at 13:32
  • @moewe Then bibtex should perhaps issue an error message. As long as there are only warnings, one could consider that the input is more or less valid and expect the output to be valid as well. I agree nevertheless that spending much time on correcting this might not be worth. – Eric Domenjoud Feb 03 '19 at 14:47
  • As far as I can see .bst style authors can only issue BibTeX warnings and not errors (unless they deliberately cause a real error, of course), so the style is making use of the fullest potential available to it. (Theoretically there are ways to carry over BibTeX errors to LaTeX, especially if there is a companion package, but I firmly believe that it is outside of what could reasonably be expected from a developer.) Note that the output is not completely unusable or garbage, so I would hesitate to call it 'invalid': It looks odd, but that's what you have to expect if you ignore warnings. – moewe Feb 04 '19 at 13:53
  • @moewe You are completely right. I missed the fact that warnings is the best a bibtex style designer can do. You are also right when you say that the output is not really invalid. But still, it is not a very good idea to put a blank line in the middle of a reference. A bibtex style should never issue a \newblock command before being sure that the block is not empty. apacite does not check for this. It issues \newblock commands and then builds the block which might end up empty. This is not a very good design IMHO. – Eric Domenjoud Feb 04 '19 at 15:16