8

Feeding

\documentclass{article}
\pagestyle{empty}
\usepackage{newtxtext}
\usepackage{hyperref}%%% it's bizarre that adding a package for referencing (and not using this package) changes the shapes of unrelated symbols
\begin{document}
\textcircled{0}\textcircled{1}
\end{document}

to [pdf]latex in TeX Live as of 2022-09-26 (not in TeX Live in Debian, version 2021.20211217-1) yields encircled digits in which the circle touches the digit:

output

These shapes are a no-go to us.

Notice that dropping NewTX or hyperref or both yields better encircled digits, in which the circle does NOT touch the digit:

A. Standard, i.e., without NewTX and hyperref (for our purposes tolerable shapes):

standard LaTeX output

B. With NewTX only (good shapes):

NewTX output

C. With hyperref only (for our purposes tolerable shapes):

hyperref output

  1. Why does including NewTX and hyperref together distort the symbols in such a bad way? Who is the culprit?

  2. How to get graphically better symbols ⓪ and ① (in which the circle doesn't touch the digit, say, the symbols from item B above) if we use (for reasons not mentioned in this minimal example) [pdf]latex, NewTX, and hyperref? Naturally, we can draw a circle around the digit with picture, pstricks, or tikz or install the ancient https://ctan.org/pkg/magic , use pifont, and issue \textsmaller[2.5]{\Pisymbol{magic}{48}}} \textsmaller[2.5]{\Pisymbol{magic}{49}}, …. However, perhaps, there might be a straightforward fix of LaTeX, NewTX, or hyperref, or one could somehow use the NewTX definitions of \textcircled{0} and \textcircled{1} after hyperref (of course, one should repair the bounding boxes somehow; cf. How to repair the bounding boxes of circled digits in standard LaTeX, hyperref, NewTX, and magic?).

  3. Let's assume that we need not only text-mode ⓪ and ① but also math-mode ⓪ and ①. Is there anything better and more direct than \text{\textcircled{0}}\text{\textcircled{1}}?

This post is not about UTF-8 engines (with {lua|xe}latex, we get the symbols ⓪ and ① from OTF fonts) and not about encircling anything else besides 0 and 1.

  • 1
    You might want to checkout the circledtext package, which grew out of a previous TeX Stackexchage question on more or less the same topic (which also offers additional solutions). – frabjous Sep 25 '22 at 22:57
  • @frabjous The original question you cited is a bit outdated. As of 2022-09-26, the standard \textcircled{0}\textcircled{9} in Computer Modern are (to my taste) somewhat better than in the image your link. Namely, running pdflatex on https://pastebin.com/raw/fwY6wFz9 yields https://i.imgur.com/nDZZ14q.png : most circles don't touch the digits, whereas in the post you cite, all circles visibly touch the digits. –  Sep 25 '22 at 23:18
  • I mainly linked there as the source of the discussion that led to the circledsteps package. (I accidentally wrote circledtext, but meant circledsteps; the link is correct.) But even if they're not as bad as they were, I don't find those Computer Modern results acceptable. The 5 and 7 do touch and the others are noticeably off center. – frabjous Sep 26 '22 at 00:02
  • @frabjous I saw this, of course. To me, the shapes in the standard, NewTX, or hyperref versions of ⓪ and ① are all tolerable or even acceptable (up to http://tex.stackexchange.com/questions/659530) despite the deficiencies you mentioned. (Only when we use both NewTX and hyperref together, the shapes get so bad that we feel the need to improve.) Also the standard ⑤ and ⑦ today seem better than they were in 2010, though we don't care about ⑤ and ⑦ in this particular post. –  Sep 26 '22 at 03:35

1 Answers1

10

To answer the first question:

By default \textcircled is an encoding depending command. It has a TS1-definition with a fallback coming from OMS for the fonts whose TS1-encoding doesn't have the right support.

hyperref is not only for referencing. hyperref handles also the bookmarks, and so has to be able to translate something like \textcircled in a representation that is visible there. For this it gives \textcircled also an encoding specific definition in the PU encoding.

The default definition of \textcircled doesn't work well for newtx, so the package tries to change it, but it uses \renewcommand and that doesn't work well as hyperref then overwrites the definition again. Loading newtx after hyperref would repair this but break the command in the bookmarks. The best would probably be if newtx would redefine the fallback definition:

\documentclass{article}
\pagestyle{empty}

\usepackage{newtxtext}

\makeatletter \DeclareTextCommand{\textcircled}{OMS}[1]{\hmode@bgroup\ooalign{% \hfil \raise .3ex\hbox{{% \normalfont {\scalefont{.6}\tlfstyle#1}}}% end hbox \hfil \crcr {\usefont{TS1}{ntxtlf}{m}{n}\char"4F}}%\textbigcircle}% \egroup} \makeatother

\usepackage{hyperref}

\begin{document}

\section{\textcircled{0}\textcircled{1}}

\textcircled{0}\textcircled{1}

\end{document}

enter image description here

Ulrike Fischer
  • 327,261
  • Thanks! In case you are curious: the bad shapes in my OP occur with current TeX Live as of 2022-09-26, but in Debian TeX Live as of version 2021.20211217-1, the shapes in the OP are all tolerable or good (the circles don't touch the digits). So, there has been a disimprovement along the road since then :-). –  Sep 26 '22 at 11:41