0

Original question

Suppose I have the following in a bibliography file:

@misc{
  proofwiki,
  title={{Definition:Collation - ProofWiki}},
  author={{ProofWiki}},
  journal={{ProofWiki}},
  year={2021},
  howpublished={
    \goto
      {link}
      [
        url(
          "http://wiki.contextgarden.net"
        )
      ]
  }
}

I'm using ConTeXt to compile this file, and the URL inside the \goto command allows me to make sure that the bibliography entry has a live link inside the pdf.

Now, suppose I want to enforce clean code, with a max column 31 in the bib file. I tried breaking up the link as follows:

@misc{
  proofwiki,
  title={{Definition:Collation - ProofWiki}},
  author={{ProofWiki}},
  journal={{ProofWiki}},
  year={2021},
  howpublished={
    \goto
      {link}
      [
        url(
          "http://wiki.context"
          "garden.net"
        )
      ]
  }
}

Unfortunately, ConTeXt considers the line break in the .bib file a space in the actual URL. So I get a broken link in the PDF. I suppose the same goes for LaTeX in combination with \href.

How can I achieve line continuation without breaking the link?

Edit

As requested, please find a MWE below:

test.tex

\usebtxdefinitions[aps]
\usebtxdataset[bibliography.bib]
\setupinteraction[state=start]


\starttext
 
  \startbodymatter
    See \cite[proofwiki]
  \stopbodymatter

  \startbackmatter
    \startsection[title=Bibliography]
      \placelistofpublications
    \stopsection
  \stopbackmatter
\stoptext

bibliography.bib

@misc{
  proofwiki,
  title={{Definition:Collation - ProofWiki}},
  author={{ProofWiki}},
  journal={{ProofWiki}},
  year={2021},
  howpublished={
    \goto
      {link}
      [
        url(
          "https://proofwiki.org/wiki/Definition:Language_of_Propositional_Logic"
        )
      ]
  }
}
2
  • 1
    Hi. It would be nice to have a self-contained MWE. You may try \useURL [wiki] [http://contextgarden.net] in your bibliography configuration file and call it as \url[wiki] in your .bib file.
    – sztruks
    Mar 27 at 14:53
  • @sztruks that's not really the solution I'm looking for. You could imagine having a URL so long it would overflow the desired number of columns in any ASCII file you dropped it into regardless of how short the preceding command would be. I would still need to break it up into multiple lines at some point. Please find MWE in edit to original question...
    – user32882
    Mar 27 at 15:22

1 Answer 1

3

First, note that you are not just doing linebreak, you are converting one string to two stings!

  howpublished={
    \goto
      {link}
      [
        url(
          "http://wiki.contextgarden.net"
        )
      ]
  }

vs

  howpublished={
    \goto
      {link}
      [
        url(
          "http://wiki.context"
          "garden.net"
        )
      ]
  }

This would never work!

If you insert a literal line break, then it works[^1]

  howpublished={
    \goto
      {link}
      [
        url(
          "http://wiki.context
           garden.net"
        )
      ]
  }

[^1]: That depends a bit on the pdf viewer as well. I tested on zathura + firefox, which opens the link correctly.

4
  • I see absolutely no difference between your second and third examples. Furthermore it looks exactly the same as the code which didn't work in my question!
    – user32882
    Mar 28 at 17:09
  • Pasted the wrong example. Try now
    – Aditya
    Mar 28 at 19:32
  • It works. Thanks.
    – user32882
    Mar 28 at 19:58
  • would you mind taking a look at a very similar question here (tex.stackexchange.com/questions/639028/…). I tried applying the same approach as done in my bibliography above but it didn't work. Thanks!
    – user32882
    Mar 30 at 17:24

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.