
私は LaTeX と 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) と似た構造になっていると思います。最初の例では問題を再現し、2 番目の例ではその解決策が含まれています。
\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}
コード フラグメントを上記の MWE と比較すると、n ノード コンテンツの配置が間違っていることが簡単にわかります。2番目の例のように、\onehalfspacing
以前はそうである必要がありました。tikzpicture
最初の例では、コンパイル時にエラーが発生するため、ノードから削除します。
フローチャートに関するさらなる支援を得るには、完全なフローチャート コードを MWE 形式で提供する必要があります。提供されたコード フラグメントから、スタイル設定に非推奨のコマンドを使用し、配置方法が奇妙であると結論付けることができます。上記の MWE で使用されている方法 (positioning
構文にライブラリを含む) の方がはるかに優れています。