我在环境的帮助下创建了一棵树cases
。 MWE 是这样的:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage{amsmath}
\begin{document}
\tiny
\hyphenpenalty10000%
\[
\begin{cases}
\parbox{1.5cm}{Doctrina de\\ los elementos}
\begin{cases}
\parbox{1.5cm}{Estética\\ trascendental}\\
\parbox{1.5cm}{Lógica\\ trascendental}
\begin{cases}
\parbox{1.5cm}{Analítica\\ trascendental}
\begin{cases}
\begin{minipage}{6em}
Analítica de los conceptos\\[2pt]
Analítica de los principios
\end{minipage}
\end{cases}\\
\parbox{1.5cm}{Dialéctica\\ trascendental}
\begin{cases}
\parbox{1.5cm}{Conceptos de\\ la razón pura}\\[6pt]
\parbox{1.5cm}{Inferencias\\ dialécticas de\\ la razón pura}
\begin{cases}
\begin{minipage}{6em}\raggedright
Paralogismos de la razón pura\\[3pt]
Antinomia de la razón\\
Ideal de la razón pura
\end{minipage}
\end{cases}
\end{cases}
\end{cases}
\end{cases}
\vspace*{12pt}\\
\parbox{1.5cm}{Doctrina\\ del método}
\begin{cases}
\begin{minipage}{6em}\raggedright
Disciplina\\[2pt]
Canon\\[2pt]
Arquitectónica\\[2pt]
Historia de la razón pura
\end{minipage}
\end{cases}
\end{cases}
\]
\end{document}
结果是这样的:
但是,我对结果不太满意。例如,在倒数第二个“列”中,第一个括号与第二个括号太近了。还请注意代码\\[2pt]
,强制调整间距。
我想知道是否有更好的方法来设置这棵树。(我尝试了一些 TikZ,但没有效果。)
答案1
正如我在评论中所建议的那样,在这里使用我的答案,多个括号或圆括号内有文本,可以消除 OP 注意到的挤压组。此外,它允许项目标记以及可变列宽定义,因此无需手动换行(尽管在这里,所有列都固定在 0.6 英寸)。
已编辑,以两种方式改进该答案:
我已经加载
amsmath
以纠正缩放括号宽度问题。重新编辑,因为即使使用amsmath
,也会出现问题,即 的宽度\left\{
会随着相关元素的高度而变化,从而导致错位。我引入了 ,\def\fudgeheight{3}
用于修改\skipcol
幻影 的高度\left\{
。希望它可以保持不变,保持该值不变。由于任何给定列中的项目标记应相同才能实现适当的间距,因此我允许一次为整个列定义项目标记,而不是要求为每个
\BL
项目指定它们。仍然可以使用可选参数覆盖默认值。
这是 MWE。
\documentclass{article}
\usepackage{amsmath}% FIXES WIDTH OF \left\{
\newcounter{levelcount}
\def\levelwidth {.6in}%NOT USED HERE, WITHOUT LEADING TEXT
\def\levelwidthi {.6in}
\def\levelwidthii {.6in}
\def\levelwidthiii{.6in}
\def\levelwidthiv {.6in}
\def\levelwidthv {.6in}
\def\levelmarki {$\dag$}
\def\levelmarkii {$-$}
\def\levelmarkiii{$+$}
\def\levelmarkiv {$\bullet$}
\def\levelmarkv {*}
\def\fudgeheight{3}
\newcommand\BL[2][\csname levelmark\romannumeral\thelevelcount\endcsname]{#1\,\parbox[t]{%
\csname levelwidth\romannumeral\thelevelcount\endcsname}{\raggedright#2}}
\def\level#1{\stepcounter{levelcount}%
\unskip$\left\{\vcenter{\hbox{\shortstack{#1}}}\right.$%
\addtocounter{levelcount}{-1}\ignorespaces}
\newcommand\skipcol[2][\relax]{%
\ifx\relax#1\skipcolhelp{\csname levelmark\romannumeral#2\endcsname}%
\else\skipcolhelp{#1}\fi}
\newcommand\skipcolhelp[1]{%
\smash{\phantom{\level{\BL[#1]{\rule{1pt}{\fudgeheight\baselineskip}}}}}}
\begin{document}
\scriptsize
\level{
\BL{Doctrina de los elementos}
\level{
\BL{Estetica trascendental}\skipcol{3}\skipcol{4}\skipcol{5}\cr
\BL{Logica trascendental}
\level{
\BL{Analitica trascendental}
\level{
\BL{Analitica de los conceptos}\cr
\BL{Analitica de los principios}\cr
}\skipcol{5}\cr
\BL{Dialectica trascendental}
\level{\cr
\BL{Conceptos de la razon pura}\skipcol{5}\cr
\BL{Inferencias dialecticas de la rason pura}
\level{
\BL{Paralogismos de la razon pura}\cr
\BL{Antinomia de la razon}\cr
\BL{Ideal de la razon pura}
}
}
}
}
\cr
\BL{Doctrina del metodo}
\level{
\BL{Disciplina}\cr
\BL{Architecture}\cr
\BL{History de la razon pura}
}\skipcol{3}\skipcol{4}\skipcol{5}
}
\end{document}
OP 更喜欢没有项目标记的答案。这很容易通过设置来实现
\def\levelmarki {}
\def\levelmarkii {}
\def\levelmarkiii{}
\def\levelmarkiv {}
\def\levelmarkv {}
在序言中。但是,如果没有标记提供的视觉提示,人们可能希望在项目之间添加一些额外的垂直分隔。这可以通过在项目之间\cr
添加额外的一个或两个来实现\BL
,如下面的 MWE 所示。
\documentclass{article}
\usepackage{amsmath}% FIXES WIDTH OF \left\{
\newcounter{levelcount}
\def\levelwidth {.6in}%NOT USED HERE, WITHOUT LEADING TEXT
\def\levelwidthi {.6in}
\def\levelwidthii {.6in}
\def\levelwidthiii{.6in}
\def\levelwidthiv {.6in}
\def\levelwidthv {.6in}
\def\levelmarki {}
\def\levelmarkii {}
\def\levelmarkiii{}
\def\levelmarkiv {}
\def\levelmarkv {}
\def\fudgeheight{3}
\newcommand\BL[2][\csname levelmark\romannumeral\thelevelcount\endcsname]{#1\,\parbox[t]{%
\csname levelwidth\romannumeral\thelevelcount\endcsname}{\raggedright#2}}
\def\level#1{\stepcounter{levelcount}%
\unskip$\left\{\vcenter{\hbox{\shortstack{#1}}}\right.$%
\addtocounter{levelcount}{-1}\ignorespaces}
\newcommand\skipcol[2][\relax]{%
\ifx\relax#1\skipcolhelp{\csname levelmark\romannumeral#2\endcsname}%
\else\skipcolhelp{#1}\fi}
\newcommand\skipcolhelp[1]{%
\smash{\phantom{\level{\BL[#1]{\rule{1pt}{\fudgeheight\baselineskip}}}}}}
\begin{document}
\scriptsize
\level{
\BL{Doctrina de los elementos}
\level{
\BL{Estetica trascendental}\skipcol{3}\skipcol{4}\skipcol{5}\cr
\BL{Logica trascendental}
\level{
\BL{Analitica trascendental}
\level{
\BL{Analitica de los conceptos}\cr\cr
\BL{Analitica de los principios}\cr\cr
}\skipcol{5}\cr
\BL{Dialectica trascendental}
\level{\cr
\BL{Conceptos de la razon pura}\skipcol{5}\cr
\BL{Inferencias dialecticas de la rason pura}
\level{
\BL{Paralogismos de la razon pura}\cr\cr
\BL{Antinomia de la razon}\cr\cr
\BL{Ideal de la razon pura}
}
}
}
}
\cr
\BL{Doctrina del metodo}
\level{
\BL{Disciplina}\cr\cr\cr
\BL{Architecture}\cr\cr\cr
\BL{History de la razon pura}
}\skipcol{3}\skipcol{4}\skipcol{5}
}
\end{document}
答案2
Schemata 是一个用于绘制图型的包。它定义了一系列宏,以方便绘制和调整此类图表。
最简单的使用方法是按照手册操作。首先仅使用\schema
和创建一个基本图式\schemabox
。然后根据需要从右向左进行调整,\smallskip
在右侧叶子之间添加一个左右。然后根据需要更改\schema
为\Schema
,始终从右向左进行操作以避免需要重新进行调整。手册比我在这里做的解释要好得多。
这是根据您的 MWE 得出的最终结果的粗略第一遍版本。
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage{amssymb}
\usepackage{schemata}
\begin{document}
\Schema{4.5ex}{19ex}{%
}{%
\Schema{-16.75ex}{9.25ex}{%
\schemabox{Doctrina de\\los elementos}
}{%
\schemabox{%
Estética\\trascendental
}%
\Schema{-8ex}{9ex}{%
\schemabox{Lógica\\trascendental}
}{%
\schema{%
\schemabox{Analítica\\ trascendental}
}{%
\schemabox{%
Analítica de\\los conceptos
}\smallskip
\schemabox{%
Analítica de\\los principios
}
}\smallskip
\Schema{-5.5ex}{7.5ex}{% change this \schema to \Schema first
\schemabox{%
Dialéctica\\
trascendental
}%
}{%
\schemabox{%
Conceptos de\\
la razón pura
}\smallskip
\schema{%
\schemabox{%
Inferencias\\
dialécticas de\\
la razón pura\\
}%
}{%
\schemabox{%
\schemabox{%
Paralogismos\\
de la razón\\
pura
}\smallskip\\
\schemabox{%
Antinomia\\
de la razón\\
Ideal de la\\
razón pura
}%
}%
}
}%
}%
}\smallskip
\schema{%
\schemabox{Doctrina\\del método}
}{%
\schemabox{%
Disciplina\\
Canon\\
Arquitectónica\\
Historia de la razón pura
}
}
}
\end{document}
答案3
我无法提供灵活的解决方案,但可以提供两种不同的解决方案。第一种创建的内容类似于您原来的 MWE,但间距更好。我将所有内容放在 minipages 中以保持一致,您可能需要更改它:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage{amsmath}
\begin{document}
\tiny
\hyphenpenalty10000%
\[
\left\{
\begin{aligned}
&\begin{minipage}{1.5cm}\raggedright{Doctrina de\\ los elementos}\end{minipage}
\left\{
\begin{aligned}
&\begin{minipage}{1.5cm}\raggedright{Estética\\ trascendental}\end{minipage}
\\
&\begin{minipage}{1.5cm}\raggedright{Lógica\\ trascendental}\end{minipage}
\left\{
\begin{aligned}
&\begin{minipage}{1.5cm}\raggedright{Analítica\\ trascendental}\end{minipage}
\left\{
\begin{aligned}
&\begin{minipage}{1.5cm}\raggedright{Analítica de\\ los conceptos}\end{minipage}
\\
&\begin{minipage}{1.5cm}\raggedright{Analítica de\\ los principos}\end{minipage}
\end{aligned}
\right.
\\
&\begin{minipage}{1.5cm}\raggedright{Dialéctica\\ trascendental}\end{minipage}
\left\{
\begin{aligned}
&\begin{minipage}{1.5cm}\raggedright{Conceptos de\\ la razón pura}\end{minipage}
\\
&\begin{minipage}{1.5cm}\raggedright{Inferencias\\ dialécticas de\\ la razón pura}\end{minipage}
\left\{
\begin{aligned}
&\begin{minipage}{1.5cm}\raggedright{Paralogismos\\ de la razón\\ pura}\end{minipage}
\\
&\begin{minipage}{1.5cm}\raggedright{Antinomia de la razón}\end{minipage}
\\
&\begin{minipage}{1.5cm}\raggedright{Ideal de la razón pura}\end{minipage}
\end{aligned}
\right.
\end{aligned}
\right.
\end{aligned}
\right.
\end{aligned}
\right.
\\
&\begin{minipage}{1.5cm}\raggedright{Doctrina\\ del método}\end{minipage}
\smash[b]{\left\{
\begin{aligned}
&\begin{minipage}{1.5cm}\raggedright{Disciplina}\end{minipage}
\\
&\begin{minipage}{1.5cm}\raggedright{Canon}\end{minipage}
\\
&\begin{minipage}{1.5cm}\raggedright{Arquitectónica}\end{minipage}
\\
&\begin{minipage}{1.5cm}\raggedright{Historia de la\\ razón pura}\end{minipage}
\end{aligned}
\right.}
\end{aligned}
\right.
\]
第二种更符合我的个人品味,但它也有自己的问题。它适用于此示例,但当相反的分支重叠时就会出现问题,因此这不是一个可以推广的事情:
\[
\left\{
\begin{aligned}
&\begin{minipage}{1.5cm}\raggedright{Doctrina de\\ los elementos}\end{minipage}
\smash[t]{\left\{
\begin{aligned}
&\begin{minipage}{1.5cm}\raggedright{Estética\\ trascendental}\end{minipage}
\\
&\begin{minipage}{1.5cm}\raggedright{Lógica\\ trascendental}\end{minipage}
\smash[b]{\left\{
\begin{aligned}
&\begin{minipage}{1.5cm}\raggedright{Analítica\\ trascendental}\end{minipage}
\smash[t]{\left\{
\begin{aligned}
&\begin{minipage}{1.5cm}\raggedright{Analítica de\\ los conceptos}\end{minipage}
\\
&\begin{minipage}{1.5cm}\raggedright{Analítica de\\ los principos}\end{minipage}
\end{aligned}
\right.}
\\
&\begin{minipage}{1.5cm}\raggedright{Dialéctica\\ trascendental}\end{minipage}
\smash[b]{\left\{
\begin{aligned}
&\begin{minipage}{1.5cm}\raggedright{Conceptos de\\ la razón pura}\end{minipage}
\\
&\begin{minipage}{1.5cm}\raggedright{Inferencias\\ dialécticas de\\ la razón pura}\end{minipage}
\smash[b]{\left\{
\begin{aligned}
&\begin{minipage}{1.5cm}\raggedright{Paralogismos\\ de la razón\\ pura}\end{minipage}
\\
&\begin{minipage}{1.5cm}\raggedright{Antinomia de la razón}\end{minipage}
\\
&\begin{minipage}{1.5cm}\raggedright{Ideal de la razón pura}\end{minipage}
\end{aligned}
\right.}
\end{aligned}
\right.}
\end{aligned}
\right.}
\end{aligned}
\right.}
\\
&\begin{minipage}{1.5cm}\raggedright{Doctrina\\ del método}\end{minipage}
\smash[b]{\left\{
\begin{aligned}
&\begin{minipage}{1.5cm}\raggedright{Disciplina}\end{minipage}
\\
&\begin{minipage}{1.5cm}\raggedright{Canon}\end{minipage}
\\
&\begin{minipage}{1.5cm}\raggedright{Arquitectónica}\end{minipage}
\\
&\begin{minipage}{1.5cm}\raggedright{Historia de la\\ razón pura}\end{minipage}
\end{aligned}
\right.}
\end{aligned}
\right.
\]
\end{document}
答案4
使用TikZ
,这将是另一个选择(以下这个答案):
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning,decorations.pathreplacing}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\begin{document}
\begin{tikzpicture}
\hyphenpenalty10000
\node (main) {};
\begin{scope}[node distance=1em, text width=4em, align=left]
\node [right=of main, yshift=6em] (a1) {Doctrina de los elementos};
\node [right=of main, yshift=-6em] (a2) {Doctrina del método};
\end{scope}
\draw[decorate,decoration={brace, mirror}] (a1.north west) -- (a2.south west);
\begin{scope}[node distance=1em, text width=6em, align=left]
\node [right=of a1, yshift= 2em] (b1) {Estética trascendental};
\node [right=of a1, yshift= -2em] (b2) {Lógica trascendental};
\end{scope}
\draw[decorate,decoration={brace,mirror}] (b1.north west) -- (b2.south west);
\begin{scope}[node distance=1em, text width=2cm, align=left]
\node [right=of b2, yshift= 6em] (c1) {Analítica trascendental};
\node [right=of b2, yshift= -6em] (c2) {Dialéctica trascendental};
\end{scope}
\draw[decorate,decoration={brace,mirror}] (c1.north west) -- (c2.south west);
\begin{scope}[node distance=1em, text width=2cm, align=left]
\node [right=of c1, yshift= 3em] (d1) {Analítica de los conceptos};
\node [right=of c1, yshift= -3em] (d2) {Analítica de los principios};
\end{scope}
\draw[decorate,decoration={brace,mirror}] (d1.north west) -- (d2.south west);
\begin{scope}[node distance=1em, text width=5em, align=left]
\node [right=of c2, yshift= 3em] (d3) {Conceptos de la razón pura};
\node [right=of c2, yshift= -3em] (d4) {Inferencias dialécticas de la razón pura};
\end{scope}
\draw[decorate,decoration={brace,mirror}] (d3.north west) -- (d4.south west);
\begin{scope}[node distance=1em, text width=2cm, align=left]
\node [right=of d4, yshift= 4em] (e1) {Paralogismos de la razón pura};
\node [right=of d4] (e2) {Antinomia de la razón};
\node [right=of d4, yshift= -4em] (e3) {Ideal de la razón pura};
\end{scope}
\draw[decorate,decoration={brace,mirror}] (e1.north west) -- (e3.south west);
\begin{scope}[node distance=1em, text width=2cm, align=left]
\node [right=of a2, yshift= 4em] (b3) {Disciplina};
\node [right=of a2, yshift= 2em] (b4) {Canon};
\node [right=of a2, yshift= 0em] (b5) {Arquitectónica};
\node [right=of a2, yshift= -3em] (b6) {Historia de la razón pura};
\end{scope}
\draw[decorate,decoration={brace,mirror}] (b3.north west) -- (b6.south west);
\end{tikzpicture}
\end{document}