2

I want to create a diameter symbol without using the \usepackage{wasysym}, because it always gives me warnings in other parts of my document like:

LaTeX Font Warning: Font shape U/wasy/b/n' in size <7> not available
(Font)              Font shape U/wasy/m/n' tried instead on input line 36.

How is this possible?

2
  • You should show which symbol you use for diameter. Does simple $\phy$ without using wasysym not satisfying? Many people use it ...
    – Zarko
    Commented 18 hours ago
  • Unicode has U+2300 DIAMETER SIGN in the Miscellaneous Technical codeblock. ?? The albatross utility reports it as being in the TeXGyre... fonts, and NewComputerModern, Libertinus, FreeSerif and many other fonts.
    – Cicada
    Commented 17 hours ago

2 Answers 2

5

The font description file for wasysym has been produced when scalable fonts weren't available and it suffers from this problem; also, the author used sub instead of ssub, which is the main reason for the annoying warning.

\documentclass{article}
\usepackage{wasysym}
\usepackage{siunitx}

% fix the annoying warnings
\DeclareFontFamily{U}{wasy}{}
\DeclareFontShape{U}{wasy}{m}{n}{
  <-5.5>    wasy5  <5.5-6.5> wasy6  <6.5-7.5> wasy7
  <7.5-8.5> wasy8  <8.5-9.5> wasy9  <9.5->    wasy10
}{}
\DeclareFontShape{U}{wasy}{b}{n}{ <-> wasyb10 }{}
\DeclareFontShape{U}{wasy}{bx}{n}{ <-> ssub * wasy/b/n}{}
\DeclareFontShape{U}{wasy}{m}{sl}{ <-> wasysl10 }{}
\DeclareFontShape{U}{wasy}{m}{it}{ <-> ssub * wasy/m/sl }{}
%%%

\begin{document}

The part has a diameter of \diameter \qty{10}{\mm}.

\end{document}

No warning appears.

output

2

You can avoid wasysym and its font warnings by defining a custom diameter symbol using tikz and a small sans-serif capital O.

\documentclass{book}
\usepackage{tikz} % For custom symbol

% Custom diameter command using a small sans-serif O
\newcommand{\mydiameter}{%
  \tikz[baseline=(d.base)] 
    \node[inner sep=0pt, text height=1.2ex, text depth=0.2ex] 
    (d) {\footnotesize\textsf{\O}};}

\begin{document}

The part has a diameter of \mydiameter10~mm.

\end{document}

Output

This avoids the use of \usepackage{wasysym} and you don't get font warnings.

You can fine-tune the size by changing \footnotesize or adjusting the text height/depth values.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.