
TikZ를 사용하여 다음 수직선을 어떻게 구성할 수 있는지 궁금합니다.
https://i.stack.imgur.com/oQtaD.jpg
여기에서 다른 질문을 읽어보았지만 제가 겪고 있는 주요 과제는 다음과 같습니다. (1) 수직선 중간에 세 개의 점 "..."을 만들고, (2) 중괄호를 두 개로 묶는 것입니다. (3) 일부 곱슬선 위와 아래에 텍스트를 배치합니다.
감사합니다!
답변1
- 귀하의 질문에는 원하는 이미지의 스케치가 표시되지 않고 액세스할 수 없는 링크만 표시됩니다.
- @Tom 답변의 이미지가 귀하가 원하는 이미지와 충분히 유사하기를 바랍니다.
- 나는 이 그림을 내가 원하는 대로 약간 다르게 그릴 것입니다.
- 나는 최대한 간결하고 명확하게 구조화된 MWE를 작성하려고 노력합니다.
\documentclass[border=3.141592]{standalone}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
decorations.pathreplacing,%
calligraphy,% had to be after decorations.pathreplacing
calc}
\begin{document}
\begin{tikzpicture}[
> = Straight Barb,
BC/.style args = {#1/#2}{
decorate,
decoration={calligraphic brace, amplitude=6pt,
pre =moveto, pre length=1pt,
post=moveto, post length=1pt,
raise=#1,
#2,% for mirroring of brace
},
ultra thick},
]
\draw [ultra thick,->] (-7.5,0) -- (7.5,0);
\foreach \i [count=\x from -6] in {-23,-22,-21,-20,-19,\dotsm,1,2,...,6}
\draw[thick] (\x,3mm) -- ++ (0,-6mm) node (n\x) [below] {$\i$};
%
\draw[BC=4mm/] (-6,0) -- node[above=6mm] {other text} (-2,0);
\draw[BC=8mm/mirror] ( 0,0) -- coordinate[below=11mm] (aux) (5,0);
\draw[<->, semithick, densely dashed, rounded corners]
(n-6) -- node[fill=white] {some text} ++ (0,-1.3) -| (aux);
\end{tikzpicture}
\end{document}
답변2
여기에 해결책이 있습니다. 코드를 더 간결하게 만드는 방법이 있나요? 어떤 충고?
\documentclass[border=1cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, decorations.pathreplacing,calc}
\begin{document}
\begin{tikzpicture}
\draw [line width=5pt,-{Triangle[length=0.5cm,width=0.5cm]}] (-7.5,0) -- (7.5,0);
\foreach \x in {-6,...,-2} {
\draw [line width=2pt] (\x,-0.5) node (bx\x) [font=\Large,xshift=-6pt,below=0.5cm] {\pgfmathparse{\x-17}$\mathbf{\pgfmathprintnumber{\pgfmathresult}}$} -- (\x,0.5) coordinate (tx\x);}
\draw [line width=2pt] (-1,-0.5) node (bx-1) [font=\bfseries\Large,below=0.75cm] {\dots} -- (-1,0.5) coordinate (tx-1);
\foreach \x in {0,...,6} {
\draw [line width=2pt] (\x,-0.5) node (bx\x) [font=\Large,below=0.5cm] {\pgfmathparse{\x+1}$\mathbf{\pgfmathprintnumber{\pgfmathresult}}$} -- (\x,0.5) coordinate (tx\x);}
\draw [decorate,decoration={brace,raise=10pt,amplitude=20pt}] (tx-6) -- (tx-1) node (TB) [midway,above=1.2cm,font=\large] {\textbf{Other Text}};
\draw [decorate,decoration={brace,raise=10pt,amplitude=20pt,mirror}] (bx0.south) -- (bx6.south) node (BB) [midway,below=1cm] {};
\draw [{[scale=2]Triangle}-] ($(bx-6)+(6pt,-10pt)$) -- ++(0,-0.7) node (ST) [below=4pt,font=\large] {\textbf{Some Text}};
\draw [shorten <=6pt,shorten >=6pt,-{[scale=2]Triangle}] (ST.south) .. controls +(-80:1.5cm) and +(200:1.5cm) .. (BB.south west);
\end{tikzpicture}
\end{document}