
矢印の先端の色を修正するにはどうすればよいですか? 線幅のように塗りつぶされません。 また、矢印が に触れていることに気付くでしょうD
。 D を押し下げるにはどうすればよいですか? (または、手動で調整する方がよいですか?)
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows, positioning, trees, mindmap, calc}
\begin{document}
\begin{tikzpicture}
\node (a) at (9,7.5) {};
\node (b) at (9,4.5) {B};
\node (c) at (10.5,6) {};
\node (d) at (7.5,6) {D};
\path[draw=black!60,solid,line width=0.8mm,fill=black!60,preaction={-triangle 90,thin,draw,shorten >=-1mm}] (a) -- (b);
\path[draw=black!60,solid,line width=0.8mm,fill=black!60,preaction={-triangle 90,thin,draw,shorten >=-1mm}] (c) -- (d);
\end{tikzpicture}
\end{document}
答え1
draw
オプションの を、preaction
線 ( ) に使用されているのと同じスタイルに置き換えると、fill=black!60
灰色がかった矢印が表示されます (draw
メイン アクションの はいずれにしても継承されます)。
また、矢印部分を短くします(実際の線よりも長く伸びるように)。これを元に戻します(PGFでは通常、矢印を配置するときに行われます)。1つつまり、実際の線は短縮されますが、矢印は短縮されません。
thicker line small arrows
また、という形式で引数を取るスタイルも定義しました<line width> in <color>
。これを繰り返し使用して、さまざまな行に同じ方法でスタイルを設定できます。
また、ライブラリを使用して矢印を配置する別の方法 (thicker line small arrows m
スタイル)も提供しています。これは通常の/メソッドほど安定していませんが、 in によってパス上に矢印を配置できます。markings
preaction
postaction
1
at position 1
コード 1
\documentclass[tikz]{standalone}
\usetikzlibrary{arrows}
\colorlet{mygray}{black!60}
\tikzset{thicker line small arrows/.style args={#1in#2}{
draw=#2,
solid,
line width=#1,
shorten >=1mm,
preaction={
fill=#2,
thin,
-triangle 90,
shorten >=0mm,
}
}}
\begin{document}
\begin{tikzpicture}
\node (a) at (9,7.5) {};
\node (b) at (9,4.5) {B};
\node (c) at (10.5,6) {};
\node (d) at (7.5,6) {D};
\path[thicker line small arrows=.8mm in mygray] (a) -- (b);
\path[thicker line small arrows=.4mm in green] (c) -- (d);
\end{tikzpicture}
\end{document}
コード2
\documentclass[tikz]{standalone}
\usetikzlibrary{arrows, decorations.markings}
\colorlet{mygray}{black!60}
\tikzset{thicker line small arrows m/.style args={#1in#2}{
draw=#2,
solid,
line width=#1,
shorten >=1mm,
decoration={
markings,
mark=at position 1.0 with {\arrow[fill=#2,thin]{triangle 90}}
},
postaction={decorate}
}}
\begin{document}
\begin{tikzpicture}
\node (a) at (9,7.5) {};
\node (b) at (9,4.5) {B};
\node (c) at (10.5,6) {};
\node (d) at (7.5,6) {D};
\path[thicker line small arrows m=.8mm in mygray] (a) -- (b);
\path[thicker line small arrows m=.4mm in green] (c) -- (d);
\end{tikzpicture}
\end{document}