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

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

Open
ghost opened this issue Sep 6, 2023 · 0 comments
Open

Comments

@ghost
Copy link

ghost commented Sep 6, 2023

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.

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

No branches or pull requests

0 participants