1

I know how to make a block diagram in TikZ. With \node[block] ..., one can make rectangular blocks:

block/.style = {draw, fill=blue!20, rectangle,
                     minimum height=3em, minimum width=6em}

I would like to include triangular blocks in a block diagram. These represent a gain, i.e. a multiplication by a constant. So far, I only found this information about changing the block shape. But as a gain is common block diagram component, there should be a fast and easy way.

3
  • 1
    You can use isosceles triagle or regular polygon shapes.
    – Zarko
    Nov 12, 2016 at 23:41
  • 1
    block is not a standard shape. How is it defined? You can use the shapes.geometric library for the shapes Zarko mentioned. Please provide a minimal working example.
    – cfr
    Nov 12, 2016 at 23:58
  • @Zarko and cfr - I was unaware of the fact that I can define the shapes myself in the preamble. My solution was to use \usepackage{tikz} \usetikzlibrary{shapes,arrows,positioning} \tikzset{block/.style = {draw, fill=blue!20, rectangle, minimum height=3em, minimum width=6em}, mytriangle/.style = {draw, fill=blue!20, isosceles triangle, node distance=1cm}, } Both comments helped me equally. As you were the first contributer, I invite you to reformulate your comment as an answer, so I can accept it.
    – Karlo
    Nov 13, 2016 at 17:31

1 Answer 1

5

An example how to define triangle shape (with use of regular polygon):

\documentclass[tikz, border=3mm]{standalone}
\usetikzlibrary{shapes}

\begin{document}
    \begin{tikzpicture}[
amp/.style = {regular polygon, regular polygon sides=3,
              draw, fill=white, text width=1em,
              inner sep=1mm, outer sep=0mm,
              shape border rotate=-90}
                        ]
\node (amp) [amp,right] {A} -- ++ (2,0);
\draw (amp.west) -- ++ (-2,0)   (amp.east) -- ++ (2,0);       
    \end{tikzpicture}
\end{document}

enter image description here

You must log in to answer this question.

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