0

When I use dependent voltage sources, the polarity of the device changes based on the computer I compile the document on (it's not random; my home laptop will always display the sources in one direction, at work the other direction). This is a huge problem, because I frequently write assignments for my students at home, re-compile at work, and then have the incorrect polarity when I print them out. Is there some way I can mandate the direction of the source, so that the computer doesn't change it?

Example:

\begin{circuitikz}[font=\sffamily, american voltages]
    \draw (-2,2) to [V, l_=8~V] (-2,0);
    \draw (0,0) to [cV, l_=4~V] (0,2);
    \draw (-2,2) to [R, bipoles/length=1cm, l_=2~k$\Omega$, v^>=$V_1$] (0,2);
    \draw (-2,0) to [short] (0,0);
\end{circuitikz}

This looks like: example of dependent voltage sources

1

1 Answer 1

3

Edit (1): After may years I observe that I didn't load correct image. It should be the following one:

enter image description here

With your code i reproduce your right image. but i assume, that you like to have left one produced on work. For it I made the following redesign your circuit scheme. Its code is slightly shorter and use siunitx for units:

\documentclass[margin=3mm]{standalone}
\usepackage{siunitx}
\usepackage[siunitx]{circuitikz}

\begin{document}
\begin{circuitikz}[american voltages]
\ctikzset{bipoles/length=1cm}
\draw   (0,2)   to [V, l_=8<\volt>] (0,0)
        (0,2)   to [R, l_=2<\kilo\ohm>, v^>=$V_1$] (2,2)
                to [cV,l^=4<\volt>] (2,0)
                to [short] (0,0)                    
                ;
\end{circuitikz}
\end{document}

Above MWE should give on both computers the same result if on the both are the same LaTeX installation.

Edit (2): Unfortunately you provide only code fragments, so we don't know which document class you use and which packages are loaded in document preamble. Consequently in above original solution are used default (roman) font and not san serif as is shown in your images.

For the sans serif fonts you need to load package and declaration for use of the such font. One way is to use XeLaTeX or LuaLaTeX engine as is done in the following MWE (in it is also wee bit improved circuitikz code):

\documentclass[margin=3mm]{standalone}
\usepackage[no-math]{fontspec}
\setmainfont{Source Sans Pro}
\usepackage[italic]{mathastext}

\usepackage[siunitx]{circuitikz}
\sisetup{detect-family,
         detect-weight,
        }

\begin{document}

\begin{circuitikz}[font=\small, american voltages]
\draw   (0,0)   to [V, l^=8<\volt>, invert]     (0,2)
                to [R, l_=2<\kilo\ohm>, v^>=$V_1$] ++ (2,0)
                to [cV,l^=4<\volt>] (2,0)
                to [short] (0,0);
\end{circuitikz}

\end{document}

After compilation with XeLaTeX or LuaLaTeX <ou will get the following result:

enter image description here

3
  • Is there a way to reduce the size of the '+' and '-' signs inside the voltage sources, and also make them slightly thicker font? I really need this for the ckt diagrams that I am preparing. Thanks.
    – CSR
    Sep 22, 2022 at 0:29
  • @CSR, yeas, it is. Probably no so simple as is shown in answer (see edited version where I correct mistake at loading images and ad new example). For solution what you after please ask new question where provide a MWE, which reproduce your problem and explain what you like to change in it.
    – Zarko
    Sep 22, 2022 at 6:46
  • Thanks @Zarko. I have created a new question here
    – CSR
    Sep 24, 2022 at 5:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .