After extensive discussion with Barbara Beeton in the chat room, and later with David Carlisle in the same place, I was recommended by both to write my question here; it has just taken some hours to strip everything down to as minimal of a working example as possible, and still get the problem reproduced by arXiv's mysterious TeX environment.
As suggested here by Tom Hejda (who works for Overleaf), I have selected to use TeX Live 2017 with Overleaf so that it emulates arXiv's environment as closely as possible. In Overleaf my MWE (minimal working example) leads to a 3-line bibliographic entry that wraps around such that the first two lines are perfectly right-justified:

The same MWE compiles in arXiv with no errors but the right-justification is not as nice:
Both PDFs were generated using the following MWE code:
\documentclass[amsmath,amssymb,aps,twocolumn]{revtex4-1}
\listfiles
\begin{document}
\cite{Daday2012}
%\input{main.bbl}
\begin{thebibliography}{48}
\makeatletter
\providecommand \bibnamefont [1]{#1}%
\providecommand \bibfnamefont [1]{#1}%
\providecommand \citenamefont [1]{#1}%
\let\auto@bib@innerbib\@empty
\bibitem [{\citenamefont {Daday}\ \emph {et~al.}(2012)\citenamefont {Daday},
\citenamefont {Smart}, \citenamefont {Booth}, \citenamefont {Alavi},\ and\
\citenamefont {Filippi}}]{Daday2012}%
\BibitemOpen
\bibfield {author} {\bibinfo {author} {\bibfnamefont {C.}~\bibnamefont
{Daday}}, \bibinfo {author} {\bibfnamefont {S.}~\bibnamefont {Smart}},
\bibinfo {author} {\bibfnamefont {G.~H.}\ \bibnamefont {Booth}}, \bibinfo
{author} {\bibfnamefont {A.}~\bibnamefont {Alavi}}, \ and\ \bibinfo {author}
{\bibfnamefont {C.}~\bibnamefont {Filippi}},\ }\href {\doibase
10.1021/ct300486d} {\bibfield {journal} {\bibinfo {journal} {Journal of
{C}hemical {T}heory and {C}omputation}\ }\textbf {\bibinfo {volume} {8}},\
\bibinfo {pages} {4441} (\bibinfo {year} {2012})}\BibitemShut {NoStop}
\end{thebibliography}
\end{document}
I used \listfiles
to confirm that arXiv's environment has almost identical packages when compared to Overleaf. For Overleaf we have:
*File List*
revtex4-1.cls 2010/07/25/20:33:00 4.1r (http://publish.aps.org/revtex4/ for documentation)
aps4-1.rtx
aps10pt4-1.rtx
textcase.sty 2004/10/07 v0.07 Text only upper/lower case changing (DPC)
amssymb.sty 2013/01/14 v3.01 AMS font symbols
amsfonts.sty 2013/01/14 v3.01 Basic AMSFonts support
amsmath.sty 2016/11/05 v2.16a AMS math features
amstext.sty 2000/06/29 v2.01 AMS text
amsgen.sty 1999/11/30 v2.0 generic functions
amsbsy.sty 1999/11/29 v1.2d Bold Symbols
amsopn.sty 2016/03/08 v2.02 operator names
url.sty 2013/09/16 ver 3.4 Verb mode for urls, etc.
natbib.sty 2010/09/13 8.31b (PWD, AO)
revsymb4-1.sty 2010/07/25/20:33:00 4.1r (http://publish.aps.org/revtex4/ for documentation)
***********
For arXiv we have identical packages, except for amsmath.sty for which Overleaf is 5 months newer, but this makes no difference because with TeX Live 2015 on my own laptop, I got exactly the same result as with Overleaf despite having an amsmath.sty that's 3 months older than arXiv's. Here's arXiv's packages:
*File List*
revtex4-1.cls 2010/07/25/20:33:00 4.1r (http://publish.aps.org/revtex4/ for documentation)
aps4-1.rtx
aps10pt4-1.rtx
textcase.sty 2004/10/07 v0.07 Text only upper/lower case changing (DPC)
amssymb.sty 2013/01/14 v3.01 AMS font symbols
amsfonts.sty 2013/01/14 v3.01 Basic AMSFonts support
amsmath.sty 2016/06/28 v2.15d AMS math features
amstext.sty 2000/06/29 v2.01 AMS text
amsgen.sty 1999/11/30 v2.0 generic functions
amsbsy.sty 1999/11/29 v1.2d Bold Symbols
amsopn.sty 2016/03/08 v2.02 operator names
url.sty 2013/09/16 ver 3.4 Verb mode for urls, etc.
natbib.sty 2010/09/13 8.31b (PWD, AO)
revsymb4-1.sty 2010/07/25/20:33:00 4.1r (http://publish.aps.org/revtex4/ for documentation)
Unfortunately arXiv also has all these, which weren't listed by Overleaf's compiler, nor my own local one:
hyperref.sty 2016/06/24 v6.83q Hypertext links for LaTeX
hobsub-hyperref.sty 2016/05/16 v1.14 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty 2016/05/16 v1.14 Bundle oberdiek, subset generic (HO)
hobsub.sty 2016/05/16 v1.14 Construct package bundles (HO)
infwarerr.sty 2016/05/16 v1.4 Providing info/warning/error messages (HO)
ltxcmds.sty 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
ifluatex.sty 2016/05/16 v1.4 Provides the ifluatex switch (HO)
ifvtex.sty 2016/05/16 v1.6 Detect VTeX and its facilities (HO)
intcalc.sty 2016/05/16 v1.2 Expandable calculations with integers (HO)
ifpdf.sty 2016/05/14 v3.1 Provides the ifpdf switch
etexcmds.sty 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
kvsetkeys.sty 2016/05/16 v1.17 Key value parser (HO)
kvdefinekeys.sty 2016/05/16 v1.4 Define keys (HO)
pdftexcmds.sty 2016/05/21 v0.22 Utility functions of pdfTeX for LuaTeX (HO)
pdfescape.sty 2016/05/16 v1.14 Implements pdfTeX's escape features (HO)
bigintcalc.sty 2016/05/16 v1.4 Expandable calculations on big integers (HO)
bitset.sty 2016/05/16 v1.2 Handle bit-vector datatype (HO)
uniquecounter.sty 2016/05/16 v1.3 Provide unlimited unique counter (HO)
letltxmacro.sty 2016/05/16 v1.5 Let assignment for LaTeX macros (HO)
hopatch.sty 2016/05/16 v1.3 Wrapper for package hooks (HO)
xcolor-patch.sty 2016/05/16 xcolor patch
atveryend.sty 2016/05/16 v1.9 Hooks at the very end of document (HO)
atbegshi.sty 2016/06/09 v1.18 At begin shipout hook (HO)
refcount.sty 2016/05/16 v3.5 Data extraction from label references (HO)
hycolor.sty 2016/05/16 v1.8 Color options for hyperref/bookmark (HO)
keyval.sty 2014/10/28 v1.15 key=value parser (DPC)
ifxetex.sty 2010/09/12 v0.6 Provides ifxetex conditional
auxhook.sty 2016/05/16 v1.4 Hooks for auxiliary files (HO)
kvoptions.sty 2016/05/16 v3.12 Key value format for package options (HO)
pd1enc.def 2016/06/24 v6.83q Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg 2009/12/28 v1.0 hyperref configuration at arXiv.org
hdvips.def 2016/06/24 v6.83q Hyperref driver for dvips
pdfmark.def 2016/06/24 v6.83q Hyperref definitions for pdfmark specials
rerunfilecheck.sty 2016/05/16 v1.8 Rerun checks for auxiliary files (HO)
nameref.sty 2016/05/21 v2.44 Cross-referencing by name of section
gettitlestring.sty 2016/05/16 v1.5 Cleanup title references (HO)
There's related questions on TeX.SE:
- Justified Bibliographies Without Hyphenation
- Why quoted word is not hyphenated?
- Bibliographic entries: URL strings too long
- word wrapping line question
- Word-wrapping page-long polynomials in latex
- Word wrapping for long strings with no spaces in a long table
But these don't solve this problem, because those questions deal with long URLs, or long quotes, long strings, or equations not being hyphonated to achieve right-justification; but in my case there is no URL and no quote, and not even any hyphonation needed!
There might be a solution using the package fancyvrb
:
But it wouldn't explain why arXiv is unable to do what Overleaf and my local laptop can do.
While this question is interesting:
It is for the case where the Overleaf bbl file is causing errors in arXiv, whereas in my case there's no errors!
While the above two screenshots appear as if the arXiv version isn't very different, that is only the result after hours of stripping things down to a MWE. In the original version you can see why I (badly) want to fix the arXiv version:
Overleaf, and my local laptop:
arXiv:
arXiv adds hyperref
without telling the user:
And by turning it off using a 00README.XXX file with nohypertex
in it, the arXiv PDF looks the same as the Overleaf and local PDFs, but then my publication's citations wouldn't be reachable by clicking on their corresponding numbers in the main text. Is there a way to do get right-justification in the bibliography in revtex4.1 with arXiv, without turning off hyperref?
hyperref
(and the other packages) to your MWE reproduce the bug on Overleaf?