
저는 tikz를 처음 사용하고 다이어그램을 삽입할 때마다 다음 블록을 붙여넣습니다. (물리학 숙제를 입력하는 중이므로 그려야 하는 그림의 종류는 거의 항상 동일합니다.)
\begin{tikzpicture}[
force/.style={>=latex,draw=blue,fill=blue},
axis/.style={densely dashed,gray,font=\small},
M/.style={rectangle,draw,fill=lightgray,minimum size=0.5cm,thin},
m/.style={rectangle,draw=black,fill=lightgray,minimum size=0.3cm,thin},
plane/.style={draw=black,fill=blue!10},
string/.style={draw=red, thick},
pulley/.style={thick},
]
입력해야 하는 명령을 단축하고 싶습니다. 내 이해는 이것이 "스타일"이고 이를 수행할 수 있는 방법이 있다는 것입니다. 그러나 tikzset을 사용한 나의 시도는 혼란스러운 결과만을 낳았습니다. (기본적으로 tikzset에 작성한 내용은 문서의 첫 페이지에 텍스트로 출력됩니다.) 도움을 주시면 감사하겠습니다.
답변1
사용 \tikzset
:
\documentclass{article}
\usepackage{tikz}
\tikzset{
force/.style={>=latex,draw=blue,fill=blue},
axis/.style={densely dashed,gray,font=\small},
M/.style={rectangle,draw,fill=lightgray,minimum size=0.5cm,thin},
m/.style={rectangle,draw=black,fill=lightgray,minimum size=0.3cm,thin},
plane/.style={draw=black,fill=blue!10},
string/.style={draw=red, thick},
pulley/.style={thick},
}
\begin{document}
\begin{tikzpicture}
\draw[pulley] (0,0) -- (1,0);
% more code here
\end{tikzpicture}
\end{document}