使用 enumitem 时在标签和项目之间绘制垂直线

使用 enumitem 时在标签和项目之间绘制垂直线

我正在使用 enumitem 包的描述环境。我想在标签和项目之间画一条长垂直线。例如,结果将是这样的

在此处输入图片描述

本示例使用 tabularx 包绘制,使用时不太方便。代码如下

\documentclass{article}

\usepackage{tabularx}

\newcommand{\prol}{\textsf{PL}}
\newcommand{\fol}{\textsf{FOL}}
\newcommand{\wff}{\textsf{wff}}
\newcommand{\ltrue}{\textsf{T}}
\newcommand{\lfalse}{\textsf{F}}

\begin{document}

\renewcommand{\arraystretch}{1.2}
\begin{tabularx}{\textwidth}{r|X}
Sentence & A sentence (also closed formula or ground formula) in logic refer to a declarative sentence that is either \ltrue{} or \lfalse{}. In \prol{}, 1) an atomic sentence have multiple constants and a single predicate; and 2) a compound sentence is formed by multiple atomic sentences combined by truth-functional connectives. In \fol{}, a sentence is a \wff{} with no free variables. A sentence can be viewed as expressing a proposition, something that must be \ltrue{} or \lfalse{}. The restriction of having no free variables is needed to make sure that sentences can have concrete, fixed truth values. An atomic sentence is a sentence that has two or more logical subjects (constants) and a single predicate.\\

Claim & = Proposition\\

Proposition & A proposition is a particular kind of declarative sentence that affirms or denies a predicate of a subject. A proposition is either \ltrue{} or \lfalse{}.
\end{tabularx}

\end{document}

页面切换时该行必须保持不变。我在用户手册中找不到与此相关的内置函数。

答案1

tikzmark

\documentclass{article}
\usepackage{enumitem}
\usepackage{tikZ}
\usetikzlibrary{tikzmark}

\newcommand{\prol}{\textsf{PL}}
\newcommand{\fol}{\textsf{FOL}}
\newcommand{\wff}{\textsf{wff}}
\newcommand{\ltrue}{\textsf{T}}
\newcommand{\lfalse}{\textsf{F}}

\begin{document}
    \begin{description}[align=right, labelsep=2em, leftmargin=\labelsep]
\item[Sentence] 
    \tikzmarknode{A}{A} sentence (also closed formula or ground formula) in logic refer to a declarative sentence  that is either \ltrue{} or \lfalse{}. In \prol{}, 1) an atomic sentence have multiple  constants and a single predicate; and 2) a compound sentence is formed by multiple atomic  sentences combined by truth-functional connectives. In \fol{}, a sentence is a \wff{} with no free variables. A sentence can be viewed as expressing a proposition, something that must be \ltrue{} or \lfalse{}. The restriction of having no free variables is needed to make sure that sentences can have concrete, fixed truth values. An atomic sentence is a sentence that has two or more logical subjects (constants) and a single predicate.

\item[Claim]
    = Proposition

\item[Proposition]
    A proposition is a particular kind of declarative sentence that affirms or denies a predicate of a subject. A proposition is either \ltrue{} or \tikzmarknode{B}{\lfalse{}}.
\begin{tikzpicture}[overlay,remember picture,
                        ]
\draw[transform canvas={xshift=-1em}] (A.north west) -- (A.west |- B.south);
\end{tikzpicture}
    \end{description}
\end{document}

经过(至少)两次编译后你将获得:

在此处输入图片描述

相关内容