안녕하세요 여러분 저는 tikz사진의 크기를 조정해야 해서 그렇게 했지만 \begin{tikzpicture}[scale=<factor>]
사진의 크기가 그에 맞게 조정되지 않습니다(TikzManual에 보고됨)섹션 18.2 Pic 구문). 사진 크기도 조정하고 싶어서 구문을 시도했지만 \begin{tikzpicture}[scale=0.4,every pic/.style={transform shape}]
작동하지 않았습니다. 모든 단일 사진의 옵션으로 변형 모양을 사용하는 것입니다. 즉, \pic[angle radius=5.3cm,transform shape]
괜찮지만 \pic
s의 모든 단일 옵션에 사용하고 싶지는 않습니다. 어쩌면 각도 라이브러리에만 문제가 있을 수도 있습니다(다른 사진으로는 시도하지 않았습니다). 여기 내 MWE가 있는데 예상대로 작동하지 않습니다.
\documentclass[border=1cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,angles}
\begin{document}
%rotate vectors
\begin{tikzpicture}[vector/.style={thick,-stealth},scale=0.4,every pic/.style={transform shape}]
%drawing help lines
\newcommand*{\xmin}{-3}\newcommand*{\xmax}{4}
\newcommand*{\ymin}{-5}\newcommand*{\ymax}{1}
\draw[help lines](\xmin,\ymin)grid(\xmax,\ymax);
%vector coordinates and labels
\coordinate[label={above:$v$}] (O)at (0,0);
\coordinate (vec1)at (1,-2);
\coordinate (vec2)at(4,-1);
\draw[vector] (O)--(vec1)coordinate[label={[below]$u_1$}](u1);
%sum (vec1)+(vec2)
\draw[vector,very thick,blue](O)--($(vec1)+(vec2)$)coordinate(u1+u2);
%rotated sum (u1)+(u2) -> u'1+u'2
\draw[vector,very thick,orange](O)--([rotate=-90]u1+u2)coordinate(u'1+u'2);
%rotated vectors
\draw[red,vector] (0,0)--([rotate=-90]vec1)coordinate[label={[left]$u'_1$}](u'1);
%
\draw[red,vector] (0,0)--([rotate=-90]vec2)coordinate[label={[below]$u'_2$}](u'2);
%angles between vectors by angles library, issue with angle radius=
%default angle radius=1cm and it does not scale accordingly
\pic[draw=gray] {angle = u'1--O--u'2};
% rotation traces
\pic[draw=red,dashed,<-,angle radius=1.8cm]{angle=u'1--O--vec1};
\pic[draw=blue,dashed,<-,angle radius=5.3cm,] {angle=u'1+u'2--O--u1+u2};
%vector sums labels
\coordinate[label={below:$w$}]() at(u1+u2);
\coordinate[label={below:$w'$}] ()at(u'1+u'2);
% outgoing vector scaled accordingly but I'd rather prefer not
\path[draw,fill=white] (O)circle[radius=2pt];
\path[fill] (O)circle[radius=1pt];
\end{tikzpicture}\end{document}
다음은 제대로 작동합니다.
\documentclass[border=1cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,angles}
\begin{document}
%
%rotate vectors
\begin{tikzpicture}[vector/.style={thick,-stealth},scale=0.4 ] %every pic/.append style={transform shape}
%drawing help lines
\newcommand*{\xmin}{-3}\newcommand*{\xmax}{4}
\newcommand*{\ymin}{-5}\newcommand*{\ymax}{1}
\draw[help lines](\xmin,\ymin)grid(\xmax,\ymax);
%vector coordinates and labels
\coordinate[label={above:$v$}] (O)at (0,0);
\coordinate (vec1)at (1,-2);
\coordinate (vec2)at(4,-1);
\draw[vector] (O)--(vec1)coordinate[label={[below]$u_1$}](u1);
%sum (vec1)+(vec2)
\draw[vector,very thick,blue](O)--($(vec1)+(vec2)$)coordinate(u1+u2);
%rotated sum (u1)+(u2) -> u'1+u'2
\draw[vector,very thick,orange](O)--([rotate=-90]u1+u2)coordinate(u'1+u'2);
%rotated vectors
\draw[red,vector] (0,0)--([rotate=-90]vec1)coordinate[label={[left]$u'_1$}](u'1);
%
\draw[red,vector] (0,0)--([rotate=-90]vec2)coordinate[label={[below]$u'_2$}](u'2);
%angles between vectors by angles library, issue with angle radius=
%default angle radius=1cm and it does not scale accordingly
\pic[transform shape,draw=gray] {angle = u'1--O--u'2};
% rotation traces
\pic[draw=red,dashed,<-,angle radius=1.8cm,transform shape]{angle=u'1--O--vec1};
\pic[transform shape,draw=blue,dashed,<-,angle radius=5.3cm,] {angle=u'1+u'2--O--u1+u2};
%vector sums labels
\coordinate[label={below:$w$}]() at(u1+u2);
\coordinate[label={below:$w'$}] ()at(u'1+u'2);
% outgoing vector scaled accordingly but I'd rather prefer not
\path[draw,fill=white] (O)circle[radius=2pt];
\path[fill] (O)circle[radius=1pt];
\end{tikzpicture}
\end{document}
어쩌면 이를 달성하는 더 좋은 방법이 있을 수도 있습니다. 저는 그것에 대해 열려 있지만 처음부터 코드를 변경하지는 않을 것입니다.
나는 시도했지만 every pic/.append style={transform shape}
뚜렷한 결과는 없었습니다. 부작용으로 반경나가는 벡터코드의 마지막 줄에 크기가 조정되어 있는데 이는 원하지 않습니다.
답변1
모든 에 스타일을 추가하고 싶기 때문에 \pic{angle}
다음과 같이 설정할 수 있습니다 ( 여기서는 의 "경로 디렉터리" pics/angle/.append style={/tikz/transform shape}
에 있으므로 경로를 명시적으로 명시해야 합니다 ).\pic
\documentclass[border=1cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc, angles}
\begin{document}
%rotate vectors
\begin{tikzpicture}[
vector/.style={thick,-stealth},
scale=0.4,
pics/angle/.append style={/tikz/transform shape}
]
%drawing help lines
\newcommand*{\xmin}{-3}\newcommand*{\xmax}{4}
\newcommand*{\ymin}{-5}\newcommand*{\ymax}{1}
\draw[help lines] (\xmin,\ymin) grid (\xmax,\ymax);
%vector coordinates and labels
\coordinate[label={above:$v$}] (O) at (0,0);
\coordinate (vec1) at (1,-2);
\coordinate (vec2) at (4,-1);
\draw[vector] (O) -- (vec1)
coordinate[label={[below]$u_1$}] (u1);
%sum (vec1)+(vec2)
\draw[vector,very thick,blue] (O)--($(vec1)+(vec2)$)
coordinate (u1u2);
%rotated sum (u1)+(u2) -> u'1+u'2
\draw[vector,very thick,orange] (O)--([rotate=-90]u1u2)
coordinate (u'1u'2);
%rotated vectors
\draw[red,vector] (0,0) -- ([rotate=-90]vec1)
coordinate[label={[left]$u'_1$}] (u'1);
%
\draw[red,vector] (0,0) -- ([rotate=-90]vec2)
coordinate[label={[below]$u'_2$}] (u'2);
%angles between vectors by angles library, issue with angle radius=
%default angle radius=1cm and it does not scale accordingly
\pic[draw=gray] {angle={u'1--O--u'2}};
% rotation traces
\pic[draw=red, dashed, <-, angle radius=1.8cm] {angle={u'1--O--vec1}};
\pic[draw=blue, dashed, <-, angle radius=5.3cm] {angle={u'1u'2--O--u1u2}};
%vector sums labels
\coordinate[label={below:$w$}] (w) at (u1u2);
\coordinate[label={below:$w'$}] (w') at (u'1u'2);
% outgoing vector scaled accordingly but I'd rather prefer not
\path[draw, fill=white] (O) circle[radius=2pt];
\path[fill] (O) circle[radius=1pt];
\end{tikzpicture}
\end{document}
+
이름을 사용하는 것이 좋은 생각 인지 확신이 서지 않아 좌표 이름 중 일부를 변경했습니다 . 이것을 준수하든 안 하든 자유롭게 선택하세요.
(O)
원의 크기를 조정하지 않으려면 \pic
여기에서 원을 만드세요. 우리는 \pic
s가 스케일링의 영향을 받지 pics/angle/.append style={/tikz/transform shape}
않으며 transform shape
를 \pic{angle}
.
\documentclass[border=1cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc, angles}
\begin{document}
%rotate vectors
\begin{tikzpicture}[
vector/.style={thick,-stealth},
scale=0.4,
pics/angle/.append style={/tikz/transform shape},
pics/origin/.style={
code={
\path[draw, fill=white] (0,0) circle[radius=2pt];
\path[fill] (0,0) circle[radius=1pt];
}
}
]
%drawing help lines
\newcommand*{\xmin}{-3}\newcommand*{\xmax}{4}
\newcommand*{\ymin}{-5}\newcommand*{\ymax}{1}
\draw[help lines] (\xmin,\ymin) grid (\xmax,\ymax);
%vector coordinates and labels
\coordinate[label={above:$v$}] (O) at (0,0);
\coordinate (vec1) at (1,-2);
\coordinate (vec2) at (4,-1);
\draw[vector] (O) -- (vec1)
coordinate[label={[below]$u_1$}] (u1);
%sum (vec1)+(vec2)
\draw[vector,very thick,blue] (O)--($(vec1)+(vec2)$)
coordinate (u1u2);
%rotated sum (u1)+(u2) -> u'1+u'2
\draw[vector,very thick,orange] (O)--([rotate=-90]u1u2)
coordinate (u'1u'2);
%rotated vectors
\draw[red,vector] (0,0) -- ([rotate=-90]vec1)
coordinate[label={[left]$u'_1$}] (u'1);
%
\draw[red,vector] (0,0) -- ([rotate=-90]vec2)
coordinate[label={[below]$u'_2$}] (u'2);
%angles between vectors by angles library, issue with angle radius=
%default angle radius=1cm and it does not scale accordingly
\pic[draw=gray] {angle={u'1--O--u'2}};
% rotation traces
\pic[draw=red, dashed, <-, angle radius=1.8cm] {angle={u'1--O--vec1}};
\pic[draw=blue, dashed, <-, angle radius=5.3cm] {angle={u'1u'2--O--u1u2}};
%vector sums labels
\coordinate[label={below:$w$}] (w) at (u1u2);
\coordinate[label={below:$w'$}] (w') at (u'1u'2);
% outgoing vector scaled accordingly but I'd rather prefer not
\pic at (O) {origin};
\end{tikzpicture}
\end{document}