我很好奇如何重新创建以下简单图形,并保留其所有特征,即符合 DIN 标准的箭头尖和阴影区域。我非常了解 tikz 的各种软件包,您可以在其中指定箭头尖和填充,但它们都不符合我的要求。
请注意,这是一张经济图表,因此仅具有说明功能 — 没有实际数据点。此外,箭头的正确 DIN 标准是长度为 5 毫米,高度为 1 毫米。
答案1
这是你可以研究的代码
\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}
答案2
我使用了@student 贡献的方法(实际上它几乎是整个解决方案),并修改了@Altermundus 给出的代码,使其看起来与所讨论的图完全一样。
\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}
得出下图的结果:
答案3
不是答案,而是太渴望评论了。对于填充,您可以尝试声明这样的自定义模式(我从 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}
编辑:
以下是关于箭头提示的建议(修改后的代码如下: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}