수직 막대가 있는 합계 기호를 만드는 방법은 무엇입니까?

수직 막대가 있는 합계 기호를 만드는 방법은 무엇입니까?

이 기호를 만들려고 합니다.여기에 이미지 설명을 입력하세요

나는 이것을 사용하려고했습니다 :

\documentclass{article}
\usepackage{mathtools}

\makeatletter
\newcommand{\superimpose}[2]{%
  {\ooalign{$#1\@firstoftwo#2$\cr\hfil$#1\@secondoftwo#2$\hfil\cr}}}
\makeatother
\newcommand{\MyTry}{\mathpalette\superimpose{{\sum}{\vert}}}

\begin{document}
 $\MyTry$
\end{document}

하지만 올바른 방식으로 수행되지 않으며 구분 기호를 어떻게 사용하는지 잘 모르겠습니다. 감사해요.

답변1

\ooalign여기에는 와 모드 가 혼합되어 있습니다 picture.

\documentclass{article}
\usepackage{amsmath,pict2e}

\makeatletter
\newcommand{\barredsum}{%
  \DOTSB\mathop{\mathpalette\@barredsum\relax}\slimits@
}
\newcommand{\@barredsum}[2]{%
  \begingroup
  \sbox\z@{$#1\sum$}%
  \setlength{\unitlength}{\dimexpr2pt+\ht\z@+\dp\z@\relax}%
  \@barredsumthickness{#1}%
  \vphantom{\@barredsumbar}%
  \ooalign{$\m@th#1\sum$\cr\hidewidth$#1\@barredsumbar$\hidewidth\cr}%
  \endgroup
}
\newcommand{\@barredsumbar}{%
  \vcenter{\hbox{\begin{picture}(0,1)\roundcap\Line(0,0)(0,1)\end{picture}}}%
}
\newcommand{\@barredsumthickness}[1]{% see https://tex.stackexchange.com/a/477200/
  \linethickness{%
    1.25\fontdimen8
      \ifx#1\displaystyle\textfont\else
      \ifx#1\textstyle\textfont\else
      \ifx#1\scriptstyle\scriptfont\else
      \scriptscriptfont\fi\fi\fi 3
  }%
}
\makeatother

\begin{document}

\[
\barredsum_{i=1}^N x_i
\]

\begin{center}
$\barredsum_{i=1}^N x_{\barredsum_{i=1}^N x_{\barredsum_{i=1}^N x_i}}$
\end{center}

\end{document}

여기에 이미지 설명을 입력하세요

오버슈트가 가변적이고 기호의 수직 범위가 다음과 같은 경우 개선이 가능합니다 \sum.

\documentclass{article}
\usepackage{amsmath,pict2e,picture}

\makeatletter
\newcommand{\barredsum}{%
  \DOTSB\mathop{\mathpalette\@barredsum\relax}\slimits@
}
\newcommand{\@barredsum}[2]{%
  \begingroup
  \sbox\z@{$#1\sum$}%
  \setlength{\unitlength}{%
    \dimexpr
      \ifx#1\displaystyle1\else3\fi\dimexpr\@barredsumthickness{#1}\relax+
      \ht\z@+\dp\z@
    \relax
  }%
  \linethickness{\@barredsumthickness{#1}}%
  \vphantom{\sum}%
  \smash{\ooalign{$\m@th#1\sum$\cr\hidewidth$#1\@barredsumbar$\hidewidth\cr}}%
  \endgroup
}
\newcommand{\@barredsumbar}{%
  \vcenter{\hbox{\begin{picture}(0,1)\roundcap\Line(0,0)(0,1)\end{picture}}}%
}
\newcommand{\@barredsumthickness}[1]{% see https://tex.stackexchange.com/a/477200/
  1.25\fontdimen8
    \ifx#1\displaystyle\textfont\else
    \ifx#1\textstyle\textfont\else
    \ifx#1\scriptstyle\scriptfont\else
    \scriptscriptfont\fi\fi\fi 3
}
\makeatother

\begin{document}

\[
\sum_{i=1}^N x_i \ne \barredsum_{i=1}^N x_i
\]

\begin{center}
$\barredsum_{i=1}^N x_{\barredsum_{i=1}^N x_{\barredsum_{i=1}^N x_i}}$
\end{center}

\end{document}

여기에 이미지 설명을 입력하세요

답변2

egreg의 답변 중 하나를 개선하려고 노력하는 것은 동시에 즐겁고 유익한 활동이며 자랑할 권리도 제공할 수 있습니다. (;-) 이 경우 승인된 솔루션은 다음 두 가지 이유로 효율성 측면에서 차선책이라고 생각합니다.

  1. 그리는 동안,예를 들어, 마녀는 picture환경의 완전한 유연성이 필요합니다. 이 유연성은 단순한 선을 그리는 데 필요하지 않습니다.

  2. 솔루션은 중첩 노드에 해당하는 \vphantominside 를 사용하며 , 각각의 16개 결과 조합에는 환경이 포함됩니다.\mathpalette\mathchoicepicture

특히 이는 \@barredsumbar명령을 호출할 때마다 매크로가 20번 실행된다는 의미입니다 \barredsum. 나처럼 LaTeX가 논문을 작성하는 데 30분 이상이 걸렸던 영웅 시대를 목격한 사람들은 특히 이 주장에 민감합니다.

다음 코드는 \@rodriguez@overprint@bar각 호출에 대해 매크로를 4번만 실행하고 \barredsum선을 그리는 데 TeX의 기본 규칙 명령에만 의존합니다. 추가 보너스로 \barredprod명령도 정의하여 다음의 금지 버전을 생성합니다 \prod. 이는 구성이 어떻게 일반화될 수 있는지 보여줍니다.

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly 
                                 % declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.

\usepackage{amsmath} % the code below assumes this

\makeatletter

\newcommand*\barredsum{%
  \DOTSB\mathop{%
      \@rodriguez@mathpalette \@rodriguez@overprint@bar \sum
    }\slimits@
}
\newcommand*\barredprod{%
  \DOTSB\mathop{%
      \@rodriguez@mathpalette \@rodriguez@overprint@bar \prod
    }\slimits@
}

% A home-brewed version of "\mathpalette" that also supplies the font 
% selector (e.g., "\textfont"):
\newcommand*\@rodriguez@mathpalette[2]{%
  % #1 := macro doing the actual job, which expects as its own arguments
  %         - #1, a style selector (e.g., "\displaystyle")
  %         - #2, a font selector (e.g., "\textfont")
  %         - #3, a custom argument (not truly necessary, here!)
  % #2 := custom argument that should be passed as #3 to macro #1
  \mathchoice
    {#1\displaystyle      \textfont         {#2}}%
    {#1\textstyle         \textfont         {#2}}%
    {#1\scriptstyle       \scriptfont       {#2}}%
    {#1\scriptscriptstyle \scriptscriptfont {#2}}%
}

\newcommand*\@rodriguez@overprint@bar[3]{%
  % #1 := style selector (e.g., "\displaystyle")
  % #2 := font selector (e.g., "\textfont")
  % #3 := base symbol
  \sbox\z@{$#1#3$}%
  \dimen@   = \ht\z@   \advance \dimen@   \p@
  \dimen@ii = \dp\z@   \advance \dimen@ii \p@
  \dimen4 = 1.25\fontdimen 8 #2\thr@@ \relax
  \ooalign{% the resulting box has the same...
    \@rodriguez@bar \dimen@ \z@ \cr   % ... height as the first row
    $\m@th #1#3$\cr
    \@rodriguez@bar \z@ \dimen@ii \cr % ... depth as the last row
  }%
}
\newcommand*\@rodriguez@bar[2]{%
  \hidewidth \vrule \@width \dimen4 \@height #1\@depth #2\hidewidth
}

\makeatother



\begin{document}

In display:
\[
    \barredsum_{i=1}^{N} x_{i} \neq \sum_{i=1}^{N} x_{i}
\]

In-line:
\begin{center}
    \( \barredsum_{i=1}^{N} x_{i} \neq \sum_{i=1}^{N} x_{i} \),
    \quad
    \( A_{\barredsum_{i=1}^{N} x_{i}} \neq A_{\sum_{i=1}^{N} x_{i}} \),
    \quad
    \( A_{B^{\barredsum_{i=1}^{N} x_{i}}} \neq A_{B^{\sum_{i=1}^{N} x_{i}}} \).
\end{center}

The barred product:
\[
    \barredprod_{i=1}^{N} x_{i} \neq \prod_{i=1}^{N} x_{i}
\]
Etc.\ etc.

\end{document}

물론 이 솔루션에는 수직 막대의 두 끝에 둥근 캡이 없습니다.

편집하다: 출력을 보여주는 이미지를 포함하려고 했으나 그렇게 하는 것을 잊어버렸습니다. 이제 이 문제를 수정하는 중입니다.

코드 출력

답변3

산출

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
    \sum_{i=1}^N {\Big\vert\quad x_i}\\
    \sum_{i=1}^N {\hspace{-1em}\Big\vert\quad x_i}\\
    \sum_{i=1}^N {\hspace{-1em}\Big\vert\hspace{1em}\quad x_i}
\end{align}
\end{document}

답변4

간격에 대한 나의 지식은 매우 제한적이지만 여기에 한 가지 제안이 있습니다.

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{equation}
\mathclap{\sum_{i=1}^N}{\Big\vert}\quad x_i
\end{equation}
\end{document}

수직 막대를 사용한 합계

관련 정보