4

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.

2 Answers 2

5

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

5

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

You must log in to answer this question.

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