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

Circuit library: Omega symbol not showing up in the resistor label when using package fontspec #1383

Open
voen-void opened this issue Feb 3, 2025 · 5 comments

Comments

@voen-void
Copy link

voen-void commented Feb 3, 2025

Brief outline of the bug

I copied the code from https://tikz.dev/library-circuits#sec-49.1.1 to try out the circuit library.
I intended to use the circuit library in my thesis, in which I need to use the fontspec package to set a special font on the title page of the document (requirement of my uni). Upon compiling, I noticed the Omega symbol missing in the resistor label in the schematic. Compiler I used is XeLaTeX, though the same happens in LuaLaTeX. After some investigation I found out that this behaviour only appears if the package fontspec is loaded -- when I remove it, the symbol shows up normally. I also found out that if I import the package fontspec with the option [no-math] the Omega symbol shows up normally in schematic labels. In either case I'm able to use math typesetting, and $4\ \Omega$ works as expected. I'm not sure if I'm missing something, or if this is a bug in the package.

Minimal working example (MWE)

\documentclass{article}

\usepackage{fontspec} % this is the trouble maker
%\usepackage[no-math]{fontspec} % this works

\usepackage{tikz}
\usetikzlibrary{circuits.ee.IEC}

\begin{document}

Math typesetting test: $4\ \Omega$.

\begin{tikzpicture}[circuit ee IEC]
    \draw (0, 1) to [resistor={ohm=4}] (2, 1);
\end{tikzpicture}

\end{document}
@hmenke
Copy link
Member

hmenke commented Feb 3, 2025

@hmenke hmenke closed this as completed Feb 3, 2025
@voen-void
Copy link
Author

Not a MWE. See I've just been asked to write a minimal example, what is that?

I updated the 'MWE' -- I hope it complies with the requirements now.

@hmenke hmenke reopened this Feb 3, 2025
@hmenke
Copy link
Member

hmenke commented Feb 4, 2025

Compare

$4 \Omega$\par
$\mathrm{4 \Omega}$\par
$\mathrm{4 Ω}$

Image

To work around this use

\tikzset{circuit declare unit={ohm}{Ω}}

or (as you have already discovered)

\usepackage[no-math]{fontspec}

@hmenke
Copy link
Member

hmenke commented Feb 4, 2025

See also josephwright/siunitx#435 for an in-depth discussion why this happens.

@voen-void
Copy link
Author

Thank you for the reply and workaround -- it works! The thread you mentioned is very informative, I was surprised that this issue goes so deep.

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

No branches or pull requests

2 participants