BibTeX automatically restricts the generated .bbl file to have at most 80 characters in each line. This can have unintended consequences. For instance, I am using the apsrev4-1 bibliography style for APS journals, and this style automatically converts DOI (identifiers for scientific papers) from the .bib file into URLs by turning them into the following: \href {\doibase xxxx.xxxxx} where \doibase is simply a command that inserts http://dx.doi.org/ and xxxx.xxxxx is the DOI of the given paper. This space does not cause problems in most cases, and the URL gets formatted as http://dx.doi.org/xxxx.xxxxx in the bibliography. However, it can happen that BibTeX decides to break the line between \doibase and the DOI, in which case a space is added and the URL is formatted as http://dx.doi.org/ xxxx.xxxxx which is incorrect and causes problems in some PDF viewers.

I would like to fix this by forcing BibTeX to break the line before each \href. I have been trying to modify the .bst file for this but I have been unsuccessful, the newline$s do not appear in the appropriate place. How can I force linebreaks before all bibliography links?


In order to reproduce this behavior, I will use the bibliography style apsrev4-1.bst provided by the package RevTeX, but it also needs to be modified to display article titles, as per this answer. The file is very long, so I have copied it here for convenience: paste.ee/p/tj5zj.

If you save this file as apsrev-mod.bst, the minimal working example is then as follows:


  title = {Long title so that it just happens that the line gets broken appropriately},
  author = {Author, A and Author, B},
  year = {2021},
  publisher = {Publisher},
  doi = {xxxx.xxxxx},
  journal = {Journal}



  • How about copying the contents of the bbl file, editing it suitably, and putting it inside \begin{thebibliography}{5} and \end{thebibliography} in your main tex file ? (be sure to remove lines \bibliographystyle{apsrev-mod}, \bibliography{bibliography}, and \begin{filecontents}.....\end{filecontents}). Commented Mar 19, 2021 at 7:36

1 Answer 1


Here is a workaround for your problem that does not involve forcing a line break. Instead of using \doibase we simply write out the (new) DOI base URL in the .bst file without a space. BibTeX will then not break the line at the space and everything is fine.

The problem with forcing a newline$ is that the style writes out the entire bibliography entry at once with relatively few write$ or newline$ instructions. So if we want to force a new line, we need to get in at exactly the right time. What's more, we can't have a line break before \href, because the style hard-codes the previous space with \ and the line break would then produce and additional (unwanted) space.

So I would just change the .bst file as follows

--- apsrev-mod.bst  2021-03-19 08:38:36.360594000 +0100
+++ apsrev-moddoi.bst   2021-03-19 08:38:27.266269000 +0100
@@ -1795,7 +1795,7 @@
 FUNCTION {doi.base.command}
-  "\doibase "
+  "https://doi.org/"
 FUNCTION {noop.command}

The new file is available at https://gist.github.com/moewew/797b5747b6c75bd69dec33f0ecfe8179 and produces the following .bbl entry for the MWE

\bibitem [{\citenamefont {Author}\ and\ \citenamefont {Author}(2021)}]{entry}%
  \bibfield  {author} {\bibinfo {author} {\bibfnamefont {A.}~\bibnamefont
  {Author}}\ and\ \bibinfo {author} {\bibfnamefont {B.}~\bibnamefont
  {Author}},\ }\bibfield  {title} {\emph {\bibinfo {title} {Long title so that
  it just happens that the line gets broken appropriately},}\ }\href
  {https://doi.org/xxxx.xxxxx} {\bibfield  {journal} {\bibinfo  {journal}
  {Journal}\ } (\bibinfo {year} {2021}),\ xxxx.xxxxx}\BibitemShut {NoStop}%
  • Works perfectly, and makes me mildly angry that I hadn't thought of that. Thanks!
    – greyg
    Commented Mar 19, 2021 at 16:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .