
여러 줄의 텍스트에 대해 노드의 줄 간격을 구성하려면 모든 단일 노드 내에서 텍스트 앞에 텍스트를 추가하고 그 뒤에 \baselineskip=2.5ex
추가 내용을 추가해야 합니다. \par
이런 일이 반복적으로 발생하지 않도록 하는 방법이 있나요?
\documentclass{report}
\usepackage{tikz}
\usetikzlibrary{calc,fit,positioning}
\begin{document}
\begin{tikzpicture}[
remember picture, overlay,
every node/.style={fill=green, font=\large}
]
\node (N0)
at (0,0)
{Start}; % <- That's what I want for multi-line text: Only the text
\node[right=of N0, text width=3cm, align=center] (N1)
{\baselineskip=2.5ex Looooooooooong multi-line text.\par}; % <- That's what's required
\node[right=of N1, text width=3cm, align=center] (N2)
{\baselineskip=2.5ex Another looooooooooong multi-line text.\par};
\end{tikzpicture}
\end{document}
이러한 접두어 및 접미어 명령을 정의하는 노드 스타일 매개변수가 있습니까?존재한다 postaction
preactions
나에게 도움이되지 않는 매개 변수 . 다음 코드는 올바른 줄 간격을 생성하지 않습니다( \par
무시되는 것 같습니다).
%...
every node/.style={fill=green, font=\large, postaction={\par}}
%...
\node[right=of N1, text width=3cm, align=center] (N2)
{\baselineskip=2.5ex Another looooooooooong multi-line text.};
%...
어떤 아이디어가 있나요?
답변1
은 필요하지 않지만 다음을 \par
사용할 수 있습니다 ./tikz/execute at begin node
/tikz/execute at end node
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[
every node/.style={fill=green, font=\large},
execute at begin node={\baselineskip=5ex\relax},
% execute at end node={\endgraf}% not needed, as far as I can see
]
\node (N0) at (0,0) {Start};
\node[right=of N0, text width=3.2cm, align=center] (N1)
{Looooooooooong multi-line text.};
\node[right=of N1, text width=3.2cm, align=center] (N2)
{Another looooooooooong multi-line text.};
\end{tikzpicture}
\end{document}
불필요한 을 제거하고 두 번째 노드에서 remember picture, overlay
과도하게 가득 차는 것을 방지하기 위해 3cm를 3.2cm로 늘렸고 효과를 더 눈에 띄게 하기 위해 를 늘렸습니다. 는 TeX가 에 할당된 값을 읽을 때 이후에 토큰을 확장하려고 시도하지 않도록 보장합니다 .\hbox
\baselineskip=2.5ex
\baselineskip=5ex
\relax
5ex
\baselineskip
답변2
당신이 사용할 수있는 font
. 이것이 당신에게 효과가 있는지 확인하십시오. 나는 \baselineskip=5ex
차이점을 강조하는 데 사용합니다.
\documentclass{report}
\usepackage{tikz}
\usetikzlibrary{calc,fit,positioning}
\begin{document}
\begin{tikzpicture}[
remember picture, overlay,
every node/.style={fill=green, font=\large},
baselineskip/.style={font={\large\baselineskip=#1}}
]
\node (N0)
at (0,0)
{Start}; % <- That's what I want for multi-line text: Only the text
\node[right=of N0, text width=3cm, align=center,baselineskip=5ex] (N1)
{Looooooooooong multi-line text.}; % <- That's what's required
\node[right=of N1, text width=3cm, align=center,baselineskip=5ex] (N2)
{Another looooooooooong multi-line text.};
\end{tikzpicture}
\end{document}