
\documentclass{article}
\usepackage{tikz}
\usepackage{pgf}
\usetikzlibrary{shapes.geometric}
\usepgflibrary{decorations.shapes}
\usetikzlibrary{decorations.shapes, shapes, fit, arrows, positioning, trees, mindmap, calc}
\tikzset{
rubber/.style={
draw=red!50,
shape border rotate=-90,
isosceles triangle,
fill=red!50,
minimum height=1.5cm,
minimum width =0.05cm,
}
}
\tikzset{
ducky/.style={
draw=red!50,
shape border rotate=90,
isosceles triangle,
fill=red!50,
minimum height=1.5cm,
minimum width =0.05cm,
}
}
\begin{document}
\begin{tikzpicture}
\node[rubber] at (0,0) {};
\node[ducky] at (0,0.5) {};
\end{tikzpicture}
\end{document}
三角形をもっと高く、もっと細くする方法はありますか?
答え1
2 つのキーが必要です:
- この
isosceles triangle stretches
オプションはisosceles triangle apex angle
(デフォルトは) を無視し、 と を使用してキーの正確な寸法を指定できる30
ようにします。minimum width
minimum height
isosceles triangle
inner sep
非常に小さい値の場合は、キーを に設定する必要があります0pt
(デフォルトは.3333em
)。
428ページ以降を読むことをお勧めします。PGFマニュアル(PDF で二等辺三角形を検索することもできます。)
コード
\documentclass[tikz]{standalone}
\usetikzlibrary{shapes.geometric}
\tikzset{
rubberduck/.style={
draw=red!50,
shape=isosceles triangle,
fill=red!50,
minimum height=1.5cm,
minimum width=0.5cm,
shape border rotate=#1,
isosceles triangle stretches,
inner sep=0pt,
},
rubber/.style={rubberduck=+90},
ducky/.style={rubberduck=-90}}
\begin{document}
\begin{tikzpicture}
\node[rubber] at (0,0) {};
\node[ducky] at (1,1.5) {};
\end{tikzpicture}
\end{document}