I am creating a circuit diagram, and noticed that the voltage signs are not aligned vertically.
I have manually added the red overlay to highlight the issue.
I used XeLaTeX through LaTeXmk, and here is the code:
\documentclass{standalone}
\usepackage{unicode-math}
\setmathfont{Latin Modern Math}
\usepackage{circuitikz}
\begin{document}
\begin{circuitikz}[american]
\ctikzset{voltage=raised}
\draw (0, 0) to[R=$R_1$, *-*, v=$v_1$] ++ (-2, 0);
\end{circuitikz}
\end{document}
If I remove the unicode-math
package and Latin Modern Math
font, then the issue is fixed.
Is it possible to fix this issue within unicode-math
?
Thanks for the help!
Best Answer
I found the problem: in the standard LaTeX math font, the minus sign has a box that is the same size of the plus sign, and centered. In the Latin Modern Math, the minus has a box which is asymmetric. Look at this example and test with or without
unicode-math
andLatin Modern Math
...With
unicode-math
and the Latin Modern Math:Without
unicode-math
(look at the boxes!)So the problem is that the minus sign is not centered in its box in
unicode-math
. I do not know if this is a feature or not, but given thatcircuitikz
position the nodes one by one, it confounds it.The workaround, as you see, is using:
that fixes the position of the minus sign.