更新(2019 年 12 月 12 日)

更新(2019 年 12 月 12 日)

我不确定这是一个乳胶问题还是数学符号问题。

我正在尝试定义一组集合,

B = {T_f = {t | t 属于 T_f 的条件} | t_f 属于 B 的条件}

这是正确的符号吗?读起来很混乱 - 有更好的方法吗?我目前使用的 latex 看起来像这样

${B = \{T_f = \{t | t \text{ condition of t in T_f}\} | \text{ condition of T_f in B } b\}}$ 

答案1

以下是我的建议:

  • 使用\Set\SET命令,这样您就不会忘记括号,并且格式一致。两者都采用两个参数,其中\Set在数学模式和\SET文本模式下排版第二个参数。

  • 将定义拆分为两行。它将要T_f一旦插入了适当的条件,阅读起来就会变得困难。在 的定义中定义 尤其令人困惑B

  • B口头解释和的含义T_f

这是一个赋予幻想意义的例子。

\documentclass{article}
\usepackage{mathtools}
\newcommand\Set[2]{\{\,#1\mid#2\,\}}
\newcommand\SET[2]{\Set{#1}{\text{#2}}}
\begin{document}
\noindent
The boundary, $B$, is the collection of trust sets for all green functions:
\begin{align*}
B  &\coloneqq \Set{T_f}{\operatorname{color}(f)=\operatorname{green}}\\
\intertext{where}
T_f&\coloneqq \SET{t}{$t$ satisfies some condition depending on $f$}
\end{align*}
is the set of trustworthy points of function~$f$.
\end{document}

在此处输入图片描述

答案2

与@gernot 的想法相同,但遵循包手册第 3.6 节中给出的指导原则mathtools

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{mathtools}
\usepackage{amssymb} % only because one of the examples uses "\mathbb"

% The portion between "\makeatletter" and "\makeatoyher" defines the abstract 
% command "\Set", together with some other ancillary commands (cf. the manual 
% of the `mathtools' package, p. 27).
\makeatletter

\newcommand*\SetSuchThat{\@ifstar\@SetSuchThat@star\@SetSuchThat@nostar}
\newcommand*\@SetSuchThat@star{%
    \mathrel{}%
    % \nobreak % superfluous inside "\left... ... \right..."
    \middle\vert
    \mathrel{}%
}
\newcommand*\@SetSuchThat@nostar[1][]{%
    \mathrel{#1\vert}%
}
\newcommand*\@SetSuchThat{}
\DeclarePairedDelimiterX \Set [2] {\lbrace}{\rbrace}
    {\nonscript\,#1\@SetSuchThat #2\nonscript\,}
\reDeclarePairedDelimiterInnerWrapper \Set {star} {%
    \mathopen{}%
    \mathclose\bgroup
    \def\@SetSuchThat{\SetSuchThat*}%
    #1#2\aftergroup\egroup #3
}
\reDeclarePairedDelimiterInnerWrapper \Set {nostar} {%
    \begingroup
        \def\@SetSuchThat{\SetSuchThat[\delimsize]}%
        \mathopen{#1}#2\mathclose{#3}%
    \endgroup
}

\makeatother



\begin{document}

Let us define:
\begin{equation}
    B = \Set % three arguments, the first is optional
            [\Big] % size specification for the delimiters
            {% typical set element; we nest onther "\Set" here
                T_{\!f} = \Set
                    % no optional argument: use ordinary-size delimiters
                    {t} % typical set element...
                    {\text{condition of $t$ in $T_{\!f}$}} % ...and its description
            }
            {\text{condition of $T_{\!f}$ in $B$}} % description for outer set
\end{equation}
In a in-line formula, though, I'd use smaller delimiters (\verb|\big| instead of
\verb|\Big|) for the outer set:
\(
    B = \Set % three arguments, the first is optional
            [\big] % size specification for the delimiters
            {% typical set element; we nest onther "\Set" here
                T_{\!f} = \Set
                    % no optional argument: use ordinary-size delimiters
                    {t} % typical set element...
                    {\text{condition of $t$ in $T_{\!f}$}} % ...and its description
            }
            {\text{condition of $T_{\!f}$ in $B$}} % description for outer set
\).
As you can see, however, the output is awful in any case!~(;-)

You can also replace the optional argument of the \verb|\Set| command with a
star~(\texttt{*}) for auto-sizing delimiters (that is,
\verb|\left\{|\,\ldots\verb+\middle|+\,\ldots\verb|\right\}|).  Example:
\begin{equation}
    A = \Set*
        {\frac{n}{n+1}}
        {n\in\mathbb{N}}
\end{equation}

\end{document}

看到输出后

代码输出

您应该更好地理解@gernot 的第二个建议的价值,即将定义分成两个独立的部分!:-)

笔记:就我个人而言,我坚持喜欢这样的符号

\Set{x}{\text{condition on $x$}}

超过

\Set{x \given \text{condition on $x$}}

\given按照软件包手册的建议,对命令进行适当的定义mathtools(换句话说,我更喜欢对集合的典型元素和定义条件使用两个单独的参数)。其他人不同意。


更新(2019 年 12 月 12 日)

正如所指出的一条评论,自发布此答案以来,该mathtools软件包已被修改,因此上面显示的代码不再有效。对于该软件包的最新版本,应改用以下代码:

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{mathtools}
\usepackage{amssymb} % only because one of the examples uses "\mathbb"

% The portion between "\makeatletter" and "\makeatoyher" defines the abstract 
% command "\Set", together with some other ancillary commands (cf. the manual 
% of the `mathtools' package, p. 27).
\makeatletter

\newcommand*\SetSuchThat{\@ifstar\@SetSuchThat@star\@SetSuchThat@nostar}
\newcommand*\@SetSuchThat@star{%
    \mathrel{}%
    % \nobreak % superfluous inside "\left... ... \right..."
    \middle\vert
    \mathrel{}%
}
\newcommand*\@SetSuchThat@nostar[1][]{%
    \mathrel{#1\vert}%
}
\newcommand*\@SetSuchThat{}
\DeclarePairedDelimiterX \Set [2] {\lbrace}{\rbrace}
    {\nonscript\,#1\@SetSuchThat #2\nonscript\,}
\reDeclarePairedDelimiterInnerWrapper \Set {star} {%
    \mathopen{}%
    \mathclose\bgroup
    \def\@SetSuchThat{\SetSuchThat*}%
    #1#2\aftergroup\egroup #3
}
\reDeclarePairedDelimiterInnerWrapper \Set {nostarnonscaled} {%
    \begingroup
        \def\@SetSuchThat{\SetSuchThat[\delimsize]}%
        \mathopen#1#2\mathclose#3%
    \endgroup
}
\reDeclarePairedDelimiterInnerWrapper \Set {nostarscaled} {%
    \begingroup
        \def\@SetSuchThat{\SetSuchThat[\delimsize]}%
        \mathopen{#1}#2\mathclose{#3}%
    \endgroup
}

\makeatother



\begin{document}

Let us define:
\begin{equation}
    B = \Set % three arguments, the first is optional
            [\Big] % size specification for the delimiters
            {% typical set element; we nest onther "\Set" here
                T_{\!f} = \Set
                    % no optional argument: use ordinary-size delimiters
                    {t} % typical set element...
                    {\text{condition of $t$ in $T_{\!f}$}} % ...and its description
            }
            {\text{condition of $T_{\!f}$ in $B$}} % description for outer set
\end{equation}
In a in-line formula, though, I'd use smaller delimiters (\verb|\big| instead of
\verb|\Big|) for the outer set:
\(
    B = \Set % three arguments, the first is optional
            [\big] % size specification for the delimiters
            {% typical set element; we nest onther "\Set" here
                T_{\!f} = \Set
                    % no optional argument: use ordinary-size delimiters
                    {t} % typical set element...
                    {\text{condition of $t$ in $T_{\!f}$}} % ...and its description
            }
            {\text{condition of $T_{\!f}$ in $B$}} % description for outer set
\).
As you can see, however, the output is awful in any case!~(;-)

You can also replace the optional argument of the \verb|\Set| command with a
star~(\texttt{*}) for auto-sizing delimiters (that is,
\verb|\left\{|\,\ldots\verb+\middle|+\,\ldots\verb|\right\}|).  Example:
\begin{equation}
    A = \Set*
        {\frac{n}{n+1}}
        {n\in\mathbb{N}}
\end{equation}

\end{document}

输出完全相同:

第二个(更新后的)代码示例的输出

相关内容