Überarbeitungsverlauf[Zurück]
Klicke auf Einblenden/Ausblenden von Überarbeitungen 5

01 Mär '14, 20:05

esdd's gravatar image

esdd
17.8k304257

Da pgf / TikZ 3.0 jetzt auf CTAN und auch bei TeXlive 2013 ist, kann man statt einer [`node`][1] auch ein `pic` dafür definieren: ![alt text][2] \documentclass[tikz,margin=5mm]{standalone} \usetikzlibrary{fit} \usepackage[ngerman]{babel} \tikzset{ comp/.style={ thick, minimum width=8cm,minimum height=4.5cm,text width=8cm,inner sep=0pt, text=green,align=center,font=\Huge, transform shape }, monitor/.style={draw=none,xscale=18/16,yscale=11/9}, display/.style={shading=axis,left color=black!60, right color=black}, ut/.style={fill=gray} } \tikzset{ computer/.pic={ % Monitor (mit Rand) \node(-m)[comp,pic actions,monitor]{\phantom{\parbox{\linewidth}{\tikzpictext}}}; % Display (ohne Rand) \node[comp,pic actions,display]{\tikzpictext}; \begin{scope}[x=(-m.east),y=(-m.north)] % Füllen des Unterteils \path[pic actions,draw=none] ([yshift=2\pgflinewidth]-0.1,-1)--(-0.1,-1.3)--(-1,-1.3)-- (-1,-2.4)--(1,-2.4)--(1,-1.3)--(0.1,-1.3)--([yshift=2\pgflinewidth]0.1,-1); % Färben des Randes des Unterteils \path[ut] (-1,-2.4)rectangle(1,-1.3) (-0.9,-1.4)--(-0.2,-2.3)--(0.2,-2.3)--(0.9,-1.4)--cycle; (-0.9,-1.4)--(-0.7,-2.3)--(0.7,-2.3)--(0.9,-1.4)--cycle; % Zeichnen der Umrandung des gesamten Computers \path[pic actions,fill=none] (-1,1)--(-1,-1)--(-0.1,-1)--(-0.1,-1.3)--(-1,-1.3)-- (-1,-2.4)coordinate(sw)coordinate[pos=0.5](-b west)-- (1,-2.4)--(1,-1.3)coordinate[pos=0.5](-b east)-- (0.1,-1.3)--(0.1,-1)--(1,-1)--(1,1)--cycle; % Node um gesamten Computer \node(-c)[fit=(sw)(-m.north east),inner sep=0pt]{}; \end{scope} } } % Es stehen zwei rechteckige Noden mit den üblichen Ankern zur Verfügung: % Monitor (mit Rand): <picname>-m, gesamter Computer: <picname>-c % Der Anker des gesamten pics ist bei <picname>-m.center (nicht änderbar) \begin{document} \begin{tikzpicture} \pic(comp0)[ draw, fill=gray!30, pic text={ganz langer Text, damit es hier einen Zeilenumbruch und mehrere Zeilen gibt} ] {computer}; \path(comp0-c.center) pic foreach[count=\i] \farbe in {yellow,orange,red, red!50!blue, blue,green}(comp\i) [ draw=\farbe, fill=\farbe!30, display/.append style={left color=\farbe!80!black!80}, scale=0.25, pic text={Text \i} ] at +(60*\i:8){computer}; \foreach \i in {1,2,4,5}\draw (comp\i-c)--(comp0-c); \foreach \i in {3,6}\draw (comp\i-m)--(comp0-c); \end{tikzpicture} \end{document} [1]: http://texwelt.de/wissen/fragen/3536/wie-erstelle-ich-neue-shapes-in-tikz/3592 [2]: http://texwelt.de/wissen/upfiles/comppic.pnghttp://texwelt.de/wissen/upfiles/comppic_1.png
Klicke auf Einblenden/Ausblenden von Überarbeitungen 4

01 Mär '14, 19:06

esdd's gravatar image

esdd
17.8k304257

Da pgf / TikZ 3.0 jetzt auf CTAN und auch bei TeXlive 2013 ist, kann man statt einer node [`node`][1] auch ein pic `pic` dafür definieren: ![alt text][1] text][2] \documentclass[tikz,margin=5mm]{standalone} \usetikzlibrary{fit} \usepackage[ngerman]{babel} \tikzset{ comp/.style={ thick, minimum width=8cm,minimum height=4.5cm,text width=8cm,inner sep=0pt, text=green,align=center,font=\Huge, transform shape }, monitor/.style={draw=none,xscale=18/16,yscale=11/9}, display/.style={shading=axis,left color=black!60, right color=black}, ut/.style={fill=gray} } \tikzset{ computer/.pic={ % Monitor (mit Rand) \node(-m)[comp,pic actions,monitor]{\phantom{\parbox{\linewidth}{\tikzpictext}}}; % Display (ohne Rand) \node[comp,pic actions,display]{\tikzpictext}; \begin{scope}[x=(-m.east),y=(-m.north)] % Füllen des Unterteils \path[pic actions,draw=none] ([yshift=2\pgflinewidth]-0.1,-1)--(-0.1,-1.3)--(-1,-1.3)-- (-1,-2.4)--(1,-2.4)--(1,-1.3)--(0.1,-1.3)--([yshift=2\pgflinewidth]0.1,-1); % Färben des Randes des Unterteils \path[ut] (-1,-2.4)rectangle(1,-1.3) (-0.9,-1.4)--(-0.2,-2.3)--(0.2,-2.3)--(0.9,-1.4)--cycle; % Zeichnen der Umrandung des gesamten Computers \path[pic actions,fill=none] (-1,1)--(-1,-1)--(-0.1,-1)--(-0.1,-1.3)--(-1,-1.3)-- (-1,-2.4)coordinate(sw)coordinate[pos=0.5](-b west)-- (1,-2.4)--(1,-1.3)coordinate[pos=0.5](-b east)-- (0.1,-1.3)--(0.1,-1)--(1,-1)--(1,1)--cycle; % Node um gesamten Computer \node(-c)[fit=(sw)(-m.north east),inner sep=0pt]{}; \end{scope} } } % Es stehen zwei rechteckige Noden mit den üblichen Ankern zur Verfügung: % Monitor (mit Rand): <picname>-m, gesamter Computer: <picname>-c % Der Anker des gesamten pics ist bei <picname>-m.center (nicht änderbar) \begin{document} \begin{tikzpicture} \pic(comp0)[ draw, fill=gray!30, pic text={ganz langer Text, damit es hier einen Zeilenumbruch und mehrere Zeilen gibt} ] {computer}; \path(comp0-c.center) pic foreach[count=\i] \farbe in {yellow,orange,red, red!50!blue, blue,green}(comp\i) [ draw=\farbe, fill=\farbe!30, display/.append style={left color=\farbe!80!black!80}, scale=0.25, pic text={Text \i} ] at +(60*\i:8){computer}; \foreach \i in {1,2,4,5}\draw (comp\i-c)--(comp0-c); \foreach \i in {3,6}\draw (comp\i-m)--(comp0-c); \end{tikzpicture} \end{document} [1]: http://texwelt.de/wissen/fragen/3536/wie-erstelle-ich-neue-shapes-in-tikz/3592 [2]: http://texwelt.de/wissen/upfiles/comppic.png
Klicke auf Einblenden/Ausblenden von Überarbeitungen 3
Codeformatierung

01 Mär '14, 18:48

esdd's gravatar image

esdd
17.8k304257

Klicke auf Einblenden/Ausblenden von Überarbeitungen 2

01 Mär '14, 18:25

esdd's gravatar image

esdd
17.8k304257

Klicke auf Einblenden/Ausblenden von Überarbeitungen 1

01 Mär '14, 18:21

esdd's gravatar image

esdd
17.8k304257