![创建要导出到 Word 的逻辑树](https://linux22.com/image/467070/%E5%88%9B%E5%BB%BA%E8%A6%81%E5%AF%BC%E5%87%BA%E5%88%B0%20Word%20%E7%9A%84%E9%80%BB%E8%BE%91%E6%A0%91.png)
我正在尝试排版一本即将出版的逻辑书。它包含许多逻辑树、真值表等。问题是出版商希望它是 Word 文件,因此我无法使用 latex 完成整个工作。我尝试将树导出为 png 以将其插入 Word,但打印质量太差。我尝试将文本从 pdf 导出到 word,但导出的文本要么错误,要么在我触摸文件时就中断了。我将与您分享的代码和树来自霍奇斯的“逻辑”,因为出于法律原因,我无法分享我正在排版的书。
\documentclass[10pt, preview]{standalone}
\usepackage{prooftrees}
\usepackage[]{amsmath}
\usepackage{mathtools}
\usepackage{standalone}
\usepackage{verbatim}
\begin{document}
\begin{align*}
&\forall x ((Mx \wedge Cx) \rightarrow \forall y(Py \rightarrow Sxy)).\; \exists x Px.\\
&\forall x((Cx \wedge \exists y(Py \wedge Sxy)) \rightarrow Bx).\; (Mb \wedge Cb).\\
&\textit{Therefore}\; Bb.
\end{align*}
\begin{center}
% \textbf{Tableaux:}\\
\begin{prooftree}
{
%to prove={
%\forall x ((Mx \wedge Cx) \rightarrow \forall y(Py \rightarrow Sxy)).\, \exists x Px.\,
%\forall x((Cx \wedge \exists y(Py \wedge Sxy)) \rightarrow Bx).\, (Mb \wedge Cb).\,
%\textit{Therefore}\, Bb.}
}
[\forall x ((Mx \wedge Cx) \rightarrow \forall y (Py \rightarrow Sxy))
[\exists xPx
[\forall x((Cx \wedge \exists y(Py \wedge Sxy)) \rightarrow Bx)
[(Mb \wedge Cb)
[\lnot Bb
[((Mb \wedge Cb) \rightarrow \forall y(Py \rightarrow Sby))
[\lnot (Mb \wedge Cb), close]
[\forall y(Py \rightarrow Sby)
[Pd
[Pd \rightarrow Sbd
[\lnot Pd, close]
[Sbd
[((Cb \wedge \exists y(Py \wedge Sby)) \rightarrow Bb)
[\lnot (Cb \wedge \exists y(Py \wedge Sby))
[\lnot Cb
[Mb
[Cb, close]
]
]
[\lnot \exists y(Py \wedge Sby)
[\forall y \lnot (Py \wedge Sby)
[\lnot (Pd \wedge Sbd)
[\lnot Pd, close]
[\lnot Sbd, close]
]
]
]
]
[\lnot Bb,close]]]]]]]]]]]]
\end{prooftree}
\end{center}
\end{document}
我认为区别很明显。我也用蒂克兹但情况并没有任何好转。
\documentclass[10pt, preview]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{center}
\begin{tikzpicture}[node distance=1.5ex]
%CONTENT
\node (a) {$\forall x(x=b \iff (Mx \wedge Cx))$};
\node (b) [below=of a] {$\forall x(Cx \rightarrow (Bx \iff Mx))$};
\node (c) [below=of b] {$\lnot \forall x(x=b \iff (Cx \wedge Bx))$};
\node (d) [below=of c] {$\exists x \lnot (x=b \iff (Cx \wedge Bx))$};
\node (e) [below=of d] {$\lnot (d=b \iff (Cd \wedge Bd))$};
\node (f) [below left=of e, xshift=10mm] {$d=b$};
\node (g) [below right=of e, xshift=-10mm] {$\lnot d=b$};
\node (fa) [below=of f] {$\lnot (Cd \wedge Bd)$};
\node (fb) [below=of fa] {$\lnot (Cd \wedge Bb)$};
\node (fc) [below=of fb] {$(b=b \iff (Mb \wedge Cb))$};
\node (ga) [below=of g] {$(Cd \wedge Bd)$};
\node (gb) [below=of ga] {$Cd$};
\node (gc) [below=of gb] {$Bd$};
\node (gd) [below=of gc, xshift=10mm] {$(Cd \rightarrow (Bd \iff Md))$};
\node (fcla) [below left=of fc, xshift=10mm] {$b=b$};
\node (fclb) [below=of fcla] {$(Mb \wedge Cb)$};
\node (fclc) [below=of fclb] {$Mb$};
\node (fcld) [below=of fclc] {$Cb$};
\node (fcle) [below=of fcld, xshift=3mm] {$(Cb \rightarrow (Bb \iff Mb))$};
\node (fcra) [below right=of fc, xshift=-20mm] {$\lnot b = b$};
\node (fcrb) [below=of fcra] {\underline{$\lnot (Mb \wedge Cb)$}}; %You'll close this!!!
\node (fclea) [below left=of fcle, xshift=10mm] {\underline{$\lnot Cb$}}; %You'll close this.
\node (fcleb) [below right=of fcle, xshift=-10mm] {$(Bb \iff Mb)$};
\node (fcleba) [below left=of fcleb, xshift=10mm]{$Bb$};
\node (fclebb) [below=of fcleba] {$Mb$};
\node (fclebc) [below right=of fcleb, xshift=-10mm]{$\lnot Bb$};
\node (fclebd) [below=of fclebc] {\underline{$\lnot Mb$}}; %You'll close this.
\node (fclebba) [below left=of fclebb, xshift=1mm] {\underline{$\lnot Cb$}}; %CLOSE
\node (fclebbb) [below right=of fclebb, xshift=0mm]{\underline{$\lnot Bb$}}; %CLOSE
\node (gda) [below left=of gd, xshift=10mm] {\underline{$\lnot Cd$}}; %CLOSE
\node (gdb) [below right=of gd, xshift=-20mm] {$(Bd \iff Md)$};
\node (gdbra) [below right=of gdb, xshift=-10mm] {$\lnot Bd$};
\node (gdbrb) [below=of gdbra] {\underline{$\lnot Md$}}; %CLOSE
\node (gdlaa) [below left=of gdb, xshift=10mm] {$Bd$};
\node (gdlab) [below=of gdlaa] {$Md$};
\node (gdlac) [below=of gdlab, xshift=-2mm] {$(d = b \iff (Md \wedge Cd))$};
\node (lg) [below left=of gdlac, xshift=10mm] {$d=b$};
\node (lga) [below=of lg] {\underline{$(Md \wedge Cd)$}}; % Close
\node (rg) [below right=of gdlac, xshift=-10mm] {$\lnot d=b$};
\node (rga) [below=of rg] {$\lnot (Md \wedge Cd)$};
\node (rgal) [below left=of rga, xshift=10mm] {\underline{$\lnot Md$}}; %CLOSE
\node (rgar) [below right=of rga, xshift=-10mm] {\underline{$\lnot Cd$}}; %CLOSE
%PATHS
\path (f) edge[-] (e);
\path (g) edge[-] (e);
\path (fcla) edge[-] (fc);
\path (fcra) edge[-] (fc);
\path (fclea) edge[-] (fcle);
\path (fcleb) edge[-] (fcle);
\path (fcleba) edge[-] (fcleb);
\path (fclebc) edge[-] (fcleb);
\path (fclebba) edge[-] (fclebb);
\path (fclebbb) edge[-] (fclebb);
\path (gda) edge[-] (gd);
\path (gdb) edge[-] (gd);
\path (gdbra) edge[-] (gdb);
\path (gdlaa) edge[-] (gdb);
\path (lg) edge[-] (gdlac);
\path (rg) edge[-] (gdlac);
\path (rgal) edge[-] (rga);
\path (rgar) edge[-] (rga);
%LINE NUMBERS
\node (1) [left=3cm of a] {1.};
\node (2) at (1 |- b) {2.};
\node (3) at (1 |- c) {3.};
\node (4) at (1 |- d) {4.};
\node (5) at (1 |- e) {5.};
\node (6) at (1 |- f) {6.};
\node (7) at (1 |- fa) {7.};
\node (8) at (1 |- fb) {8.};
\node (9) at (1 |- fc) {9.};
\node (10) at (1 |- fcla) {10.};
\node (11) at (1 |- fclb) {11.};
\node (12) at (1 |- fclc) {12.};
\node (13) at (1 |- fcld) {13.};
\node (14) at (1 |- fcle) {14.};
\node (15) at (1 |- fclea) {15.};
\node (16) at (1 |- fcleba) {16.};
\node (17) at (1 |- fclebb) {17.};
\node (18) at (1 |- fclebba) {18.};
\end{tikzpicture}
\end{center}
\end{document}
它看起来像这样:
那么,我怎样才能让它们看起来漂亮,值得在 Word 文件中发布呢?另外还有一个问题,我怎样才能让树枝变成有角的直线,而不是这些对角线?
答案1
forest
forked edges
提供了一种称为库的一部分的分支样式edges
。由于prooftrees
loads forest
,您要么需要forest
先加载,要么使用单独的宏来加载库。以下示例演示了前一种方法。它还展示了如何容纳多行to prove
语句,不过我想知道是否prooftrees
应该为此提供一个现成的选项。
\documentclass[10pt, preview]{standalone}
\usepackage[edges]{forest}
\usepackage{prooftrees}
\usepackage[]{amsmath}
\usepackage{mathtools}
\begin{document}
\begin{prooftree}
{
to prove={
$\forall x ((Mx \wedge Cx) \rightarrow \forall y(Py \rightarrow Sxy)).\, \exists x Px.$\\
$\forall x((Cx \wedge \exists y(Py \wedge Sxy)) \rightarrow Bx).\, (Mb \wedge Cb).$\\
$\textit{Therefore}\, Bb.$},
proof statement format'={align=l,anchor=south},
forked edges,
}
[\forall x ((Mx \wedge Cx) \rightarrow \forall y (Py \rightarrow Sxy))
[\exists xPx
[\forall x((Cx \wedge \exists y(Py \wedge Sxy)) \rightarrow Bx)
[(Mb \wedge Cb)
[\lnot Bb
[((Mb \wedge Cb) \rightarrow \forall y(Py \rightarrow Sby))
[\lnot (Mb \wedge Cb), close]
[\forall y(Py \rightarrow Sby)
[Pd
[Pd \rightarrow Sbd
[\lnot Pd, close]
[Sbd
[((Cb \wedge \exists y(Py \wedge Sby)) \rightarrow Bb)
[\lnot (Cb \wedge \exists y(Py \wedge Sby))
[\lnot Cb
[Mb
[Cb, close]
]
]
[\lnot \exists y(Py \wedge Sby)
[\forall y \lnot (Py \wedge Sby)
[\lnot (Pd \wedge Sbd)
[\lnot Pd, close]
[\lnot Sbd, close]
]
]
]
]
[Bb,close]]]]]]]]]]]]
\end{prooftree}
\end{document}