11

I am currently trying to produce a numero sign which adapts to the used font and has a double underline as in the image:

Required result

The \textnumero macro from the textcomp package does not have the double underline and does not match my font. Trying to reproduce it based on existing answers like this or this did not lead to the desired result as well.

This is my current code which is closer to the desired result than \textnumero, but still does not match perfectly:

\documentclass{scrartcl}
\usepackage[utf8]{inputenc}

\usepackage{graphicx}

\usepackage{ulem,amssymb}
\newcommand{\Number}[1]{%
    $\mathcal N$\kern-.15em\textsuperscript{\smash{\uuline{\normalfont\itshape \scalebox{.7}{o}}{}}} #1%
}

\usepackage{yfonts}

\begin{document}

\frakfamily

\Number{4}

\end{document}

Current result

How can I improve it or which other approach can I take here?

epR8GaYuh
  • 2,432
  • 1
    What do you mean by "adapt"? Only the font size or also e.g. to the font weight or the font family? – Ulrike Fischer Mar 21 '20 at 08:37
  • 1
    The font size is most important. As far as I am aware of, there is no real bold font inside yfrak, so the weight does not matter for me. I am not sure about the font family, but as the N does not seem to be a real fraktur version here, the font family does not seem to be relevant in this specific case - the result just should not stand out completely from the regular text as it does with textcomp. – epR8GaYuh Mar 21 '20 at 08:48
  • Well if your "regular" test is really in yfrak, then avoid to use the numero symbol. I don't think that you will find something fitting. There is no tradition for it in fraktur and in german. (And there is no tradition for the double line anyway too). – Ulrike Fischer Mar 21 '20 at 10:23
  • The image of the desired result is indeed taken from an old German book written in fraktur from the mid of the 19th century. It may be uncommon, but at least this example used this type of the numero symbol. – epR8GaYuh Mar 21 '20 at 19:39

3 Answers3

7

Similar approach with a TABstack. It adapts to fontsize changes.

\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{yfonts}
\usepackage{tabstackengine}
\newcommand\Number{\begingroup\setstackgap{S}{0.08ex}%
  \ensureTABstackMath{\stackinset{r}{-.05em}{c}{}{\tabbedShortunderstack{%
  \scalebox{.7}{$\scriptscriptstyle o$}\\\TABrule\\\TABrule}}{$\mathcal{N}$}}%
  \endgroup}
\begin{document}
\frakfamily

\Number\,4

\Huge\Number\,4
\end{document}

enter image description here

7

This yields a similar result as in the example, and it adapts well to different font sizes.

\documentclass{article}
\usepackage{amsmath}
\usepackage{pict2e}
\newlength{\fslength}
\newlength{\fthickness}
\DeclareFontFamily{U}{eus}{\skewchar\font'60}
\DeclareFontShape{U}{eus}{m}{n}{%
    <5><6><7><8><9>gen*eusm%
    <10><10.95><12><14.4><17.28><20.74><24.88>eusm10}{}
\DeclareMathAlphabet\EuScript{U}{eus}{m}{n}
\makeatletter
\newcommand{\Number}[1]{%
    \setlength{\fslength}{\f@size pt}%
    \setlength{\fthickness}{.04\fslength}%
    \pdfsave\pdfliteral{1 0 .25 1 0 0 cm}\rlap{$\EuScript{N}$}\pdfrestore%
    \phantom{$\EuScript{N}$}%
    \rule[.16\fslength]{.25\fslength}{\fthickness}\hspace*{-.23\fslength}%
    \rule[.24\fslength]{.25\fslength}{\fthickness}\hspace*{-.30\fslength}%
    \raisebox{.24\fslength}[.4\fslength]{%
        \centering%
        \setlength{\unitlength}{\fslength}%
        \begin{picture}(.3,.3)
            \linethickness{\fthickness}
            \put(.2,.2){\circle{.2}}
        \end{picture}%
    } #1%
}
\makeatother

\begin{document}
{\scriptsize This is \Number{4} for a test.}

{\small This is \Number{4} for a test.}

This is \Number{4} for a test.

{\large This is \Number{4} for a test.}

{\Large This is \Number{4} for a test.}
\end{document}

As it is, this example has to be compiled with pdfLaTeX. If it were to be compiled with XeLaTeX or LuaLaTeX, the lines

\pdfsave\pdfliteral{1 0 .25 1 0 0 cm}\rlap{$\EuScript{N}$}\pdfrestore%
\phantom{$\EuScript{N}$}%

would have to be changed. The N symbol that I used in this example is a slanted version of the N in Euler script font, but I'm not sure how it can be slanted using other compilers. In any case, the above lines could be changed to simply

$\mathcal{N}$\hspace*{-.2\fslength}%

to yield a similar result than in the picture given at the beginning, but with a computer modern \mathcal{N}.

Vincent
  • 20,157
6

Not as wide as in the example, but quite similar. A Cyrillic “number sign” with a second bar added.

\documentclass{article}
\usepackage{pict2e,picture}
\usepackage[T2A,T1]{fontenc}

\newcommand{\simplens}{%
  {\normalfont\fontencoding{T2A}\itshape\symbol{'235}}%
}
\DeclareRobustCommand{\ns}{%
  \simplens
  \begin{picture}(0,0)
  \linethickness{0.065ex}
  \roundcap
  \put(-0.225em,0.3ex){\line(1,0){0.215em}}
  \end{picture}%
}

\begin{document}

Some text and \ns~1.

{\Large \ns~4}

\end{document}

enter image description here

egreg
  • 1,121,712