latex3 / latex3/hyperref

smaller size of links in subscripts and superscripts with latex&dvips

Open
#299 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TeX
Stars
205
Forks
41
PR merge metrics
No merged PRs in 30d

Description

Feeding

\documentclass{article}
\usepackage{amssymb}
\usepackage[hidelinks]{hyperref}
\newcommand{\nonnegativeNat}{\href{http://en.wikipedia.org/wiki/Natural_number}{\mathbb{N}}}
\begin{document}
\[\nonnegativeNat^{\nonnegativeNat^{\nonnegativeNat}}\]
\end{document}

to latex followed by dvips yields normal-size superscripts and supersuperscripts in DVI and Postscripts:
grafik
grafik
This is bad. Following https://tex.stackexchange.com/questions/399705/gls-in-the-subscript-has-too-normal-size#comment994726_399705 , we insert \text{$…$} for the first-order and second-order scripts on the latex-dvips route and leave the command as it is for all the other cases:

\documentclass{article}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage[hidelinks]{hyperref}
\ifTUTeX%%% xelatex and lualatex produce PDF only
  \newcommand{\nonnegativeNat}{\href{http://en.wikipedia.org/wiki/Natural_number}{\mathbb{N}}}
\else
  \ifpdf%%% for pdflatex
    \newcommand{\nonnegativeNat}{\href{http://en.wikipedia.org/wiki/Natural_number}{\mathbb{N}}}
  \else%%% for latex
    \newcommand{\nonnegativeNat}{%
      \mathchoice%
      {\href{http://en.wikipedia.org/wiki/Natural_number}{\mathbb{N}}}%
      {\href{http://en.wikipedia.org/wiki/Natural_number}{\mathbb{N}}}%
      {\text{$\href{http://en.wikipedia.org/wiki/Natural_number}{\mathbb{N}}$}}%
      {\text{$\href{http://en.wikipedia.org/wiki/Natural_number}{\mathbb{N}}$}}%
    }
  \fi
\fi
\begin{document}
\[\nonnegativeNat^{\nonnegativeNat^{\nonnegativeNat}}\]
\end{document}

This luckily yields smaller sizes in superscripts and supersuperscripts in DVI and Postscript:
grafik
grafik
Is there any problem with this solution (except the blue color and the underlining, as this would be a different issue)? If so, what is it? If there's no problem, is {\text{$\href{http://en.wikipedia.org/wiki/Natural_number}{\mathbb{N}}$}} somehow simplifiable (I believe it does more than we need to)? For example,

\documentclass{article}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage[hidelinks]{hyperref}
\ifTUTeX%%% xelatex and lualatex produce PDF only
  \newcommand{\nonnegativeNat}{\href{http://en.wikipedia.org/wiki/Natural_number}{\mathbb{N}}}
\else
  \ifpdf%%% for pdflatex
    \newcommand{\nonnegativeNat}{\href{http://en.wikipedia.org/wiki/Natural_number}{\mathbb{N}}}
  \else%%% for latex
    \newcommand{\nonnegativeNat}{%
      \mathchoice%
      {\href{http://en.wikipedia.org/wiki/Natural_number}{\displaystyle\mathbb{N}}}%
      {\href{http://en.wikipedia.org/wiki/Natural_number}{\textstyle\mathbb{N}}}%
      {\href{http://en.wikipedia.org/wiki/Natural_number}{\scriptstyle\mathbb{N}}}%
      {\href{http://en.wikipedia.org/wiki/Natural_number}{\scriptscriptstyle\mathbb{N}}}%
    }
  \fi
\fi
\begin{document}
\[\nonnegativeNat^{\nonnegativeNat^{\nonnegativeNat}}\]
\end{document}

seems to produce the same (visually correct) sizes in the output.

Or does hyperref have a command doing the whole thing for us already? We really don't wish to reinvent the wheel.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal hyperref example using latex followed by dvips, and compare its superscript and supersuperscript output with the pdflatex and LuaTeX cases. Investigate the proposed \mathchoice and style-based alternatives in the hyperref package, then verify that the chosen behavior produces correctly sized linked math in DVI and PostScript without breaking other output routes.

Written by the indexing model from the issue text.

Assessment

Tech stack
latex
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.