版本unicode-math

版本unicode-math

我想在 latex 中进行非独立登录,而不必安装或定义新命令(因为我正在使用 latexIT 并且无法加载新包)。

目前我使用以下标志来表示独立:

X{\perp\!\!\!\perp}Y

对于不独立于 Y 的 X,我可以使用什么?例如,像这样:在此处输入图片描述

答案1

没有包/命令,这里有一个选项:

在此处输入图片描述

$X \not\!\perp\!\!\!\perp Y$

你最好考虑使用centernot包裹用于否定符号。并且,如果您无法加载新包,请复制所需的代码,如下所示:

在此处输入图片描述

\documentclass{article}

\makeatletter
% Taken from http://ctan.org/pkg/centernot
\newcommand*{\centernot}{%
  \mathpalette\@centernot
}
\def\@centernot#1#2{%
  \mathrel{%
    \rlap{%
      \settowidth\dimen@{$\m@th#1{#2}$}%
      \kern.5\dimen@
      \settowidth\dimen@{$\m@th#1=$}%
      \kern-.5\dimen@
      $\m@th#1\not$%
    }%
    {#2}%
  }%
}
\makeatother

\newcommand{\independent}{\perp\mkern-9.5mu\perp}
\newcommand{\notindependent}{\centernot{\independent}}

\begin{document}

$A \notindependent B^{C \notindependent D^{E \notindependent F}}$

$A \independent B^{C \independent D^{E \independent F}}$

\end{document}

答案2

符号可以用\perp和构成\not。等号的两线之间的距离取独立符号中垂直线之间的距离。

\documentclass{article}

\makeatletter
\newcommand*{\indep}{%
  \mathbin{%
    \mathpalette{\@indep}{}%
  }%
}
\newcommand*{\nindep}{%
  \mathbin{%                   % The final symbol is a binary math operator
    \mathpalette{\@indep}{\not}% \mathpalette helps for the adaptation
                               % of the symbol to the different math styles.
  }%
}
\newcommand*{\@indep}[2]{%
  % #1: math style
  % #2: empty or \not
  \sbox0{$#1\perp\m@th$}%        box 0 contains \perp symbol
  \sbox2{$#1=$}%                 box 2 for the height of =
  \sbox4{$#1\vcenter{}$}%        box 4 for the height of the math axis
  \rlap{\copy0}%                 first \perp
  \dimen@=\dimexpr\ht2-\ht4-.2pt\relax
      % The equals symbol is centered around the math axis.
      % The following equations are used to calculate the
      % right shift of the second \perp:
      % [1] ht(equals) - ht(math_axis) = line_width + 0.5 gap
      % [2] right_shift(second_perp) = line_width + gap
      % The line width is approximated by the default line width of 0.4pt
  \kern\dimen@
  {#2}%
      % {\not} in case of \nindep;
      % the braces convert the relational symbol \not to an ordinary
      % math object without additional horizontal spacing.
  \kern\dimen@
  \copy0 %                       second \perp
} 
\makeatother

\begin{document}
\[ A \indep B \nindep C = D \]
\[ \scriptstyle A \indep B \nindep C = D \]
\[ \scriptscriptstyle A \indep B \nindep C = D\]
\end{document}

结果

版本unicode-math

\not加载包时无法按预期工作unicode-math。以下版本改用斜线(斜率略有不同)。

\documentclass{article}
\usepackage{unicode-math}

\makeatletter
\newcommand*{\indep}{%
  \mathbin{%
    \mathpalette{\@indep}{}%
  }%
}
\newcommand*{\nindep}{%
  \mathbin{%                   % The final symbol is a binary math operator
    %\mathpalette{\@indep}{\not}% \mathpalette helps for the adaptation
    \mathpalette{\@indep}{/}%
                               % of the symbol to the different math styles.
  }%
}
\newcommand*{\@indep}[2]{%
  % #1: math style
  % #2: empty or \not
  \sbox0{$#1\perp\m@th$}%        box 0 contains \perp symbol
  \sbox2{$#1=$}%                 box 2 for the height of =
  \sbox4{$#1\vcenter{}$}%        box 4 for the height of the math axis
  \rlap{\copy0}%                 first \perp
  \dimen@=\dimexpr\ht2-\ht4-.2pt\relax
      % The equals symbol is centered around the math axis.
      % The following equations are used to calculate the
      % right shift of the second \perp:
      % [1] ht(equals) - ht(math_axis) = line_width + 0.5 gap
      % [2] right_shift(second_perp) = line_width + gap
      % The line width is approximated by the default line width of 0.4pt
  \kern\dimen@
  \ifx\\#2\\%
  \else
    \hbox to \wd2{\hss$#1#2\m@th$\hss}%
    \kern-\wd2 %
  \fi
  \kern\dimen@
  \copy0 %                       second \perp
}
\makeatother

\begin{document}
\[ A \indep B \nindep C = D \]
\[ \scriptstyle A \indep B \nindep C = D \]
\[ \scriptscriptstyle A \indep B \nindep C = D\]
\end{document}

结果 unicode-math

相关内容