
xelatex와 효율적으로 컴파일되지 않기 때문에 xelatex 및 ps-tricks와 호환되지 않기 때문에 tree-dvips를 제거하고 싶습니다. 나는 다음과 같은 수치를 가지고 있습니다 :
tabular
노드 배열을 위해 를 사용하여 조판되었습니다 . 그런 다음 tree-dvips
(및 나중에 )을 사용하여 ps-tricks
핸들(h0, h7, ...)을 핸들이 지배하는 용어에 연결했습니다. 선은 핸들 아래에서 시작하여 지배 노드의 중앙, 지배 노드의 북쪽에서 끝납니다.
이제 을(를) 사용하여 솔루션을 얻었 tikzmark
지만 표시된 요소의 위치를 손으로 이동해야 한다는 단점이 있는 것 같습니다. 즉, 선이 북쪽/중간에서 끝나지 않고 남쪽/중간에서 시작되지 않습니다.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark} % saves positions in tikz pictures, allows to connect arbitrary text
\usetikzlibrary{calc}
\begin{document}
\begin{figure}
\centering
\begin{tabular}{@{}ccc@{}}
& \tikzmark{h0}{h0} & \\[4ex]
\tikzmark{h8}{h8:wieder(\tikzmark{h8h9}{h9})}\\[4ex]
\tikzmark{h1}{h1:every(x, \tikzmark{h1h2}{h2}, \tikzmark{h1h3}{h3})} & & \tikzmark{h6}{h6:CAUSE(max, \tikzmark{h6h7}{h7})}\\[8ex]
\tikzmark{h4}{h4:window(x)} & & \\[6ex]
& \tikzmark{h5}{h5:open(x)}\\
\end{tabular}
\begin{tikzpicture}[overlay,remember picture]
\draw[dashed] ($(pic cs:h0)+(3ex,2.5ex)$) to($(pic cs:h8)+(1ex,2ex)$);
\draw[dashed] ($(pic cs:h0)+(3ex,2.5ex)$) to($(pic cs:h6)+(1ex,2ex)$);
\draw[dashed] ($(pic cs:h8h9)+(3ex,2.5ex)$) to($(pic cs:h1)+(1ex,2ex)$);
\draw[dashed] ($(pic cs:h6h7)+(3ex,2.5ex)$) to($(pic cs:h5)+(1ex,2ex)$);
\draw[dashed] ($(pic cs:h1h2)+(3ex,2.5ex)$) to($(pic cs:h4)+(1ex,2ex)$);
\draw[dashed] ($(pic cs:h1h3)+(3ex,2.5ex)$) to($(pic cs:h5)+(1ex,2ex)$);
\end{tikzpicture}
\end{figure}
\end{document}
(실제 솔루션에서는 이것이 필요하지 않다고 생각하기 때문에 내 MWE에서는 이동이 제대로 수행되지 않습니다.) 나는 tikzpicture에 표 형식 환경을 넣거나 \subnode
표 형식 환경에서 사용하려고 시도했지만 이러한 시도 중 어느 것도 작동하지 않았습니다.
편집하다:아래 해결책을 시도했지만 다음과 같은 결과를 얻었습니다.
! Package pgfkeys Error: I do not know the key '/tcb/empty' and I am going to i
gnore it. Perhaps you misspelled it.
See the pgfkeys package documentation for explanation.
Type H <return> for immediate help.
...
l.15 & \mybox[h0]{h0}
& \\[4ex]
?
tcb에 2013이 아닌 texlive 2014가 필요한 것이 있나요?
답변1
수동 계산을 피하기 위해 tcolorbox
연결하려는 부품 주위에 앵커(예 south
: , 등)를 제공하는 보이지 않는 상자를 만드는 데 사용할 수 있습니다 .north
\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\newtcbox{\mybox}[1][]{empty,shrink tight,nobeforeafter,on line,before upper=\vphantom{gM},remember as=#1}
\begin{document}
\begin{figure}
\centering
\begin{tabular}{@{}ccc@{}}
& \mybox[h0]{h0} & \\[4ex]
\mybox[h8]{h8:wieder}\mybox[h9]{(h9)} \\[4ex]
\mybox[h1]{h1:every(x, \mybox[h2]{h2}, \mybox[h3]{h3})} & & \mybox[h6]{h6:CAUSE(max, \mybox[h7]{h7})}\\[8ex]
\mybox[h4]{h4:window(x)} & & \\[6ex]
& \mybox[h5]{h5:open(x)}\\
\end{tabular}
\begin{tikzpicture}[overlay,remember picture,draw=gray,dashed,shorten <=2pt,shorten >=2pt]
\draw(h0.south)--(h8.north);
\draw(h0.south)--(h6.north);
\draw(h9.south)--(h1.north);
\draw(h2.south)--(h4.north);
\draw(h3.south)--(h5.north);
\draw(h7.south)--(h5.north);
\end{tikzpicture}
\end{figure}
\end{document}
완전성을 위해 두 번째 그림과 유사한 또 다른 그림은 다음과 같습니다.
\draw(h3.south) .. controls +(0,-1) and +(-1,1).. (h6.north);
편집하다:주석의 논의를 요약하기 위해 다음 코드는 empty
키(TeX Live 2013에서는 사용할 수 없음)를 사용하지 않고 및 를 사용하여 bottom
상자 top
위와 아래에 더 많은 공간을 추가합니다.
\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\newtcbox{\mybox}[1][]{enhanced,boxrule=0pt,colframe=white,colback=white,shrink tight,nobeforeafter,on line,before upper=\vphantom{gM},remember as=#1,top=3pt,bottom=3pt}
\begin{document}
\begin{figure}
\centering
\begin{tabular}{@{}ccc@{}}
& \mybox[h0]{h0} & \\[4ex]
\mybox[h8]{h8:wieder}\mybox[h9]{(h9)} \\[4ex]
\mybox[h1]{h1:every(x, \mybox[h2]{h2}, \mybox[h3]{h3})} & & \mybox[h6]{h6:CAUSE(max, \mybox[h7]{h7})}\\[8ex]
\mybox[h4]{h4:window(x)} & & \\[6ex]
& \mybox[h5]{h5:open(x)}\\
\end{tabular}
\begin{tikzpicture}[overlay,remember picture,draw=gray,dashed,shorten <=2pt,shorten >=2pt]
\draw(h0.south)--(h8.north);
\draw(h0.south)--(h6.north);
\draw(h9.south)--(h1.north);
\draw(h2.south)--(h4.north);
\draw(h3.south)--(h5.north);
\draw(h7.south)--(h5.north);
\end{tikzpicture}
\end{figure}
\end{document}
답변2
패키지를 사용하는 대신 tikzmark
자신만 \tikzmark
의 정규 패키지를 정의할 수 있습니다 node
. 패키지를 사용할 필요가 없습니다 tcolorbox
.
\documentclass{article}
\usepackage{tikz}
\newcommand{\tikzmark}[2]%
{\tikz[baseline=(#1.base), remember picture]\node[outer sep=0pt, inner sep=0pt] (#1) {#2};}
\begin{document}
\begin{figure}
\centering
\begin{tabular}{@{}ccc@{}}
& \tikzmark{h0}{h0} & \\[4ex]
\tikzmark{h8}{h8:wieder}\tikzmark{h8h9}{(h9)}\\[4ex]
\tikzmark{h1}{h1:every}(x, \tikzmark{h1h2}{h2}, \tikzmark{h1h3}{h3}) & & \tikzmark{h6}{h6:CAUSE}(max, \tikzmark{h6h7}{h7})\\[8ex]
\tikzmark{h4}{h4:window(x)} & & \\[6ex]
& \tikzmark{h5}{h5:open(x)}\\
\end{tabular}
\begin{tikzpicture}[overlay,remember picture,draw=gray,dashed,shorten <=2pt,shorten >=2pt]
\draw(h0.south)--(h8.north);
\draw(h0.south)--(h6.north);
\draw(h8h9.south)--(h1.north);
\draw(h1h2.south)--(h4.north);
\draw(h1h3.south)--(h5.north);
\draw(h6h7.south)--(h5.north);
\end{tikzpicture}
\end{figure}
\end{document}