Tikz 떨림 다이어그램의 크기 줄이기

Tikz 떨림 다이어그램의 크기 줄이기

다음 tikz 떨림 코드는 라텍스로 컴파일할 때 너무 크게 나타납니다. 줄이는 방법이 있나요?

감사합니다

\documentclass{article}
\usepackage{tikz-cd}
\begin{document}

\[\begin{tikzcd}[cramped]
    &&&&&&&&&&& {v_7} \\
    \\
    &&&&&&&&&&& {v_1} \\
    \\
    &&&&&&&&&&& {v_4} \\
    \\
    &&&&&&&&&&& {v_{10}} \\
    \\
    &&&&&&&&& {v_{11}} &&&& {v_{12}} \\
    &&&&&& {v_5} &&&&&&&&&& {v_6} \\
    &&& {v_2} &&&&&&&&&&&&&&&& {v_3} \\
    {v_8} &&&&&&&&&&&&&&&&&&&&&& {v_9}
    \arrow[no head, from=7-12, to=9-10]
    \arrow[no head, from=7-12, to=9-14]
    \arrow[no head, from=9-10, to=9-14]
    \arrow[no head, from=5-12, to=10-7]
    \arrow[no head, from=5-12, to=10-17]
    \arrow[no head, from=10-7, to=10-17]
    \arrow[no head, from=3-12, to=11-4]
    \arrow[no head, from=3-12, to=11-20]
    \arrow[no head, from=11-4, to=11-20]
    \arrow[no head, from=1-12, to=12-23]
    \arrow[no head, from=1-12, to=12-1]
    \arrow[no head, from=12-1, to=12-23]
\end{tikzcd}\]

\end{document}

여기에 이미지 설명을 입력하세요

답변1

\documentclass[tikz, border=1cm]{standalone}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}[cramped, sep=tiny]
&&&&&&&&&&& {v_7} \\
\\
&&&&&&&&&&& {v_1} \\
\\
&&&&&&&&&&& {v_4} \\
\\
&&&&&&&&&&& {v_{10}} \\
\\
&&&&&&&&& {v_{11}} &&&& {v_{12}} \\
&&&&&& {v_5} &&&&&&&&&& {v_6} \\
&&& {v_2} &&&&&&&&&&&&&&&& {v_3} \\
{v_8} &&&&&&&&&&&&&&&&&&&&&& {v_9}
\arrow[no head, from=7-12, to=9-10]
\arrow[no head, from=7-12, to=9-14]
\arrow[no head, from=9-10, to=9-14]
\arrow[no head, from=5-12, to=10-7]
\arrow[no head, from=5-12, to=10-17]
\arrow[no head, from=10-7, to=10-17]
\arrow[no head, from=3-12, to=11-4]
\arrow[no head, from=3-12, to=11-20]
\arrow[no head, from=11-4, to=11-20]
\arrow[no head, from=1-12, to=12-23]
\arrow[no head, from=1-12, to=12-1]
\arrow[no head, from=12-1, to=12-23]
\end{tikzcd}
\end{document}

삼각 누적 다이어그램

답변2

이를 수행하는 또 다른 방법이 있습니다.

결과

마지막 코드에는 환경에서 사용할 경우 작동하는 삼각형 하나만 표시됩니다 tikzpicture.

% ~~~ just one triangle ~~~~~~~~~~~~~~~~~~~~~~~
    \draw ( 90:1) node[txt]{$v_1$} -- 
          (200:2) node[txt]{$v_2$} -- 
          (340:2) node[txt]{$v_3$} -- cycle;
  • 극좌표를 사용하다
  • (90:1)에서 (200:2)에서 (340:2)로 그리고 ;이 경로를 닫고 끝냅니다( ).
  • node다음 위치에 있을 때 마다 를 넣으세요 (누락된 것을 보세요 \).
  • 이 노드에 흰색을 채우는 스타일을 사용하세요.
  • 텍스트를 입력하세요. 여기 수학 모드에서$ .. $

두 번째 매크로를 그리고 리팩토링 측면에서 생각하면 TeX 매크로를 사용하는 것이 합리적으로 보입니다.

  • Tikz확실히 이유가 있어서 \def를 선호하는 경향이 있습니다.\newcommand
  • 일을 충분히 단순하게 유지하기 위해 세로 길이와 3개의 인덱스만 전달합니다. (이것은 확실히 더 구체화될 수 있습니다.)
  • 이는 동일한 삼각형을 다음과 같이 추상화합니다.
\def\triag#1#2#3#4{% y-length, 3 indices
    \draw ( 90:#1  ) node[txt]{$v_{#2}$} -- %
          (200:2*#1) node[txt]{$v_{#3}$} -- %
          (340:2*#1) node[txt]{$v_{#4}$} -- cycle;}%

마지막으로 환경 내에서 원하는 만큼 이러한 삼각형을 호출하면 tikzpicture일련의 \draw ... ;경로로 확장됩니다.

\documentclass[10pt,border=3mm,tikz]{standalone}

\def\triag#1#2#3#4{% y-length, 3 indices
    \draw ( 90:#1  ) node[txt]{$v_{#2}$} -- %
          (200:2*#1) node[txt]{$v_{#3}$} -- %
          (340:2*#1) node[txt]{$v_{#4}$} -- cycle;}%

\begin{document}
 \begin{tikzpicture}[
    txt/.style={fill=white},
 ]
    \triag{.5}{10}{11}{12}
    \triag{1  }{4}{5}{6}
    \triag{1.5}{1}{2}{3}
    \triag{2  }{7}{8}{9}
 \end{tikzpicture}
\end{document}

% ~~~ just one triangle ~~~~~~~~~~~~~~~~~~~~~~~
%   \draw ( 90:1) node[txt]{$v_1$} -- 
%         (200:2) node[txt]{$v_2$} -- 
%         (340:2) node[txt]{$v_3$} -- cycle;

% ~~~ later refactored using a TeX macro \triag ~~~

관련 정보