Tikz 순서도에서 줄 사이의 수직 거리를 줄이는 방법은 무엇입니까?

Tikz 순서도에서 줄 사이의 수직 거리를 줄이는 방법은 무엇입니까?

저는 라텍스와 Tikz를 처음 사용하는데 도움을 주셔서 감사합니다. 이것은 내 코드이며 그림에서 빨간색 화살표로 표시된 공간을 제거하고 싶습니다.

이것은 내 코드입니다.

\documentclass[margin=3mm]{standalone} \usepackage{tikz} \begin{document} 
\begin{tikzpicture}[node distance=2cm, process/.style = {draw, rounded corners, minimum width=6cm, minimum height=1cm, text width= 6cm, align=center}] 
\node (pro1) [process] {Create expensive vectors from expensive paths}; 
\node (pro2) [process, below of=pro1] {Process 1}; 
% Drawing lines 
\draw [->] (pro1) -- (pro2); 
\end{tikzpicture} 
\end{document}

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

답변1

귀하의 문서는 아래의 MWE(Minimal Working example)와 유사한 구조를 갖고 있는 것 같습니다. 첫 번째 예에서는 문제를 재현하고 두 번째 예에서는 이에 대한 치료법을 포함합니다.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{setspace}  % <---
\setstretch{1.5}       % <---

\usepackage{lipsum}

\begin{document}
MWE, which reproduce your problem:
    \begin{figure}[ht]
\begin{tikzpicture}[node distance=1cm,
process/.style = {draw, rounded corners,
                  minimum width=6cm, minimum height=1cm, text width= 6cm, align=center}
                  ]
\node (pro1) [process] {Create expensive vectors from expensive paths};
\node (pro2) [process, below=of pro1] {Process 1};
\draw [->] (pro1) -- (pro2);
\end{tikzpicture}
    \end{figure}

MWE with cure for your problem:
    \begin{figure}[ht]
    \setstretch{1}          % <===
\begin{tikzpicture}[node distance=1cm,
process/.style = {draw, rounded corners, 
                  minimum height=1cm, text width= 6cm, align=center}
                  ]
\node (pro1) [process] {Create expensive vectors from expensive paths};
\node (pro2) [process, below=of pro1] {Process 1};
\draw [->] (pro1) -- (pro2);
\end{tikzpicture}
    \end{figure}
\end{document}

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

\onehalfspacing위의 MWE와 코드 조각을 비교하면 n 노드 콘텐츠 의 배치가 잘못되었음을 쉽게 알 수 있습니다 . tikzpicture두 번째 예와 마찬가지로 이전이어야 합니다 .

첫 번째 예에서는 컴파일 시 오류가 발생하기 때문에 노드에서 제거했습니다.

순서도에 대한 추가 도움말을 보려면 MWE 형식으로 전체 순서도 코드를 제공해야 합니다. 제공된 코드 조각에서 스타일 지정 및 이상한 위치 지정 방법에 더 이상 사용되지 않는 명령을 사용한다는 결론을 내릴 수 있습니다. 위의 MWE( positioning구문에 라이브러리 포함)에서 사용되는 방법이 훨씬 더 좋습니다 .

관련 정보