Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to include author as part of hyperlink with authoryear style #1024

Open
TakingItCasual opened this issue Jul 13, 2020 · 2 comments
Open

Comments

@TakingItCasual
Copy link

Based on the following TeX.SE post: https://tex.stackexchange.com/a/27107

Basically, in addition to the date I'd like for the author to be part of the hyperref that links to the bibliography. Additional (or all) citation parts and styles could also be considered.

There aren't comments or answers mentioning a native solution, so I'm assuming nothing's been implemented. PLK left a comment 4 years ago, so I'm curious as to why this hasn't been implemented. They mentioned the desire to make it default behavior, but if that's too much to ask, I'd settle for an option to set somewhere.

@moewew
Copy link
Collaborator

moewew commented Jul 13, 2020

See also #428.

The thing is that if you want to pull off a large continuous link target with a consistent output across styles and citation commands, things are going to be difficult. If you look at the answer https://tex.stackexchange.com/a/27107/35864 you linked, you'll see that the link target in \textcite differs depending on whether or not a postnote is present. That was not arbitrary or a simple oversight: It's just extremely tricky to get a large link target if postnotes are involved and you want to stick with the current implementation of citation commands. I don't want to have to change the implementation of the citation commands in a way that would be required to make consistently larger link targets possible (and I haven't checked whether it would be possible/viable to do that in the first place, I only have a rough idea of what would definitely be required). But then I also don't think it is a great look to apply link targets inconsistently.

It is more realistic to produce several small link targets. But then I feel the only reasonable course of action is to only link the author and the year (separately, mind you). That's what I've shown in https://tex.stackexchange.com/q/537426/35864.

As always we have to consider the impact of such a change. Any change to often used and modified bibmacros (like the ones that would be involved here) has the potential to break people's preambles or styles. Plus everything that modifies the actual output would be problematic from a backwards compatibility point of view (changing link targets is probably not a big issue, but it should still be mentioned).

@ozross
Copy link

ozross commented Feb 21, 2022

Where you are using the word target, I assume you actually mean anchor; which is the region that is active for clicking the hyperlink.
There is another problem with having a single long anchor, when it is needed to break across 2 (or more) lines, or even across 2 pages. It is far better to have multiple smaller anchors that you can be confident each will be on a single line.

Although pdfTeX can break a hyperlink, it does so by internally creating 2 hyperlink anchors for the same target destination. This is fine, until you come to attempting valid tagged PDF, as will ultimately be needed with accessible formats. As this breaking action is taken at page shipout time, there is no way of knowing the object number of that 2nd anchor while processing LaTeX macros alone. The result is a Link object that is not included within the PDF's structure tree; hence validation will fail for modern accessible PDF/UA formats.

The only way, so far, to deal with this is to manually recognise the places where this occurs, and do one of 2 things:

  1. adjust the wording within the paragraph, to keep the complete anchor on a single line;
  2. break the anchor text into 2 pieces, each on a single line.
    This 2nd option is extremely difficult with anchor-text that must to be automatically generated from other source: citations, cross-references, glossary items, etc. as is wanted here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants