circuitikz 中的斜体符号

circuitikz 中的斜体符号

有没有办法让 circuitikz 中的 R_M 和 U_q 变成斜体?

\documentclass{article}
\usepackage[utf8]{inputenc}
%\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{float}
\usepackage{amssymb,amsfonts,textcomp}
\usepackage[LGR,T1]{fontenc}
\usepackage[greek,ngerman]{babel}
\usepackage[LGRgreek]{mathastext}
\usepackage{array}
\usepackage{supertabular}
\usepackage{hhline}
\usepackage{caption}
%\usepackage[tableposition=top]{caption}
\usepackage{biblatex}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{geometry}
\usepackage[european]{circuitikz}
%\usepackage[american]{circuitikz}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{siunitx}
\usepackage{hyperref}

\begin{document}

\clearpage
\begin{figure}[H]
\centering
\begin{circuitikz}[scale=1.0]
    \draw
    (0,0) node[anchor=east]{}
        %to[ammeter, -*] (1,0)
            to[short] (0,2)
            to[short,](1,2)
            to[R,l=$R_{M}$,-](3,2)
            to[short](3,0)
            to[short](0,0)

         (0,0) to [european voltage source,l=$U_{q}$] (0,2)   
        %to[voltmeter,] (0,1)
;
\end{circuitikz}
\caption{Ersatzschaltbild des Trogs}
\label{fig:trog_ersatz}
\end{figure}

\end{document}

[电路[1]

答案1

由于您正在使用mathastext并将所有数学运算更改为直立,因此对于您的电路来说,最简单的解决方案是将标签包装在\mathit

\documentclass[]{article}
\usepackage{tikz}
\usepackage{circuitikz}
\usepackage[LGRgreek]{mathastext}

\begin{document}
\begin{circuitikz}[scale=1.0]
\draw
(0,0) node[anchor=east]{}
        to[short] (0,2)
        to[short,](1,2)
        to[R,l=$\mathit{R_{M}}$,-](3,2)
        to[short](3,0)
        to[short](0,0)

     (0,0) to [european voltage source,l=$\mathit{U_{q}}$] (0,2);   
  \end{circuitikz}
\end{document}

代码输出

答案2

大部分内容与主题无关,但可能会有所帮助:

在此处输入图片描述

\documentclass{article}
\usepackage{circuitikz} % it also load "tikz"
\usepackage[LGRgreek]{mathastext}

\begin{document}
Current through resistance $R_M$ we can calculate by Ohm law:
    \[
I_M = \frac{U_q}{R_M}
    \]
As you can see, used font shape in the circuit diagram below is consistent with variable shapes in equation. I wouldn't change this.
    \begin{center}
\begin{circuitikz}
\draw
(0,0)   to [V,l=$U_{q}$]    (0,2)
        to [R,l=$R_{M}$,-]  (3,2)
        |-                  (0,0);
  \end{circuitikz}
    \end{center}
Note: code for your scheme is reorganized and consequently quite shorter. This may be useful for your other drawings.

\end{document}

相关内容