
내가 궁극적으로 갖고 싶은 것부터 먼저 시작하겠습니다. 두 이미지를 나란히 두고 싶습니다. 나는 두 사진 사이에 G 지점이 수평으로 있기를 원하고 두 이미지의 크기가 동일하기를 원합니다. (왼쪽의 GA 사이의 거리는 오른쪽의 거리와 동일하지만 이들의 회전은 다릅니다). 마지막으로 왼쪽 이미지 G를 페이지 왼쪽 중앙에 배치하고 오른쪽 이미지 G를 페이지 오른쪽 중앙에 배치하고 싶습니다.
내 코드가 현재 작동하는 방식은 둘 사이의 스케일이 동일하고(둘 다 동일한 tikzpicture에 있기 때문에) G 포인트가 둘 다 코드에서 y=0에 있기 때문에 수평이라는 것입니다.
내가 가지고 있지 않은 것은 왼쪽-오른쪽 센터링입니다. 왼쪽 이미지에 더 많은 텍스트가 있으므로 두 이미지가 모두 오른쪽으로 푸시됩니다. 또한 왼쪽과 오른쪽의 G 사이의 거리를 수동으로 지정하기 때문에 이것은 실패합니다.
G 포인트의 중간점을 페이지의 수평 중앙에 위치시킬 수 있다면 둘 사이의 고정된 거리에 만족할 것입니다.
또한 하위 그림을 시도해 보았지만 크기 조정이 엉망인 것 같고 여전히 그림 크기 조정 상자에서 G 지점을 수평 중앙에 배치할 수 없습니다.
내 코드를 너무 많이 수정하지 않고도 이것을 중앙에 올바르게 배치할 수 있도록 도와줄 수 있는 사람이 있나요?
편집: 왼쪽 G와 오른쪽 G의 중간점이 중앙에 있고 그림보다 넓은 tikzpicture 선을 만들어 임시 해결 방법을 생각해 냈습니다. 그러나 이것은 조잡한 해결 방법처럼 보입니다. 또한 서문과 \begin{document}을 더 추가했습니다. 작동하는 버전이어야 합니다.
편집 2: 또한 제가 한 방식을 개선할 수 있는 다른 방법이 있으면 제안해 주세요. 저는 아직 Tikz를 처음 사용하는 초보여서 자세한 내용을 잘 모릅니다.
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{tikz}
\usepackage{caption,subcaption}
\newcommand\centerarc[6]{
% \centerarc{format}{center_x}{center_y}{radius}{start angle}{end angle};
\draw[#1] ({#2+#4*cos(#5 )},{#3+#4*sin(#5 )}) arc [radius=#4, start angle =#5, end angle=#6];
}
\newcommand\centerofmass{
\tikz[radius=0.4em] {
\fill (0,0) -- ++(0.4em,0) arc [start angle=0,end angle=90] -- ++(0,-0.8em) arc [start angle=270, end angle=180];
\fill [color=white] (0,0) -- ++(0,0.4em) arc [start angle=90,end angle=180] -- ++(0.8em,0) arc [start angle=0, end angle=-90];
\draw (0,0) circle;
}
}
\begin{document}
\begin{figure}[]
\centering
\resizebox{!}{5in}{
\begin{tikzpicture}[scale=0.5,>=stealth]
\draw[line width=8pt, cap=round] (0,0)--(0,0.9);
\draw[line width=8pt, cap=round] (0,0.9)--(0,5.1);
\draw[line width=8pt, cap=round] (0,5.1)--(0,9.9);
\draw[line width=8pt, cap=round] (0,9.9)--(0,18.1);
\filldraw[fill=white] (0,0) circle (0.2);
\filldraw[fill=white] (0,0.9) circle (0.2);
\filldraw[fill=white] (0,5.1) circle (0.2);
\filldraw[fill=white] (0,9.9) circle (0.2);
\filldraw[fill=white] (0,18.1) circle (0.2);
\node [] at (0,14) {\Large\centerofmass};
\node [left] at (-1,0) {Ground Contact Point $\to$ G};
\node [left] at (-1,0.9) {COR of Ankle $\to$ A};
\node [right] at (1,5.1) {K$\gets$ COR of Knee};
\node [left] at (-1,9.9) {COR of Hip $\to$ H};
\node [left] at (-1,18.1) {Crown $\to$ C};
\centerarc{}{0}{0.9}{0.7}{-90}{90};
\node [right] at (0.7,0.9) {$\alpha$};
\centerarc{}{0}{5.1}{0.7}{90}{270};
\node [left] at (-0.7,5.1) {$\theta$};
\centerarc{}{0}{9.9}{0.7}{-90}{90};
\node [right] at (0.7,9.9) {$\beta$};
\draw[line width=2pt, color=red, ->] (0,17)--(0,14);
\node[anchor=west, color=red] at (0.2,17) {$F=2mg$};
\draw[line width=2pt, color=red, ->] (0,-3)--(0,0);
\node[anchor=west, color=red] at (0.2,-3) {$F=2mg$};
\node[] at (0,-5) {(a)};
\def\slide{12}
\draw[line width=8pt, cap=round] (0+\slide,0)--(0+\slide,0.9);
\draw[line width=8pt, cap=round] (0+\slide,0.9)--(2.068+\slide,3.655+0.9);
\draw[line width=8pt, cap=round] (2.065+\slide,3.655+0.9)--(0+\slide,9.9-1.012);
\draw[dashed] (0+\slide,0.9) -- (0+\slide,9.9-1.012);
\draw[line width=8pt, cap=round] (0+\slide,9.9-1.012)--(0+\slide,18.1-1.012);
\filldraw[fill=white] (0+\slide,0) circle (0.2);
\filldraw[fill=white] (0+\slide,0.9) circle (0.2);
\filldraw[fill=white] (2.065+\slide,3.655+0.9) circle (0.2);
\filldraw[fill=white] (0+\slide,9.9-1.012) circle (0.2);
\filldraw[fill=white] (0+\slide,18.1-1.012) circle (0.2);
\node [] at (0+\slide,14-1.012) {\Large\centerofmass};
\node [left] at (-1+\slide,0) {G};
\node [left] at (-1+\slide,0.9) {A};
\node [right] at (1+2.065+\slide,3.655+0.9) {K};
\node [left] at (-1+\slide,9.9-1.012) {H};
\node [left] at (-1+\slide,18.1-1.012) {C};
\centerarc{}{0+\slide}{0.9}{0.7}{-90}{60.5};
\node [right] at (0.7+\slide,0.9) {$\alpha$};
\centerarc{}{2.068+\slide}{3.655+0.9}{0.7}{115}{240};
\node [left] at (-0.7+2.068+\slide,3.655+0.9) {$\theta$};
\centerarc{}{0+\slide}{9.9-1.012}{0.7}{90}{-65}
\node [right] at (0.7+\slide,9.9-1.012) {$\beta$};
\draw[line width=2pt, color=red, ->] (0+\slide,17-1.012)--(0+\slide,14-1.012);
\node[anchor=west, color=red] at (0.2+\slide,17-1.012) {$F=2mg$};
\draw[line width=2pt, color=red, ->] (0+\slide,-3)--(0+\slide,0);
\node[anchor=west, color=red] at (0.2+\slide,-3) {$F=2mg$};
\node[] at (0+\slide,-5) {(b)};
\end{tikzpicture}
}
\caption{\label{fig:stick}(a) Vertical standing position model and notation convention for lab. (b) Points $G,A,H,C$ always stay co-linear during the course of the motion.}
\end{figure}
\end{document}
답변1
유용한 것:
scope
환경. 이를 통해scale
/red
/ 등의 속성을thick
별도로 설정할 수 있습니다 .\paperwidth
,\textwidth
, 및72.27
(이것이 마진입니다).xshift
, 또는 일반shift={(1,2)}
.\useasboundingbox
. 이로 인해 TeX는tikzpicture
. 비슷smash
하거나clap
훨씬 더 유연합니다.
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{tikz}
\usepackage{caption,subcaption}
\newcommand\centerarc[6]{
\draw[#1]({#2+#4*cos(#5)},{#3+#4*sin(#5)})arc[radius=#4,start angle=#5,end angle=#6];}
\newcommand\centerofmass{
\tikz[radius=0.4em]{
\fill(0,0)--++(0.4em,0)arc[start angle=0,end angle=90]--++(0,-0.8em)arc[start angle=270,end angle=180];
\fill[color=white](0,0)--++(0,0.4em)arc[start angle=90,end angle=180]--++(0.8em,0)arc[start angle=0,end angle=-90];\draw(0,0)circle;}}
\begin{document}
\begin{figure}
\noindent
\begin{tikzpicture}[>=stealth]
\useasboundingbox(-.25\paperwidth+72.27,-5)rectangle(0,7);
\begin{scope}[scale=0.5]
\draw[line width=8pt, cap=round] (0,0)--(0,0.9);
\draw[line width=8pt, cap=round] (0,0.9)--(0,5.1);
\draw[line width=8pt, cap=round] (0,5.1)--(0,9.9);
\draw[line width=8pt, cap=round] (0,9.9)--(0,18.1);
\filldraw[fill=white] (0,0) circle (0.2);
\filldraw[fill=white] (0,0.9) circle (0.2);
\filldraw[fill=white] (0,5.1) circle (0.2);
\filldraw[fill=white] (0,9.9) circle (0.2);
\filldraw[fill=white] (0,18.1) circle (0.2);
\node [] at (0,14) {\Large\centerofmass};
\node [left] at (-1,0) {Ground Contact Point $\to$ G};
\node [left] at (-1,0.9) {COR of Ankle $\to$ A};
\node [right] at (1,5.1) {K$\gets$ COR of Knee};
\node [left] at (-1,9.9) {COR of Hip $\to$ H};
\node [left] at (-1,18.1) {Crown $\to$ C};
\centerarc{}{0}{0.9}{0.7}{-90}{90};
\node [right] at (0.7,0.9) {$\alpha$};
\centerarc{}{0}{5.1}{0.7}{90}{270};
\node [left] at (-0.7,5.1) {$\theta$};
\centerarc{}{0}{9.9}{0.7}{-90}{90};
\node [right] at (0.7,9.9) {$\beta$};
\draw[line width=2pt, color=red, ->] (0,17)--(0,14);
\node[anchor=west, color=red] at (0.2,17) {$F=2mg$};
\draw[line width=2pt, color=red, ->] (0,-3)--(0,0);
\node[anchor=west, color=red] at (0.2,-3) {$F=2mg$};
\node[] at (0,-5) {(a)};
\def\slide{12}
\end{scope}
\begin{scope}[scale=0.5,xshift=\paperwidth]
\draw[line width=8pt, cap=round] (0,0)--(0,0.9);
\draw[line width=8pt, cap=round] (0,0.9)--(2.068,3.655+0.9);
\draw[line width=8pt, cap=round] (2.065,3.655+0.9)--(0,9.9-1.012);
\draw[dashed] (0,0.9) -- (0,9.9-1.012);
\draw[line width=8pt, cap=round] (0,9.9-1.012)--(0,18.1-1.012);
\filldraw[fill=white] (0,0) circle (0.2);
\filldraw[fill=white] (0,0.9) circle (0.2);
\filldraw[fill=white] (2.065,3.655+0.9) circle (0.2);
\filldraw[fill=white] (0,9.9-1.012) circle (0.2);
\filldraw[fill=white] (0,18.1-1.012) circle (0.2);
\node [] at (0,14-1.012) {\Large\centerofmass};
\node [left] at (-1,0) {G};
\node [left] at (-1,0.9) {A};
\node [right] at (1+2.065,3.655+0.9) {K};
\node [left] at (-1,9.9-1.012) {H};
\node [left] at (-1,18.1-1.012) {C};
\centerarc{}{0}{0.9}{0.7}{-90}{60.5};
\node [right] at (0.7,0.9) {$\alpha$};
\centerarc{}{2.068}{3.655+0.9}{0.7}{115}{240};
\node [left] at (-0.7+2.068,3.655+0.9) {$\theta$};
\centerarc{}{0}{9.9-1.012}{0.7}{90}{-65}
\node [right] at (0.7,9.9-1.012) {$\beta$};
\draw[line width=2pt, color=red, ->] (0,17-1.012)--(0,14-1.012);
\node[anchor=west, color=red] at (0.2,17-1.012) {$F=2mg$};
\draw[line width=2pt, color=red, ->] (0,-3)--(0,0);
\node[anchor=west, color=red] at (0.2,-3) {$F=2mg$};
\node[] at (0,-5) {(b)};
\end{scope}
\end{tikzpicture}
\caption{\label{fig:stick}(a) Vertical standing position model and notation convention for lab. (b) Points $G,A,H,C$ always stay co-linear during the course of the motion.}
\end{figure}
\end{document}