13

I'm curious how the following simple figure can be recreated with all its characteristics, i.e the DIN correct arrow tips and the hatched areas. I'm very aware of various packages for tikz, where you can specify the arrow tips and fillings, but none of them met my requirements yet.

enter image description here

Please note that this is an economic diagram and therefore has just an illustrative function—no real data points. Furthermore the correct DIN norm of the arrowheads is 5mm in length and 1mm in height.

6
  • 2
    Can you post the exact DIN specifications of the arrow tips and of the filling? (I don't know which DIN norm specifies this and where to get it for online for free, so I think it would be the best if you could just post the specification).
    – student
    Commented Apr 21, 2012 at 9:27
  • This may be helpful: latex-community.org/forum/viewtopic.php?f=45&t=16399
    – student
    Commented Apr 21, 2012 at 9:40
  • Does the DIN norm specify a distance between the lines of your filling? Does it specify a line width?
    – student
    Commented Apr 21, 2012 at 9:45
  • 3
    I have tided up the comments here, leaving those which directly help to clarify the question.
    – Joseph Wright
    Commented Apr 21, 2012 at 16:32
  • 3
    @Ray Thanks for editing your information into the question.
    – Joseph Wright
    Commented Apr 21, 2012 at 16:38

3 Answers 3

26

Here a code you can study

\documentclass[11pt,ngerman]{scrartcl}
\usepackage[utf8]{inputenc} 
\usepackage[upright]{fourier}    
\PassOptionsToPackage{dvipsnames,svgnames}{xcolor}  
\usepackage{tikz}
\usetikzlibrary{arrows, calc,intersections,patterns}
\usepackage{babel}       

\tikzset{%
    add/.style args={#1 and #2}{
        to path={%
 ($(\tikztostart)!-#1!(\tikztotarget)$)--($(\tikztotarget)!-#2!(\tikztostart)$)%
  \tikztonodes}}
} 

\color{Maroon}
\tikzset{dot/.style={draw,circle,minimum size=3pt,inner sep=0pt,outer sep=0pt,thick,fill,}} 

\begin{document}
\begin{figure}[htbp]
    \centering  
    \begin{tikzpicture}[>=latex',
      dot/.style={circle,minimum size=3pt,inner sep=0pt,outer sep=0pt,thick,fill}]
    \node[anchor=south west,shift={(-2,-2)}]{\includegraphics[width=15cm]{Paper.png} };
    \draw[thick,->] (0,0)--(12,0) node[below left,align=left]{Umfang des\\ öffentl. Gutes X};
    \draw[thick,->] (0,0)--(0,9) node[below left] {Geld};
    \coordinate[dot,label=below:$O$](O) at (0,0);
    \coordinate[dot,label=left:tp](tp)  at (0,4);
    \coordinate[dot,label=above right:$C$](C) at ([xshift=4 cm]tp);
    \coordinate[dot,label=above right:$G$](G) at ([xshift=8 cm]tp);
    \coordinate[dot,label=above left:$E$](E) at  ([xshift=5.5 cm]tp); 
    \coordinate[label=above right:$D$](D) at  ([yshift=-2 cm]E); 
    \draw (tp)--++(12,0);
    \draw (C) -- (C|-O) node[below] {$X^{A}$} ; 
    \draw (G) -- (G|-O) node[below] {$X^{B}$} ;
    \draw (E) -- (E|-O) node[below] {$X^{(A,B)}$} ;
    \draw[add = .8 and 1]  (D) to (C) node[above left]  {$MZB^A$} ;
    \draw[add = 1.3 and 1.2] (G) to +($(C)-(D)$) coordinate (X) node[above left]  {$MZB^B$};
    \path [name path=DE] (D) -- ([yshift=8 cm]D); 
    \path [name path=GF] (G) -- (X);
    \path [name intersections={of=DE and GF,by={[label=above right:$F$]F}}];
    \draw (D)--(F); 
    \path[pattern=vertical lines,pattern color=Maroon!20] (C)--(D)--(F)--(G)--cycle;    
    \end{tikzpicture}
    \caption{Anpassung des Angebots öffentlicher Güter durch gebietskörperschaftliche Aufgliederung} 
\end{figure}
\end{document}

enter image description here

7
  • Thank you for your effort! I will adapt it to fit my needs and post the result with the correct arrowheads and hatching spaces.
    – Ray
    Commented Apr 21, 2012 at 10:26
  • I don't know the Dimensioning Standards but there is no problem to modify the line width, you can look at the pgf manual if you want create arrow head specific, the main macro for that is \pgfarrowsdeclare. sudent shows you how to create a specific pattern. Now I think it's preferable to ask differently your question and to be more explicit. It's you work to define (delimite) your problems. This figure is not so easy to draw. Commented Apr 21, 2012 at 10:32
  • I think you got me wrong, I wrote that I will post the revised figure, not you. I appreciate your effort and will go from here alone with what you and student posted. I already recreated the arrowheads to fit my needs and will do the the same for the graph. Have a great weekend!
    – Ray
    Commented Apr 21, 2012 at 10:36
  • 1
    Correctly we use ngerman as language option for »babel«. And it is preferable to give this option globally to the document class in order to let other packages benefit. Commented Apr 21, 2012 at 11:10
  • @ThorstenDonig thanks It's the first time that I work with this language ! Commented Apr 21, 2012 at 11:42
15

I used the approach (actually it was nearly the whole solution) contributed by @student and revised the code given by @Altermundus to look exactly like the figure in question.

\documentclass[a4paper]{report}
\usepackage{tikz}
\usepackage{verbatim}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{subfig}

%-------------------------------------------------------------
%       Call pattern library and declare DIN conform
%       vertical hatchings
%-------------------------------------------------------------
\usetikzlibrary{patterns,calc,intersections,patterns}

\pgfdeclarepatternformonly{dinhatch}{\pgfpointorigin}{\pgfqpoint{1mm}{100pt}}{\pgfqpoint{1mm}{100pt}}% Adjust the second 1mm for your needs
{
  \pgfsetlinewidth{0.4pt}
  \pgfpathmoveto{\pgfqpoint{0.5pt}{0pt}}
  \pgfpathlineto{\pgfqpoint{0.5pt}{100pt}}
  \pgfusepath{stroke}
}
%-------------------------------------------------------------
%       Call arrow library and declare DIN conform arrowheads
%-------------------------------------------------------------
\usetikzlibrary{arrows}

\makeatletter
\pgfarrowsdeclare{dinarr}{dinarr}
{
     \pgfutil@tempdima=0.5pt%
     \advance\pgfutil@tempdima by.25\pgflinewidth%
     \pgfutil@tempdimb=7.29\pgfutil@tempdima\advance\pgfutil@tempdimb by.5\pgflinewidth%
     \pgfarrowsleftextend{+-\pgfutil@tempdimb}
     \pgfutil@tempdimb=.5\pgfutil@tempdima\advance\pgfutil@tempdimb by1.6\pgflinewidth%
     \pgfarrowsrightextend{+\pgfutil@tempdimb}
   }
   {
     \pgfutil@tempdima=0.5pt%
     \advance\pgfutil@tempdima by.25\pgflinewidth%
     \pgfsetdash{}{+0pt}
     \pgfsetmiterjoin
     \pgfpathmoveto{\pgfpointadd{\pgfqpoint{0.5\pgfutil@tempdima}{0pt}}{\pgfqpoint{-3mm}{0.5mm}}}
     \pgfpathlineto{\pgfqpoint{0.5\pgfutil@tempdima}{0\pgfutil@tempdima}}
     \pgfpathlineto{\pgfpointadd{\pgfqpoint{0.5\pgfutil@tempdima}{0pt}}{\pgfqpoint{-3mm}{-0.5mm}}}
     \pgfpathclose
     \pgfusepathqfillstroke
   }
\pgfarrowsdeclarereversed{dinarr reversed}{dinarr reversed}{dinarr}{dinarr}
\makeatother
%-------------------------------------------------------------
%       Begin document
%-------------------------------------------------------------
\begin{document}

\tikzset{add/.style args={#1 and #2}{to path={($(\tikztostart)!-#1!(\tikztotarget)$)--($(\tikztotarget)!-#2!(\tikztostart)$)\tikztonodes}}} 
\tikzstyle{LabelStyle}=[above=2pt]
\tikzstyle{state}=[circle,thick,draw=black!75,fill=black!20,minimum size=6mm, text=black]
\tikzset{dot/.style={draw,circle,minimum size=1.4mm,inner sep=0pt,outer sep=0pt,thick,fill}} 
\begin{figure}[!htbp]

    \begin{center}
    \begin{tikzpicture}[font=\footnotesize]
    \draw[-dinarr] (0,0)--(9,0) node[below left,align=left]{Umfang des\\ öffentl. Gutes X};
    \draw[-dinarr] (0,0)--(0,7) node[below left] {Geld};

    \path[pattern=dinhatch,pattern] (3.5,3)--(4.7,1.5)--(4.7,4.9)--(6.2,3)--cycle;  

    \coordinate[dot,label=below:0](O) at (0,0);
    \coordinate[label=left:tp](tp)  at (0,3);
    \coordinate[dot,label=above right:C](C) at (3.5,3);
    \coordinate[dot,label=above right:G](G) at (6.2,3);
    \coordinate[label=above left:E](E) at  (4.7,3); 
    \coordinate[label=above right:D](D) at  (4.7,1.5); 
    \coordinate[label=above right:F](F) at  (4.7,4.9);
    \draw (tp)-- (9,3);
    \draw (C) -- (C|-O) node[below] {$\mathrm{X^{A}}$} ; 
    \draw (G) -- (G|-O) node[below] {$\mathrm{X^{B}}$} ;
    \draw (E) -- (E|-O) node[below] {$\mathrm{X^{(A,B)}}$} ;
    \draw[add = .8 and 1,line width=.45mm]  (D) to (C) node[above]  {$\mathrm{MZB^A}$} ;
    \draw[add = 1.3 and 1.2,line width=.45mm] (G) to +($(C)-(D)$) coordinate (X) node[above]  {$\mathrm{MZB^B}$};

    \draw (D)--(F); 

    \end{tikzpicture}

    \textit{Abbildung 26.1: Anpassung des Angebots öffentlicher Güter durch gebietskörperschaftliche Aufgliederung}

    \end{center}
\end{figure}
\end{document}

What yields following figure: enter image description here

1
  • I'm amazed that the figure's title's line breaks match the reference image's. Commented Apr 21, 2012 at 16:22
14

Not an answer but to long for a comment. For the filling you could try to declare a custom pattern like this (I adjusted the code from the vertical lines pattern from pgflibrarypatterns.code.tex)

\documentclass{article}
\usepackage{tikz}

\usetikzlibrary{patterns}

\pgfdeclarepatternformonly{myvertical lines}{\pgfpointorigin}{\pgfqpoint{1mm}{100pt}}{\pgfqpoint{1mm}{100pt}}% Adjust the second 1mm for your needs
{
  \pgfsetlinewidth{0.4pt} %Adjust this for the line thickness
  \pgfpathmoveto{\pgfqpoint{0.5pt}{0pt}}
  \pgfpathlineto{\pgfqpoint{0.5pt}{100pt}}
  \pgfusepath{stroke}
}


\begin{document}

\begin{tikzpicture}
  \filldraw[pattern=myvertical lines] (0,0) -- (5,0) -- (0,2) -- cycle;
\end{tikzpicture}
\end{document}

Pattern 1mm

Edit:

Here is a suggestion for the arrow tips (modified code from here: http://www.latex-community.org/forum/viewtopic.php?f=45&t=16399):

\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{arrows}

\makeatletter
    \pgfarrowsdeclare{DIN}{DIN}
    {
      \pgfutil@tempdima=0.5pt%
      \advance\pgfutil@tempdima by.25\pgflinewidth%
      \pgfutil@tempdimb=7.29\pgfutil@tempdima\advance\pgfutil@tempdimb by.5\pgflinewidth%
      \pgfarrowsleftextend{+-\pgfutil@tempdimb}
      \pgfutil@tempdimb=.5\pgfutil@tempdima\advance\pgfutil@tempdimb by1.6\pgflinewidth%
      \pgfarrowsrightextend{+\pgfutil@tempdimb}
    }
    {
      \pgfutil@tempdima=0.5pt%
      \advance\pgfutil@tempdima by.25\pgflinewidth%
      \pgfsetdash{}{+0pt}
      \pgfsetmiterjoin
      \pgfpathmoveto{\pgfpointadd{\pgfqpoint{0.5\pgfutil@tempdima}{0pt}}{\pgfqpoint{-4mm}{0.5mm}}}
      \pgfpathlineto{\pgfqpoint{0.5\pgfutil@tempdima}{0\pgfutil@tempdima}}
      \pgfpathlineto{\pgfpointadd{\pgfqpoint{0.5\pgfutil@tempdima}{0pt}}{\pgfqpoint{-4mm}{-0.5mm}}}
      \pgfpathclose
      \pgfusepathqfillstroke
    }
    \pgfarrowsdeclarereversed{DIN reversed}{DIN reversed}{DIN}{DIN}
    \makeatother

    \begin{document}
      \begin{tikzpicture}
        \draw[DIN-] (0,0.5) -- (2,0.5);
      \end{tikzpicture}
\end{document}

Arrow DIN Tip

1
  • 1
    Thank you mate! This works like a charm; I got the arrowheads DIn conform and will post the whole thing once it ready. You helped me a lot, wish you all the best and thanks again for not being complicated.
    – Ray
    Commented Apr 21, 2012 at 10:27

You must log in to answer this question.

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