编辑

编辑

在此处输入图片描述

看起来很糟糕。我该如何防止这种情况发生?我试过了midpenalty,但没有用。代码如下所示。

\documentclass[oneside,12pt]{article}
\usepackage{geometry}
\usepackage{microtype}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\usepackage{enumitem}
\setlist[enumerate,1]{label=\bfseries\Alph*,align=left,leftmargin=*,
  labelsep=1.5em}
\setlist[enumerate,2]{label=\arabic*.,labelindent=1em,labelsep=1.5em,
  leftmargin=*,midpenalty=100000}

\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsthm}
\theoremstyle{definition}
\newtheorem*{sol}{Solution}

\usepackage{forest}
\forestset{
  ass/.append style={
    before computing xy={l=\baselineskip},
    no edge
  },
  prooftree/.style={
    for tree={
      child anchor=north,
      parent anchor=south
    }
  }
}

\begin{document}
\subsection*{Exercises 25}
\begin{enumerate}
\item Show the following simple arguments are valid by translating into QL and
  using trees.
  \begin{enumerate}
  \item Everyone is rational; hence Socrates is rational.
    \begin{sol}
      \leavevmode

      \begin{forest}
        prooftree
        [$\forall xRx$
        [$\neg Rs$,ass
        [$Rs$,ass
        [*,ass]]]]
      \end{forest}
    \end{sol}
  \item No one loves Angharad; hence Caradoc doesn’t love Angharad.
    \begin{sol}
      \leavevmode

      \begin{forest}
        prooftree
        [$\forall x\neg Lxa$
        [$\neg\neg Lca\checkmark$,ass
        [$Lca$,ass
        [$\neg Lca$,ass
        [*,ass]]]]]
      \end{forest}
    \end{sol}
  \item No philosopher speaks Welsh; Jones is a philosopher; hence Jones
    does not speak Welsh.
    \begin{sol}
      \leavevmode

      \begin{forest}
        prooftree
        [$\forall x(Fx\supset\neg Gx)$
        [$Fj$,ass
        [$\neg\neg Gj\checkmark$,ass
        [$Gj$,ass
        [$Fj\supset\neg Gj$,ass
        [$\neg Fj$ [*,ass]]
        [$\neg Gj$ [*,ass]]]]]]]
      \end{forest}
    \end{sol}
  \item Jones doesn’t speak Welsh; hence not everyone speaks Welsh.
    \begin{sol}
      \leavevmode

      \begin{forest}
        prooftree
        [$\neg Gj$
        [$\neg\neg\forall xGx\checkmark$,ass
        [$\forall xGx$,ass
        [$Gj$,ass [*,ass]]]]]
      \end{forest}
    \end{sol}
  \item Socrates is rational; hence someone is rational.
    \begin{sol}
      \leavevmode

      \begin{forest}
        prooftree
        [$Rs$
        [$\neg\exists xRx\checkmark$,ass
        [$\forall x\neg Rx$,ass
        [$\neg Rs$,ass [*,ass]]]]]
      \end{forest}
    \end{sol}
  \item Some philosophers speak Welsh; all Welsh speakers sing well;
    hence some philosophers sing well.
    \begin{sol}
      \leavevmode

      \begin{forest}
        prooftree
        [$\exists x(Fx\wedge Gx)\checkmark$
        [$\forall x(Gx\supset Sx)$,ass
        [$\neg\exists x(Fx\wedge Sx)\checkmark$,ass
        [$\forall x\neg(Fx\wedge Sx)$,ass
        [$Fa$,ass
        [$Ga$,ass
        [$\neg Ga$ [*,ass]]
        [$Sa$
        [$\neg Ga$ [*,ass]] [$\neg Sa$ [*,ass]]]]]]]]]
      \end{forest}
    \end{sol}
  \item All electrons are leptons; all leptons have half-integral spin; hence
    all electrons have half-integral spin.
    \begin{sol}
      \leavevmode

      \begin{forest}
        prooftree
        [$\forall x(Ex\supset Lx)$
        [$\forall x(Lx\supset Hx)$,ass
        [$\neg\forall x(Ex\supset Hx)\checkmark$,ass
        [$\exists x\neg(Ex\supset Hx)\checkmark$,ass
        [$Ea$,ass
        [$\neg Ha$,ass
        [$\neg Ea$ [*,ass]]
        [$La$
        [$\neg La$ [*,ass]] [$Ha$ [*,ass]]]]]]]]]
      \end{forest}
    \end{sol}
  \item All logicians are philosophers; all philosophers are rational people;
    no rational person is a flat-earther; hence no logician is a flat-earther.
    \begin{sol}
      \leavevmode

      \begin{forest}
        prooftree
        [$\forall x(Lx\supset Fx)$
        [$\forall x(Fx\supset Rx)$,ass
        [$\forall x(Rx\supset\neg Ex)$,ass
        [$\neg\neg\exists x(Lx\wedge Ex)\checkmark$,ass
        [$\exists x(Lx\wedge Ex)\checkmark$,ass
        [$La$,ass
        [$Ea$,ass
        [$\neg La$ [*,ass]] [$Fa$
        [$\neg Fa$ [*,ass]] [$Ra$
        [$\neg Ra$ [*,ass]] [$\neg Ea$ [*,ass]]]]]]]]]]]
      \end{forest}
    \end{sol}
  \item If Jones is a bad philosopher, then some Welsh speaker is irrational;
    but every Welsh speaker is rational; hence Jones is not a bad philosopher.
    \begin{sol}
      \leavevmode

      \begin{forest}
        prooftree
        [$Bj\supset\exists x(Gx\wedge\neg Rx)\checkmark$
        [$\forall x(Gx\supset Rx)$,ass
        [$\neg\neg Bj\checkmark$,ass
        [$Bj$,ass
        [$\neg Bj$ [*,ass]] [$\exists x(Gx\wedge\neg Rx)\checkmark$
        [$Gj$,ass
        [$\neg Rj$,ass
        [$\neg Gj$ [*,ass]] [$Rj$ [*,ass]]]]]]]]]
      \end{forest}
    \end{sol}
  \end{enumerate}
\end{enumerate}
\end{document}

答案1

我不知道这种布局是否适合您的要求。它允许在解决方案之前分页,但不允许在解决方案内分页。布局也稍微紧凑一些。

调整后的树木

\documentclass[12pt]{article}
\usepackage{geometry}
\usepackage{microtype}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{enumitem}
\setlist[enumerate,1]{label=\bfseries\Alph*,align=left,leftmargin=*, labelsep=1.5em}
\setlist[enumerate,2]{label=\arabic*.,labelindent=1em,labelsep=1.5em, leftmargin=*}

\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsthm}
\theoremstyle{definition}
\newtheorem*{sol}{Solution}

\usepackage{forest}
\forestset{
  ass/.append style={
    before computing xy={l=\baselineskip},
    no edge
  },
  prooftree/.style={
    for tree={
      child anchor=north,
      parent anchor=south
    }
  },
  default preamble={
    prooftree,
    for root={baseline},
    for tree={%
      if n children=1{for children={ass}}{},
      math content
    }
  },
}

\begin{document}
\subsection*{Exercises 25}
\begin{enumerate}
  \item Show the following simple arguments are valid by translating into QL and
  using trees.
  \begin{enumerate}
    \item Everyone is rational; hence Socrates is rational.
    \begin{sol}
      \begin{forest}
        [\forall xRx
        [\neg Rs
        [Rs
        [*]]]]
      \end{forest}
    \end{sol}
    \item No one loves Angharad; hence Caradoc doesn’t love Angharad.
    \begin{sol}
      \begin{forest}
        [\forall x\neg Lxa
        [\neg\neg Lca\checkmark
        [Lca
        [\neg Lca
        [*]]]]]
      \end{forest}
    \end{sol}
    \item No philosopher speaks Welsh; Jones is a philosopher; hence Jones
    does not speak Welsh.
    \begin{sol}
      \begin{forest}
        [\forall x(Fx\supset\neg Gx)
        [Fj
        [\neg\neg Gj\checkmark
        [Gj
        [Fj\supset\neg Gj
        [\neg Fj [*]]
        [\neg Gj [*]]]]]]]
      \end{forest}
    \end{sol}
    \item Jones doesn’t speak Welsh; hence not everyone speaks Welsh.
    \begin{sol}
      \begin{forest}
        [\neg Gj
        [\neg\neg\forall xGx\checkmark
        [\forall xGx
        [Gj [*]]]]]
      \end{forest}
    \end{sol}
    \item Socrates is rational; hence someone is rational.
    \begin{sol}
      \begin{forest}
        [Rs
        [\neg\exists xRx\checkmark
        [\forall x\neg Rx
        [\neg Rs [*]]]]]
      \end{forest}
    \end{sol}
    \item Some philosophers speak Welsh; all Welsh speakers sing well;
    hence some philosophers sing well.
    \begin{sol}
      \begin{forest}
        [\exists x(Fx\wedge Gx)\checkmark
        [\forall x(Gx\supset Sx)
        [\neg\exists x(Fx\wedge Sx)\checkmark
        [\forall x\neg(Fx\wedge Sx)
        [Fa
        [Ga
        [\neg Ga [*]]
        [Sa
        [\neg Ga [*]] [\neg Sa [*]]]]]]]]]
      \end{forest}
    \end{sol}
    \item All electrons are leptons; all leptons have half-integral spin; hence
    all electrons have half-integral spin.
    \begin{sol}
      \begin{forest}
        [\forall x(Ex\supset Lx)
        [\forall x(Lx\supset Hx)
        [\neg\forall x(Ex\supset Hx)\checkmark
        [\exists x\neg(Ex\supset Hx)\checkmark
        [Ea
        [\neg Ha
        [\neg Ea [*]]
        [La
        [\neg La [*]] [Ha [*]]]]]]]]]
      \end{forest}
    \end{sol}
    \item All logicians are philosophers; all philosophers are rational people;
    no rational person is a flat-earther; hence no logician is a flat-earther.
    \begin{sol}
      \begin{forest}
        [\forall x(Lx\supset Fx)
        [\forall x(Fx\supset Rx)
        [\forall x(Rx\supset\neg Ex)
        [\neg\neg\exists x(Lx\wedge Ex)\checkmark
        [\exists x(Lx\wedge Ex)\checkmark
        [La
        [Ea
        [\neg La [*]] [Fa
        [\neg Fa [*]] [Ra
        [\neg Ra [*]] [\neg Ea [*]]]]]]]]]]]
      \end{forest}
    \end{sol}
    \item If Jones is a bad philosopher, then some Welsh speaker is irrational;
    but every Welsh speaker is rational; hence Jones is not a bad philosopher.
    \begin{sol}
      \begin{forest}
        [Bj\supset\exists x(Gx\wedge\neg Rx)\checkmark
        [\forall x(Gx\supset Rx)
        [\neg\neg Bj\checkmark
        [Bj
        [\neg Bj [*]] [\exists x(Gx\wedge\neg Rx)\checkmark
        [Gj
        [\neg Rj
        [\neg Gj [*]] [Rj [*]]]]]]]]]
      \end{forest}
    \end{sol}
  \end{enumerate}
\end{enumerate}
\end{document}

编辑

如果您希望树显示在单词“解决方案”下方,您可以将其集成到树中。这会自动确保树与单词保持一致。

例如,您可以在中设置以下前言\forestset{}

  default preamble={
    prooftree,
    for root={ass},
    for tree={%
      if n children=1{for children={ass}}{},
      math content
    },
    before typesetting nodes={
      !r.append''=!c,
      !r.delay={
        content=\text{\textbf{Solution.}}
      }
    },
    before packing={
      !rl.append=!r1,
    },
    before drawing tree={
      !r.x/.min={x()}{descendants},
    }
  },

这有点棘手。它涉及复制根节点,用标题“解决方案”替换根的内容。然后将原始树的其余部分附加为复制的根节点的子树。然后,标题垂直对齐到树的左侧。

第一页如下所示:

用诡计解决问题

\documentclass[12pt]{article}
\usepackage{geometry}
\usepackage{microtype}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{enumitem}
\setlist[enumerate,1]{label=\bfseries\Alph*,align=left,leftmargin=*, labelsep=1.5em}
\setlist[enumerate,2]{label=\arabic*.,labelindent=1em,labelsep=1.5em, leftmargin=*}

\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsthm}
\theoremstyle{definition}
\newtheorem*{sol}{Solution}

\usepackage{forest}
\forestset{
  ass/.append style={
    before computing xy={l=\baselineskip},
    no edge
  },
  prooftree/.style={
    for tree={
      child anchor=north,
      parent anchor=south,
    }
  },
  default preamble={
    prooftree,
    for root={ass},
    for tree={%
      if n children=1{for children={ass}}{},
      math content
    },
    before typesetting nodes={
      !r.append''=!c,
      !r.delay={
        content=\text{\textbf{Solution.}}
      }
    },
    before packing={
      !rl.append=!r1,
    },
    before drawing tree={
      !r.x/.min={x()}{descendants},
    }
  },
}

\begin{document}
\subsection*{Exercises 25}
\begin{enumerate}
  \item Show the following simple arguments are valid by translating into QL and using trees.
  \begin{enumerate}
    \item Everyone is rational; hence Socrates is rational.

      \begin{forest}
        [\forall xRx
        [\neg Rs
        [Rs
        [*]]]]
      \end{forest}
    \item No one loves Angharad; hence Caradoc doesn’t love Angharad.

      \begin{forest}
        [\forall x\neg Lxa
        [\neg\neg Lca\checkmark
        [Lca
        [\neg Lca
        [*]]]]]
      \end{forest}
    \item No philosopher speaks Welsh; Jones is a philosopher; hence Jones does not speak Welsh.

      \begin{forest}
        [\forall x(Fx\supset\neg Gx)
        [Fj
        [\neg\neg Gj\checkmark
        [Gj
        [Fj\supset\neg Gj
        [\neg Fj [*]]
        [\neg Gj [*]]]]]]]
      \end{forest}
    \item Jones doesn’t speak Welsh; hence not everyone speaks Welsh.

      \begin{forest}
        [\neg Gj
        [\neg\neg\forall xGx\checkmark
        [\forall xGx
        [Gj [*]]]]]
      \end{forest}
    \item Socrates is rational; hence someone is rational.

      \begin{forest}
        [Rs
        [\neg\exists xRx\checkmark
        [\forall x\neg Rx
        [\neg Rs [*]]]]]
      \end{forest}
    \item Some philosophers speak Welsh; all Welsh speakers sing well; hence some philosophers sing well.

      \begin{forest}
        [\exists x(Fx\wedge Gx)\checkmark
        [\forall x(Gx\supset Sx)
        [\neg\exists x(Fx\wedge Sx)\checkmark
        [\forall x\neg(Fx\wedge Sx)
        [Fa
        [Ga
        [\neg Ga [*]]
        [Sa
        [\neg Ga [*]] [\neg Sa [*]]]]]]]]]
      \end{forest}
    \item All electrons are leptons; all leptons have half-integral spin; hence all electrons have half-integral spin.

      \begin{forest}
        [\forall x(Ex\supset Lx)
        [\forall x(Lx\supset Hx)
        [\neg\forall x(Ex\supset Hx)\checkmark
        [\exists x\neg(Ex\supset Hx)\checkmark
        [Ea
        [\neg Ha
        [\neg Ea [*]]
        [La
        [\neg La [*]] [Ha [*]]]]]]]]]
      \end{forest}
    \item All logicians are philosophers; all philosophers are rational people; no rational person is a flat-earther; hence no logician is a flat-earther.

      \begin{forest}
        [\forall x(Lx\supset Fx)
        [\forall x(Fx\supset Rx)
        [\forall x(Rx\supset\neg Ex)
        [\neg\neg\exists x(Lx\wedge Ex)\checkmark
        [\exists x(Lx\wedge Ex)\checkmark
        [La
        [Ea
        [\neg La [*]] [Fa
        [\neg Fa [*]] [Ra
        [\neg Ra [*]] [\neg Ea [*]]]]]]]]]]]
      \end{forest}
    \item If Jones is a bad philosopher, then some Welsh speaker is irrational; but every Welsh speaker is rational; hence Jones is not a bad philosopher.

      \begin{forest}
        [Bj\supset\exists x(Gx\wedge\neg Rx)\checkmark
        [\forall x(Gx\supset Rx)
        [\neg\neg Bj\checkmark
        [Bj
        [\neg Bj [*]] [\exists x(Gx\wedge\neg Rx)\checkmark
        [Gj
        [\neg Rj
        [\neg Gj [*]] [Rj [*]]]]]]]]]
      \end{forest}
  \end{enumerate}
\end{enumerate}
\end{document}

答案2

您始终可以将整个物品放入 中\parbox[t]{\linewidth}{...}

\documentclass[oneside,12pt]{article}
\usepackage{geometry}
\usepackage{microtype}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\usepackage{enumitem}
\setlist[enumerate,1]{label=\bfseries\Alph*,align=left,leftmargin=*,
  labelsep=1.5em}
\setlist[enumerate,2]{label=\arabic*.,labelindent=1em,labelsep=1.5em,
  leftmargin=*,midpenalty=100000}

\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsthm}
\theoremstyle{definition}
\newtheorem*{sol}{Solution}

\usepackage{forest}
\forestset{
  ass/.append style={
    before computing xy={l=\baselineskip},
    no edge
  },
  prooftree/.style={
    for tree={
      child anchor=north,
      parent anchor=south
    }
  }
}

\begin{document}
\subsection*{Exercises 25}
\begin{enumerate}
\item Show the following simple arguments are valid by translating into QL and
  using trees.
  \begin{enumerate}
  \item Everyone is rational; hence Socrates is rational.
    \begin{sol}
      \leavevmode

      \begin{forest}
        prooftree
        [$\forall xRx$
        [$\neg Rs$,ass
        [$Rs$,ass
        [*,ass]]]]
      \end{forest}
    \end{sol}
  \item No one loves Angharad; hence Caradoc doesn’t love Angharad.
    \begin{sol}
      \leavevmode

      \begin{forest}
        prooftree
        [$\forall x\neg Lxa$
        [$\neg\neg Lca\checkmark$,ass
        [$Lca$,ass
        [$\neg Lca$,ass
        [*,ass]]]]]
      \end{forest}
    \end{sol}
  \item No philosopher speaks Welsh; Jones is a philosopher; hence Jones
    does not speak Welsh.
    \begin{sol}
      \leavevmode

      \begin{forest}
        prooftree
        [$\forall x(Fx\supset\neg Gx)$
        [$Fj$,ass
        [$\neg\neg Gj\checkmark$,ass
        [$Gj$,ass
        [$Fj\supset\neg Gj$,ass
        [$\neg Fj$ [*,ass]]
        [$\neg Gj$ [*,ass]]]]]]]
      \end{forest}
    \end{sol}
  \item\parbox[t]{\linewidth}{Jones doesn’t speak Welsh; hence not everyone speaks Welsh.
    \begin{sol}
      \leavevmode

      \begin{forest}
        prooftree
        [$\neg Gj$
        [$\neg\neg\forall xGx\checkmark$,ass
        [$\forall xGx$,ass
        [$Gj$,ass [*,ass]]]]]
      \end{forest}
    \end{sol}}
  \item Socrates is rational; hence someone is rational.
    \begin{sol}
      \leavevmode

      \begin{forest}
        prooftree
        [$Rs$
        [$\neg\exists xRx\checkmark$,ass
        [$\forall x\neg Rx$,ass
        [$\neg Rs$,ass [*,ass]]]]]
      \end{forest}
    \end{sol}
  \item Some philosophers speak Welsh; all Welsh speakers sing well;
    hence some philosophers sing well.
    \begin{sol}
      \leavevmode

      \begin{forest}
        prooftree
        [$\exists x(Fx\wedge Gx)\checkmark$
        [$\forall x(Gx\supset Sx)$,ass
        [$\neg\exists x(Fx\wedge Sx)\checkmark$,ass
        [$\forall x\neg(Fx\wedge Sx)$,ass
        [$Fa$,ass
        [$Ga$,ass
        [$\neg Ga$ [*,ass]]
        [$Sa$
        [$\neg Ga$ [*,ass]] [$\neg Sa$ [*,ass]]]]]]]]]
      \end{forest}
    \end{sol}
  \item All electrons are leptons; all leptons have half-integral spin; hence
    all electrons have half-integral spin.
    \begin{sol}
      \leavevmode

      \begin{forest}
        prooftree
        [$\forall x(Ex\supset Lx)$
        [$\forall x(Lx\supset Hx)$,ass
        [$\neg\forall x(Ex\supset Hx)\checkmark$,ass
        [$\exists x\neg(Ex\supset Hx)\checkmark$,ass
        [$Ea$,ass
        [$\neg Ha$,ass
        [$\neg Ea$ [*,ass]]
        [$La$
        [$\neg La$ [*,ass]] [$Ha$ [*,ass]]]]]]]]]
      \end{forest}
    \end{sol}
  \item All logicians are philosophers; all philosophers are rational people;
    no rational person is a flat-earther; hence no logician is a flat-earther.
    \begin{sol}
      \leavevmode

      \begin{forest}
        prooftree
        [$\forall x(Lx\supset Fx)$
        [$\forall x(Fx\supset Rx)$,ass
        [$\forall x(Rx\supset\neg Ex)$,ass
        [$\neg\neg\exists x(Lx\wedge Ex)\checkmark$,ass
        [$\exists x(Lx\wedge Ex)\checkmark$,ass
        [$La$,ass
        [$Ea$,ass
        [$\neg La$ [*,ass]] [$Fa$
        [$\neg Fa$ [*,ass]] [$Ra$
        [$\neg Ra$ [*,ass]] [$\neg Ea$ [*,ass]]]]]]]]]]]
      \end{forest}
    \end{sol}
  \item If Jones is a bad philosopher, then some Welsh speaker is irrational;
    but every Welsh speaker is rational; hence Jones is not a bad philosopher.
    \begin{sol}
      \leavevmode

      \begin{forest}
        prooftree
        [$Bj\supset\exists x(Gx\wedge\neg Rx)\checkmark$
        [$\forall x(Gx\supset Rx)$,ass
        [$\neg\neg Bj\checkmark$,ass
        [$Bj$,ass
        [$\neg Bj$ [*,ass]] [$\exists x(Gx\wedge\neg Rx)\checkmark$
        [$Gj$,ass
        [$\neg Rj$,ass
        [$\neg Gj$ [*,ass]] [$Rj$ [*,ass]]]]]]]]]
      \end{forest}
    \end{sol}
  \end{enumerate}
\end{enumerate}
\end{document}

您知道,您可以将一个放在\rule{1pt}{.95\textheight)前面\item

相关内容