Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#299 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
latex
Ambito
tooling

Direzione di ricerca

Iniziare con l’esempio minimo di hyperref usando latex seguito da dvips, e confrontare l’output di apici e doppi apici con i casi pdflatex e LuaTeX. Esaminare le alternative proposte basate su \mathchoice e sullo stile nel pacchetto hyperref, quindi verificare che il comportamento scelto produca formule matematiche collegate con dimensioni corrette in DVI e PostScript senza compromettere gli altri percorsi di output.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TeX
Stelle
210
Fork
41
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di latex3/hyperref

Tutte le issue di latex3/hyperref

Issue simili

Altre issue su DevTools

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.