3

I'd like a way to be able to write on two lines inside the four-port instead of a single continuous line.

this is the code I'm using

\documentclass[tikz,border=15mm]{standalone}
\usepackage[siunitx, RPvoltages,american]{circuitikz}

\standaloneenv{circuitikz}
\ctikzsetstyle{romano}
\ctikzset{bipoles/open/voltage/distance from node=0.8mm}
\ctikzset{voltage/american font=\tiny}

\begin{document}
\begin{circuitikz}

\draw 
node[fourport,t={Two-port noiseless}] (c) {} 
(c.port4) to[short,i<_=$i_1$] ++(-1,0) coordinate (A)
(c.port3) to[short,i<=$i_2$] ++(1,0) coordinate (B)
(c.port2) to[short] ++(1,0) coordinate (C)
(c.port1) to[short] ++(-1,0) coordinate (D)
(A) to[open,v=$v_1$,o-o] (D)
(B) to[open,v=$v_2$,o-o] (C)
;
\end{circuitikz}
\end{document}

this is my output two port

I wish to have the word "two-port" on one line and "noiseless" on the other line, I tried using \ but doesn't work so I'm not sure how to approach it. thank you very much for your help

2 Answers 2

4

Welcome to TeX.SX! You could place a \parbox inside the t option:

\documentclass[tikz,border=15mm]{standalone}
\usepackage[siunitx, RPvoltages,american]{circuitikz}

\standaloneenv{circuitikz}
\ctikzsetstyle{romano}
\ctikzset{bipoles/open/voltage/distance from node=0.8mm}
\ctikzset{voltage/american font=\tiny}

\begin{document}
\begin{circuitikz}

\draw 
node[fourport,t={\parbox{1.5cm}{\centering Two-port noiseless}}] (c) {} 
(c.port4) to[short,i<_=$i_1$] ++(-1,0) coordinate (A)
(c.port3) to[short,i<=$i_2$] ++(1,0) coordinate (B)
(c.port2) to[short] ++(1,0) coordinate (C)
(c.port1) to[short] ++(-1,0) coordinate (D)
(A) to[open,v=$v_1$,o-o] (D)
(B) to[open,v=$v_2$,o-o] (C)
;
\end{circuitikz}
\end{document}

enter image description here

4

An other way is to use a label with line break like this:

\documentclass[tikz, border=1cm]{standalone}
\usepackage[siunitx, RPvoltages,american]{circuitikz}
\standaloneenv{circuitikz}
\ctikzsetstyle{romano}
\ctikzset{bipoles/open/voltage/distance from node=0.8mm}
\ctikzset{voltage/american font=\tiny}
\begin{document}
\begin{circuitikz}
\draw 
node[fourport, label={[align=center]center:Two-port\\noiseless}] (c) {} 
(c.port4) to[short, i<_=$i_1$] ++(-1,0) coordinate (A)
(c.port3) to[short, i<=$i_2$] ++(1,0) coordinate (B)
(c.port2) to[short] ++(1,0) coordinate (C)
(c.port1) to[short] ++(-1,0) coordinate (D)
(A) to[open, v=$v_1$,o-o] (D)
(B) to[open, v=$v_2$,o-o] (C)
;
\end{circuitikz}
\end{document}

Box with four terminals and text

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.