6

I am trying to generate a LPF block with TikZ.

I have found out the option of drawing a LPF with CircuiTikZ:

\documentclass[border=10pt]{standalone}  
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,positioning}
\usetikzlibrary{arrows.meta}
\usepackage{circuitikz}

\tikzset{
block/.style = {draw, fill=white, rectangle, minimum height=3em, minimum width=3em},
tmp/.style  = {coordinate}, 
input/.style = {coordinate},
output/.style= {coordinate},
pinstyle/.style = {pin edge={to-,thin,black}
}
}

\begin{document}  

    \begin{tikzpicture}
        \node [input, name=input] {};
        \node [block, right=20mm of input] (A) {A};
        \node [block, right=20mm of A] (B) {B};
        \draw [-{Latex[length=2mm]}] (A) to[lowpass](B);
    \end{tikzpicture}

\end{document}

This has 2 problems:

  1. The line connecting blocks goes through them, and does not start at their edge.
  2. There is no arrow pointing towards the LPF

Wrong LPF

I have unsuccessfully tried to find a workaround to this.

Is there any way I could make it look like this? Correct LPF

(As a last request, is it also possible to make the border of the block have the same thickness as A and B?)

3
  • 2
    Welcome to TeX.SX! Please don't post code fragments. Instead, put your fragments into a complete compilable document that shows the problem.
    – Thruston
    Commented Aug 26, 2017 at 11:48
  • @Thruston Code updated
    – jlnkls
    Commented Aug 26, 2017 at 12:06
  • Forget it, I didn't read that you were using circuitikz.
    – Ignasi
    Commented Aug 26, 2017 at 12:26

2 Answers 2

12

enter image description here

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows.meta, positioning}
\usepackage{circuitikz}

\begin{document}
\begin{tikzpicture}[box/.style={draw, thick, minimum size=10mm}]
    \node [box] (A) {A};
    \node [box, right=20mm of A] (B) {B};
    \path (A) to [lowpass, name=lpf] (B);
    \draw [-{Latex[length=2mm]}] (A.east) to (lpf.west);
    \draw [-{Latex[length=2mm]}] (lpf.east) to (B.west);
\end{tikzpicture}
\end{document}

edit: if you like change lowpass border thickness, than you only need redefine bipoles thickness:

\ctikzset{bipoles/thickness=1}

and above image you can redraw in:

enter image description here

complete mwe is:

\documentclass[margin=3mm]{standalone}
\usepackage{circuitikz}
\usetikzlibrary{arrows.meta, positioning}

\begin{document}
    \begin{tikzpicture}[
    box/.style = {draw, inner sep=2pt, minimum size=10mm},
     LA/.style = {-{Latex[length=2mm]}},
 node distance = 22mm
                ]
\ctikzset{bipoles/thickness=1}
%
\node [box] (A) {A};
\node [box, right=of A] (B) {B};
\path (A) to [lowpass, name=lpf] (B);
\draw [LA] (A) to (lpf.west);
\draw [LA] (lpf.east) to (B);
    \end{tikzpicture}
\end{document}
2
  • It works perfectly. Is it possible however to make the LPF block's border less thick instead of increasing A's and B's thickness?
    – jlnkls
    Commented Aug 26, 2017 at 12:53
  • @tuuli, see edit of my answer.
    – Zarko
    Commented Aug 26, 2017 at 13:59
0

It is also possible to not use path objects, but use them as nodes. I found this helpful in mixed graphs that are not pure circuit or block diagrams. Most of the path objects do have corresponding shapes for the node, usually accessible by appending shape to the name.

In the example below this is lowpassshape

MWE:

\documentclass[margin=3mm]{standalone}
\usepackage{circuitikz}
\usetikzlibrary{arrows.meta, positioning}

\begin{document}
  \begin{tikzpicture}[
    box/.style = {draw, inner sep=2pt, minimum size=10mm},
    LA/.style = {-{Latex[length=2mm]}},
    node distance = 22mm
                    ]
    \ctikzset{bipoles/thickness=1}
    %
    \node [box] (A) {A};
    \node [lowpassshape, right=of A] (lpf) {};
    \node [box, right=of lpf] (B) {B};
    \draw [LA] (A) to (lpf.west);
    \draw [LA] (lpf.east) to (B);
  \end{tikzpicture}
\end{document}

You must log in to answer this question.

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