andras-simonyi / citeproc-el

A CSL 1.0.2 Citation Processor for Emacs.
GNU General Public License v3.0
85 stars 9 forks source link

Hyprref configuration question: PDF links #24

Closed bdarcus closed 3 years ago

bdarcus commented 3 years ago

Maybe something for the wiki if we can get it working right.

With a note style, in particular, default rendering of links with hyprref is horrible.

Screenshot from 2021-06-03 07-33-21

Adding colorlinks = true is an improvement, but still less-than-ideal, as the note text is then just red.

Screenshot from 2021-06-03 07-27-36

Anyone know how to address this?

cc @denismaier

denismaier commented 3 years ago

According to this question \usepackage[hidelinks]{hyperref} should solve the problem.

bdarcus commented 3 years ago

Here's another option; this turns all links "MidnightBlue":

% https://tex.stackexchange.com/questions/100905/best-practice-for-hyperref-link-colours
\usepackage[dvipsnames]{xcolor}
\newcommand\myshade{85}

\hypersetup{
 colorlinks = true,
 allcolors = MidnightBlue!\myshade!black,
}

Screenshot from 2021-06-03 08-01-44

Or if you want different colors for different links:

\newcommand\myshade{85}
\colorlet{mylinkcolor}{violet}
\colorlet{mycitecolor}{YellowOrange}
\colorlet{myurlcolor}{Aquamarine}

\hypersetup{
  linkcolor  = mylinkcolor!\myshade!black,
  citecolor  = mycitecolor!\myshade!black,
  urlcolor   = myurlcolor!\myshade!black,
  colorlinks = true,
}

Screenshot from 2021-06-03 08-41-28

@andras-simonyi - should I put this on the wiki? If yes, page name preference?

bdarcus commented 3 years ago

Actually, I can't edit the wiki.

But one of you should be able to copy, post, slightly edit what I've added here if you like.

andras-simonyi commented 3 years ago

@bdarcus: did you intend to reopen this issue? Apart from adding the above tricks/solutions to the wiki I see only one additional step that could perhaps be taken: to automatically turn off linking cites to bibliography items when a note style is used. AFAICS biblatex does this. Would this be useful? (Note that one can already turn off cite linking using variables both in citeproc-org and org-cite).

bdarcus commented 3 years ago

Yes, I reopened it since it's connected to the other issue, and so just to remind you two while you're working on that.

I think your suggestion makes sense.

andras-simonyi commented 3 years ago

I'm thinking about introducing three possible options for internally linking cites and bib items when rendering: something like no, yes, and auto where auto wouldn't link cites when a note style is used and would be the default. But I'm a bit unsure about the use cases here, is it really true that linking note cites is mostly useless? @denismaier: how do you see this? EDIT: I see a particular problem with not linking Ibid.-type note cites. Maybe some other type of criteria would be more useful, e.g., whether the title was rendered or not? EDIT2: biblatex Chicago links Ibid in notes, but -- I think -- to the relevant previous note containing the first cite, this would be more difficult to implement than linking to the bibliography item

bdarcus commented 3 years ago

I mean, the examples I posted above do make the linking much more subtle, so that alone probably shouldn't determine.

andras-simonyi commented 3 years ago

Looking at how Pandoc's Citeproc and the biblatex Chicago note implementation handles internal linking it turned out that the Pandoc Citeproc simply turns linking off for note styles, while biblatex links later cites to the earlier ones containing full bibliographic information. Since the second strategy seemed to be more reasonable I implemented (a simple version of) it, it's been already merged into master. (See #35, there is an option to get standard linking to bib items even for note styles.)

As for the rather different issue of link formatting in LaTeX generated pdf-s, I think most of the problems are not specific to citeproc-el (the only exception is the subject of issue #34), e.g., all the above information could be useful for anyone who attempts to export an Org document with internal links to pdf. Nonetheless, if you think it'd be useful it can be added to the citeproc-el wiki -- I've invited you to collaborate.

bdarcus commented 3 years ago

Wiki page:

https://github.com/andras-simonyi/citeproc-el/wiki/LaTeX-styling

Might be good to borrow some of that when you do implement the suggestions in #34, so it's easy for folks to get beautiful out-of-box output.

tecosaur commented 3 years ago

Since the wiki isn't anybody-edit, I'll leave a brief comment on style here based on my own usage (https://tecosaur.github.io/emacs-config/config.html#latex-fancy-hyperref).

I think it's nicer to use named colours with no blending in \hypersetup because that way it's easy to change them. In particular, if you define the colours with \providecolor that means that if somehow` I've already defined the colour, that original definition is left alone.

bdarcus commented 3 years ago

Since the wiki isn't anybody-edit ...

Any reason not to remove the editing restriction @andras-simonyi?

I think it's nicer to use named colours with no blending in \hypersetup because that way it's easy to change them. In particular, if you define the colours with \providecolor that means that if somehow` I've already defined the colour, that original definition is left alone.

So these are the key lines?

\providecolor{cite}{named}{blueygreen}

Might be a bit until I can get this, given screenshots, etc.

tecosaur commented 3 years ago

\providecolor{cite}{named}{blueygreen} is indeed a key line. The documentation for \providecolor may be helpful here.

\providecolor [type]{name}{model-list}{spec-list}

Similar to \definecolor, but the color <name> is only defined if it does not exist already.

So in my config I use \colorlet to define a shade as a mix of colours (much as you do) and assign it to a name. Then I use \providecolor to set the color cite to that as long as cite hasn't already been defined.

Does that clear things up?

andras-simonyi commented 3 years ago

Apologies, I've removed the editing restrictions, it wasn't intentional.